本文介绍了获取正在运行的进程的已分配内存区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何使用WinAPI函数获得某些进程分配的内存区域?我想知道每个区域的起始地址,大小以及其他一些信息,例如保护类型等.
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 type etc.
我找不到任何WinAPI函数来做;-(
I can't find any WinAPI function to do it ;-(
有人可以帮助我吗?
推荐答案
有代码使用VirtualQueryEx
此处:
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);
}
这篇关于获取正在运行的进程的已分配内存区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!