PE 文件中 headers 部分中的 PointerToRawData 条目是否按升序保存偏移量?

Does the PointerToRawData entries within section headers in a PE file hold offsets in ascending order?

Does the PointerToRawData entries within section headers in a PE file hold offsets in ascending order?

我可以假设 PE 文件中 headers 部分的 PointerToRawData 条目相对于它们在部分 table 中的顺序以升序保存偏移量吗?

我看到文档说:

In an image file, the VAs for sections must be assigned by the linker so that they are in ascending order and adjacent, and they must be a multiple of the SectionAlignment value in the optional header.

但是,我找不到关于 PointerToRawData 成员的任何信息?

如果可能,请提供信息来源。

谢谢。

是的,PointerToRawData 值指向的部分数据需要与部分 headers 的顺序相同,如您所述,需要采用 VA 顺序。

根据 Microsoft 可移植可执行文件和通用 Object 文件格式规范 - 修订版 8.3 - 2013 年 2 月 6 日:

Section Data

[...] Section data must appear in order of the RVA values for the corresponding sections (as do the individual section headers in the section table).

There are additional restrictions on image files if the SectionAlignment value in the optional header is less than the page size of the architecture. For such files, the location of section data in the file must match its location in memory when the image is loaded, so that the physical offset for section data is the same as the RVA.

在table段中,header段的VirtualAddressPointerToRawData字段必须是升序排列,即第一段header持有最低的VirtualAddressPointerToRawData

我猜微软做出这个决定是为了加快加载过程。

官方 PE 文档在名为“Section Data”的部分中说:

In an image file, the section data must be aligned on a boundary as specified by the FileAlignment field in the optional header. Section data must appear in order of the RVA values for the corresponding sections (as do the individual section headers in the section table).