1,代码
PBYTE pb = NULL; MEMORY_BASIC_INFORMATION mbi; while (VirtualQuery(pb,&mbi,sizeof(mbi)) == sizeof(mbi)) { TCHAR szModeName[MAX_PATH] = {0}; if (mbi.State == MEM_FREE) { mbi.AllocationBase = mbi.BaseAddress; } if (mbi.AllocationBase == AfxGetModuleState()->m_hCurrentInstanceHandle || mbi.AllocationBase != mbi.BaseAddress || mbi.AllocationBase == NULL) { } else { GetModuleFileName((HINSTANCE)mbi.AllocationBase,szModeName,_countof(szModeName)); if (_tcslen(szModeName)>0) { EASY_LOG(szModeName); } } pb += mbi.RegionSize; }
注:其中EASY_LOG() 是一个输出日志的宏,可自行修改;
效果:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END