Does not QueryVirtual Work?
#include <engextcpp.hpp>
class EXT_CLASS : public ExtExtension
{
public:
EXT_COMMAND_METHOD(getoffinfo);
};
EXT_DECLARE_GLOBALS();
EXT_COMMAND(getoffinfo, "", "{;e,d=0;getoffinfo;simulates !address <address>}")
{
ULONG64 Offset = GetUnnamedArgU64(0);
if (Offset == 0)
{
Out("usage !getoffinfo <address>\n");
}
else
{
MEMORY_BASIC_INFORMATION64 meminfo;
memset(&meminfo,0,sizeof(MEMORY_BASIC_INFORMATION64));
m_Data2->QueryVirtual(Offset,&meminfo);
Out("Allocation Base : %x\n",meminfo.AllocationBase);
Out("Base Address : %x\n",meminfo.BaseAddress);
Out("End Address : %x\n",meminfo.AllocationBase + meminfo.RegionSize);
Out("RegionSize : %x\n",meminfo.RegionSize);
Out("Type : %x\n",meminfo.Type);
Out("State : %x\n",meminfo.State);
}
}
結果如下
0:000> !address windbg
Usage: Image
Allocation Base: 01000000
Base Address: 01000000
End Address: 01001000
Region Size: 00001000
Type: 01000000 MEM_IMAGE
State: 00001000 MEM_COMMIT
Protect: 00000002 PAGE_READONLY
More info: lmv m windbg
More info: !lmi windbg
More info: ln 0x1000000
0:000> .load getoffinfo
0:000> !getoffinfo
usage !getoffinfo <address>
0:000> !getoffinfo windbg
Allocation Base : 1000000
Base Address : 1000000
End Address : 1001000
RegionSize : 1000
Type : 1000000
State : 1000
這聽起來像你正在尋找['IDebugDataSpaces2 :: QueryVirtual'(http://msdn.microsoft.com/en-us/library/windows/硬件/ ff553502%28V = vs.85%29.aspx)。它填充了一個['MEMORY_BASIC_INFORMATION'](http://msdn.microsoft.com/zh-cn/library/windows/desktop/aa366775%28v=vs.85%29.aspx)結構,該頁面包含給定的地址。 – 2014-12-11 11:57:07
確實,這就是我正在尋找的。謝謝! – user1831704 2014-12-12 14:57:56