【API】獲取系統內存所有狀態
阿新 • • 發佈:2018-02-02
base 系統 sizeof minimum address sea sha regions info
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;
【API】獲取系統內存所有狀態