#include <iostream> #include <windows.h> #include <Tlhelp32.h.> using namespace std; int main() { HANDLE h= CreateToolhelp32Snapshot(8, 780); MODULEENTRY32 me; int ret = Module32First(h, &me); while (ret) { printf("%p\t\%s\n", me.modBaseAddr, me.szModule); ret = Module32Next(h, &me); } CloseHandle(h); return 0; }
本文展示了一个使用C++编写的程序,该程序利用Windows API函数CreateToolhelp32Snapshot和Module32First/Module32Next来枚举指定进程的所有模块。通过获取进程快照并迭代模块列表,程序打印出每个模块的基地址和模块名。
1726





