当前位置: 首页 > news >正文

sfc_os!SfcValidateDLL函数分析之SfcGetValidationData

第一部分:

NTSTATUS
SfcQueueValidationThread(
IN PVOID lpv
)
{


//
// now validate the file
//

                SfcValidateDLL( vrd, hCatAdmin );
vrd->Flags |= VRD_FLAG_REQUEST_PROCESSED;


第二部分:

0: kd> t
Breakpoint 14 hit
sfc_os!SfcValidateDLL:
001b:768378e1 55              push    ebp
0: kd> kc
#
00 sfc_os!SfcValidateDLL
01 sfc_os!SfcQueueValidationThread
02 kernel32!BaseThreadStart
0: kd> kv
# ChildEBP RetAddr  Args to Child              
00 007cf724 76838a3d 012380d0 01c0caf8 00000000 sfc_os!SfcValidateDLL (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\subsys\sm\sfc\dll\validate.c @ 2201]
01 007cffb8 77e41be7 00000000 00000000 00000000 sfc_os!SfcQueueValidationThread+0x4ce (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\subsys\sm\sfc\dll\validate.c @ 1671]
02 007cffec 00000000 7683856f 00000000 00000000 kernel32!BaseThreadStart+0x34 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\win32\client\support.c @ 533]


第三部分:

BOOL
SfcGetValidationData(
IN PUNICODE_STRING FileName,
IN PUNICODE_STRING FullPathName,
IN HANDLE DirHandle,
IN HCATADMIN hCatAdmin,
OUT PIMAGE_VALIDATION_DATA ImageValData
)
{
NTSTATUS Status;
HANDLE FileHandle;

    ASSERT((FileName != NULL) && (FileName->Buffer != NULL));
ASSERT((FullPathName != NULL) && (FullPathName->Buffer != NULL));
ASSERT(   (DirHandle != NULL)
&& (hCatAdmin != NULL)
&& (ImageValData != NULL) );

    RtlZeroMemory( ImageValData, sizeof(IMAGE_VALIDATION_DATA) );

    //
// open the file
//

    Status = SfcOpenFile( FileName, DirHandle, SHARE_ALL, &FileHandle );
if (NT_SUCCESS(Status)) {

        ASSERT(FileHandle != INVALID_HANDLE_VALUE);
ImageValData->FilePresent = TRUE;
SfcGetFileVersion(FileHandle,
&ImageValData->DllVersion,
&ImageValData->DllCheckSum,
ImageValData->FileName );
} else {
//
// we don't to anything on failure since this is an expected state
// if the file was just removed.  The member variables's below are
// automatically set at the entrypoint to the function so they are
// not necessary but are present and commented out for the sake of
// clarity
//
NOTHING;
//ImageValData->SignatureValid = FALSE;
//ImageValData->FilePresent = FALSE;
}

    //
// verify the file signature
//

    if (hCatAdmin && FileHandle != NULL) {
ImageValData->SignatureValid = SfcValidateFileSignature(
hCatAdmin,
FileHandle,
FileName->Buffer,
FullPathName->Buffer);
} else {
ImageValData->SignatureValid = FALSE;
}

    //
// close the file
//

    if (FileHandle != INVALID_HANDLE_VALUE) {
NtClose( FileHandle );
}

    return TRUE;
}

第四部分:

0: kd> dx -id 0,0,ffffffff89ce3d88 -r1 (*((sfc_os!_IMAGE_VALIDATION_DATA *)0x12380e0))
(*((sfc_os!_IMAGE_VALIDATION_DATA *)0x12380e0))                 [Type: _IMAGE_VALIDATION_DATA]
[+0x000] DllVersion       : 0x500020ece0000 [Type: unsigned __int64]
[+0x008] DllCheckSum      : 0xcb39 [Type: unsigned long]
[+0x00c] SignatureValid   : 0 [Type: int]
[+0x010] FilePresent      : 1 [Type: int]
[+0x014] FileName         [Type: unsigned short [32]]
0: kd> dx -id 0,0,ffffffff89ce3d88 -r1 (*((sfc_os!unsigned short (*)[32])0x12380f4))
(*((sfc_os!unsigned short (*)[32])0x12380f4))                 [Type: unsigned short [32]]
[0]              : 0x70 [Type: unsigned short]
[1]              : 0x69 [Type: unsigned short]
[2]              : 0x64 [Type: unsigned short]
[3]              : 0x67 [Type: unsigned short]
[4]              : 0x65 [Type: unsigned short]
[5]              : 0x6e [Type: unsigned short]
[6]              : 0x2e [Type: unsigned short]
[7]              : 0x64 [Type: unsigned short]
[8]              : 0x6c [Type: unsigned short]
[9]              : 0x6c [Type: unsigned short]

0: kd> db 0x12380f4
012380f4  70 00 69 00 64 00 67 00-65 00 6e 00 2e 00 64 00  p.i.d.g.e.n...d.
01238104  6c 00 6c 00 00 00 00 00-00 00 00 00 00 00 00 00  l.l.............

http://www.lryc.cn/news/626221.html

相关文章:

  • 2025年09月计算机二级Java选择题每日一练——第一期
  • 瑞萨e2studio:HardwareDebug配置项详解
  • MongoDB知识速查
  • React 静态站点生成
  • 数据结构代码分享-5 链式栈
  • Consul- acl机制!
  • latex|算法algorithm宏包和注意事项
  • 区块链 + 域名Web3时代域名投资的新风口(下)
  • RWA加密金融高峰论坛星链品牌全球发布 —— 稳定币与Web3的香港新篇章
  • CTFshow系列——命令执行web34-37
  • 厂区能源管理智能化改造物联网解决方案
  • 驱动开发系列65 - NVIDIA 开源GPU驱动open-gpu-kernel-modules 目录结构
  • week2-[一维数组]最大元素
  • 数据仓库OLTPOLAP维度讲解
  • 传统防火墙
  • LG P3710 方方方的数据结构 Solution
  • Windows/Centos 7下搭建Apache服务器
  • Android RxJava数据库操作:响应式改造实践
  • 006.Redis 哨兵(Sentinel)架构实战
  • C++入门自学Day14-- deque类型使用和介绍(初识)
  • 【运维进阶】Ansible 角色管理
  • 用poll改写select
  • RabbitMQ:SpringAMQP Direct Exchange(直连型交换机)
  • 在Excel和WPS表格中为多个数字同时加上相同的数值
  • 如何解析PDF中的复杂表格数据
  • UniApp 实现pdf上传和预览
  • Go语言快速入门指南(面向Java工程师)
  • 智慧校园中IPTV融合对讲:构建高效沟通新生态
  • DHCP详解
  • sqlite-gui:一款开源免费、功能强大的SQLite开发工具