Get allocated memory regions of running process
Can anyone tell me how to get using WinAPI functions memory allocated memory regions of some process? I want know for each region, start address, size and some other things like, protect开发者_C百科 type etc.
I can't find any WinAPI function to do it ;-(
Can anyone help me?
There is code to brute force this using VirtualQueryEx
here:
MEMORY_BASIC_INFORMATION mbi;
/* Get maximum address range from system info */
GetSystemInfo(&si);
/* walk process addresses */
lpMem = 0;
while (lpMem < si.lpMaximumApplicationAddress) {
VirtualQueryEx(...)
/* increment lpMem to next region of memory */
lpMem = (LPVOID)((DWORD)lpList->mbi.BaseAddress +
(DWORD)lpList->mbi.RegionSize);
}
精彩评论