BOOL WINAPI GetThreadContext(
In HANDLE hThread,
Inout LPCONTEXT lpContext
);
参数一:指定挂起的线程的句柄
参数二:线程上文结构体
//第一步 已挂起的方式创建一个进程
CONTEXT ct;
ct.ContextFlags=CONTEXT_FULL; //一定要指定标志不然不会获取相应的值
GetThreadContext(hThread,&ct);
DWORD dwEntryPoint=ct.Eax; //eax里存放的就是程序入口点
//获取ImageBase
char* BaseAddress=(char*)ct.Ebx+8;
TCHAR szBuffer[256]={0};
ReadProcessMemory(hProcess,BaseAddress,szBuffer,4,NULL);