2013-08-25 22 views
0

如果我设置类似0x00000040(我的代码位于该地址),然后程序崩溃与此错误:我可以在PE头中的代码中设置入口点吗?

The application was unable to start correctly (0xc000007b) 

但是,如果我从代码段JMP到0x00400040,然后它工作。

为什么我得到那个奇怪的地址(0xc000007b)的错误?是否有可能从位于章节之外的代码开始执行程序?

我使用的是Windows 8

回答

0

0xc000007b是从Windows错误代码。你可以看看他们here。你的是STATUS_INVALID_IMAGE_FORMAT

我假设你在PE标题中修改了AddressOfEntryPoint。对于here

AddressOfEntryPoint: A pointer to the entry point function, relative to the image base address. For executable files, this is the starting address. For device drivers, this is the address of the initialization function. The entry point function is optional for DLLs. When no entry point is present, this member is zero.

因此,如果您将此值设置为0x40,它会指向在DOS头(你的模块的开始)的地址。内存中的头文件块没有正确的内存保护来执行,所以OS加载程序将失败。

我的猜测是,你实际上想要跳到0x1040,在典型的可执行文件的Windows 8系统上,它将在代码段的第一个地址之后是0x40字节。

相关问题