我一直在尝试为WINDOWS创建一个可执行注入器,程序编译时没有任何错误,但是当我运行程序时(通过Microsoft Visual Studio的调试模式),我得到一个运行时错误。 Visual Studio突出显示一行(我已将其标记为注释)
#include <windows.h>
#include "resource.h"
int main()
{
PIMAGE_DOS_HEADER IDH;
PIMAGE_NT_HEADERS INTH;
PIMAGE_SECTION_HEADER ISH;
//Lets load the resource
HRSRC hResource=FindResourceA(NULL,(LPCSTR)MAKEINTRESOURCE(IDR_EXE1),"EXE");
DWORD ResourceSize=SizeofResource(NULL,hResource);
HGLOBAL hGlob=LoadResource(NULL,hResource);
LPSTR lpFileMaped=(LPSTR)LockResource(hGlob);
//obtain the DOS and PE headers
IDH=(PIMAGE_DOS_HEADER)&lpFileMaped[0];
INTH=(PIMAGE_NT_HEADERS)&lpFileMaped[IDH->e_lfanew]; //this is the highlighted line
// which supposedly causes an error at runtime
....
为什么会这样,有人可以详细说明吗?