我想把自己的ImageBase设置为0x2000000,然后再读另一个EXE程序到它的ImageBase,当然一般是0x400000,但是我用VirtualAlloc申请空间的时候,总是失败,GetLastError是0x1e7(487),当然,我也试过只加载ntdll.dll程序,同样失败,如何解决?
部分代码如下:
DWORD dwImageBase = pNtHeader->OptionalHeader.ImageBase;
LPVOID lpImageBuff = ::VirtualAlloc((PVOID)(dwImageBase), pNtHeader->OptionalHeader.SizeOfImage, MEM_RESERVE, PAGE_READWRITE);
if (NULL == lpImageBuff)
{
::MessageBox(NULL,_T("Application for ImageBase failed!!!"),_T("ERROR"),MB_ICONSTOP | MB_OK);
return;
}