EXE 标头中的奇怪值

发布于 2024-08-20 03:28:19 字数 412 浏览 6 评论 0原文

我在 EXE 标头中看到了一个奇怪的值,

00000000 :4D 5A 90 00 03 00 00 00 - 04 00 00 00 FF FF 00 00
00000010 :B8 00 00 00 00 00 00 00 - 40 00 00 00 00 00 00 00
00000020 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000030 :00 00 00 00 00 00 00 00 - 00 00 00 00 A8 00 00 00 <-

我不知道 A8 在偏移量 3C 处正在做什么,但如果我用零替换它,我的程序就不会执行。

那是什么?

您能给我一个完整的 MS DOS 标头(规范)的超链接吗?

I've seen a strange value placed in an EXE header

00000000 :4D 5A 90 00 03 00 00 00 - 04 00 00 00 FF FF 00 00
00000010 :B8 00 00 00 00 00 00 00 - 40 00 00 00 00 00 00 00
00000020 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00000030 :00 00 00 00 00 00 00 00 - 00 00 00 00 A8 00 00 00 <-

I don't know what A8 is doing at offset 3C but if I replace it with zeros my program doesn't execute.

What is that?

Could you give me a hyperlink to the full MS DOS header (spec)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜雨飘雪 2024-08-27 03:28:19

我怀疑它是新PE头的偏移量,前30个奇数字节是MS-DOS头,0xA8所在文件的偏移量对应于结构体IMAGE_DOS_HEADER中的字段

LONG e_lfanew;  // File address of new exe header

值 0xA8 将成为新的 IMAGE_NT_HEADER 的一部分,其中包含以下信息:

  1. DWORD Signature;
  2. IMAGE_FILE_HEADER FileHeader;
  3. IMAGE_OPTIONAL_HEADEROptionalHeader;

前两个字节是可执行文件中的原始 MS-DOS 头,如以下常量所示:

WORD IMAGE_DOS_SIGNATURE = 0x5A4D;      // MZ

IMAGE_NT_HEADER 具有此签名来标识它是 NT 平台的可执行文件

DWORD IMAGE_NT_SIGNATURE = 0x00004550;   // PE00

您将在头文件中找到所有这些信息称为pe.h

发生的情况是您擦除了值 0xA8,加载程序找不到 IMAGE_NT_HEADERS 因此失败。

I suspect that it is the offset to the new PE header, the first 30 odd bytes are the MS-DOS header, that offset into the file where 0xA8 resides in corresponds to the field in the structure IMAGE_DOS_HEADER called

LONG e_lfanew;  // File address of new exe header

It is that value 0xA8 would be part of the new IMAGE_NT_HEADER which contains this information:

  1. DWORD Signature;
  2. IMAGE_FILE_HEADER FileHeader;
  3. IMAGE_OPTIONAL_HEADER OptionalHeader;

The very first two bytes are the original MS-DOS header into the executable as shown by this constant:

WORD IMAGE_DOS_SIGNATURE = 0x5A4D;      // MZ

The IMAGE_NT_HEADER has this signature to identify that it is an executable for NT platforms

DWORD IMAGE_NT_SIGNATURE = 0x00004550;   // PE00

You will find all this information in a header file called pe.h.

What happened there is you wiped out the value 0xA8, the loader could not find the IMAGE_NT_HEADERS and hence failed.

温折酒 2024-08-27 03:28:19

PE 的第一部分是 MSDOS 存根;在 0x3C(“A8”所在的位置)处有 PE 文件签名的偏移量。如果将其清零,加载程序将无法找到 PE 签名,并将拒绝加载它(或将其作为 MS-DOS 可执行文件加载,我没有尝试)。
有关详细信息,请参阅 PE 格式规范

The first part of a PE is the MSDOS stub; at 0x3C (where your "A8" is) there's the offset to the PE file signature. If you zero it, the loader won't be able to find the PE signature, and will refuse to load it (or load it as just an MS-DOS executable, I didn't try).
For more information, see the PE format specifications.

孤星 2024-08-27 03:28:19

偏移量 0x3c 处的 DWORD 是新 EXE 标头(又名 IMAGE_NT_HEADERS)的偏移量。因此,如果您更改此处的值,PE 加载程序将无法找到新的 EXE 标头。

DWORD at offset 0x3c is the offset of the new EXE header, aka IMAGE_NT_HEADERS. So if you change the value there, the PE loader cannot find the new EXE header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文