VOID ShowPath(ULONG mmVad)
{
PUNICODE_STRING pPath;
ULONG ca;//_CONTROL_AREA
ULONG fp;//_FILE_OBJECT
ca = *(ULONG *)(mmVad + ControlArea);
if( !MmIsAddressValid( (ULONG *)ca ) )
{
//dprintf("[EnumModules] ControlArea is not available : 0x%X",ca);
return;
}
fp = *(ULONG *)(ca + FilePointer);
if( !MmIsAddressValid( (ULONG *)fp ) )
{
//dprintf("[EnumModules] FileObject is not available : 0x%X",fp);
return;
}
pPath = (PUNICODE_STRING)(fp + FileName);
dprintf("[EnumModules] The file name is %S",pPath->Buffer);
//dprintf("[EnumModules] The MMVAD is 0x%X",mmVad);
//dprintf("\n");
nCount++;//计数
}
这样和用NtQueryVirtualMemory扫描出来的结果一样(MemorySectionName),可以在DebugView里看到。输出是这样的。
[EnumModules] The file name is \Project\VisualC++\HideModule\Release\HideModule.exe
[EnumModules] The file name is \WINDOWS\system32\ntdll.dll
[EnumModules] The file name is \WINDOWS\system32\kernel32.dll
[EnumModules] The file name is \WINDOWS\system32\advapi32.dll
[EnumModules] The file name is \WINDOWS\system32\rpcrt4.dll
[EnumModules] The file name is \WINDOWS\system32\gdi32.dll
[EnumModules] The file name is \WINDOWS\system32\user32.dll
[EnumModules] The file name is \WINDOWS\system32\imm32.dll
[EnumModules] The file name is \WINDOWS\system32\msvcrt.dll
[EnumModules] The file name is \WINDOWS\system32\apphelp.dll
[EnumModules] The file name is \WINDOWS\system32\version.dll
[EnumModules] The file name is \WINDOWS\system32\lpk.dll
[EnumModules] The file name is \WINDOWS\system32\usp10.dll
[EnumModules] The file name is \WINDOWS\system32\unicode.nls
[EnumModules] The file name is \WINDOWS\system32\sortkey.nls
[EnumModules] The file name is \WINDOWS\system32\ctype.nls
[EnumModules] The file name is \WINDOWS\system32\sorttbls.nls
[EnumModules] The file name is \WINDOWS\system32\locale.nls