SYSTEM_INFO sysInfo = {0};
GetSystemInfo(&sysInfo);
DWORD dwMinAddr = (DWORD)sysInfo.lpMinimumApplicationAddress;
DWORD dwMaxAddr = (DWORD)sysInfo.lpMaximumApplicationAddress;
MEMORY_BASIC_INFORMATION memBase;
int i = 0;
for (dwMinAddr; dwMinAddr < dwMaxAddr;)
{
if (VirtualQuery((LPVOID)dwMinAddr, &memBase, sizeof(memBase)) == sizeof(memBase))
{
wprintf(_T("%d %x %x %d\r\n"),i ++,memBase.BaseAddress, memBase.RegionSize,memBase.AllocationProtect);
}
dwMinAddr += memBase.RegionSize;
}
typedef struct _MEMORY_BASIC_INFORMATION
{
PVOID BaseAddress;
PVOID AllocationBase;
DWORD AllocationProtect;
DWORD RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
} MEMORY_BASIC_INFORMATION;
原文地址:http://blog.51cto.com/383156647/2068232