-
-
[求助]请问怎样从key handle 获取注册表项的完整路径
-
发表于:
2009-5-12 10:33
8533
-
[求助]请问怎样从key handle 获取注册表项的完整路径
用ObQueryNameString总蓝屏,代码如下:
麻烦大家帮帮忙看看有什么问题,或者有没有其他方法来做。
BOOLEAN GetRegistryObjectCompleteName1(PUNICODE_STRING pRegistryPath, PUNICODE_STRING pPartialRegistryPath, PVOID pKey)
{
BOOLEAN getCompleteName = FALSE;
PUNICODE_STRING fullName = NULL;
ULONG actualLen;
NTSTATUS status;
status = ObQueryNameString( pKey, (POBJECT_NAME_INFORMATION)fullName, 0, &actualLen );
if(status == STATUS_INFO_LENGTH_MISMATCH)
{
fullName = ExAllocatePoolWithTag(NonPagedPool, actualLen,REGISTRY_POOL_TAG);
status = ObQueryNameString( pKey, (POBJECT_NAME_INFORMATION)fullName, actualLen, &actualLen );
if(NT_SUCCESS(status))
{
RtlUnicodeStringCopy(pRegistryPath, fullName);
getCompleteName = TRUE;
}
else
{
KdPrint(("Error %x getting QueryNameString.\n"));
}
ExFreePoolWithTag(fullName,REGISTRY_POOL_TAG);
}
return getCompleteName;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课