能力值:
( LV2,RANK:10 )
|
-
-
[求助]win7中寻找程序基地址
已解决,找了半天终于找到了一段代码
DWORD GetBaseAddr(DWORD pid) //获取程序基址
{
HANDLE hModuleSnap=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,pid);
if (hModuleSnap==INVALID_HANDLE_VALUE)
{
AfxMessageBox(_T("创建进程模块失败!"));
}
MODULEENTRY32 me;
me.dwSize=sizeof(MODULEENTRY32);
Module32First(hModuleSnap,&me);
DWORD dwBaseAddr;
dwBaseAddr=(DWORD)me.modBaseAddr;
CloseHandle(hModuleSnap);
return dwBaseAddr;
}
原来我也用过这段代码里的函数但是提示未标示,后来才知道这些函数包含在"Tlhelp32.h"中,需要加上#include "Tlhelp32.h"
谢谢各位。
|