Closed mstange closed 2 years ago
Thanks, great catch. In IMAGE_SECTION_HEADER
, it's defined as a union of virtual size and physical address, but pdbdump and other tools have it hardcoded to "virtual size". The reason for this is hinted at in this stackexchange answer:
This field has different meanings, in EXEs or OBJs. In an EXE, it holds the actual size of the code or data. This is the size before rounding up to the nearest file alignment multiple. The
SizeOfRawData field (seems a bit of a misnomer) later on in the
structure holds the rounded up value. The Borland linker reverses
the meaning of these two fields and appears to be correct. For OBJ
files, this field indicates the physical address of the section. The
first section starts at address 0. To find the physical address in
an OBJ file of the next section, add the SizeOfRawData value to the
physical address of the current section.
ImageSectionHeader
currently has aphysical_address
member. This appears to be the wrong name for that field. Instead, that field should be calledvirtual_size
.Compare the following outputs: