The Loader Header
The loader header data structure is of fixed size (56 bytes) and has the form shown in Listing 8-3.Listing 8-3 Loader header data structure
struct PEFLoaderInfoHeader { SInt32mainSection; UInt32mainOffset; SInt32initSection; UInt32initOffset; SInt32termSection; UInt32termOffset; UInt32importedLibraryCount; UInt32totalImportedSymbolCount; UInt32relocSectionCount; UInt32relocInstrOffset; UInt32loaderStringsOffset; UInt32exportHashOffset; UInt32exportHashTablePower; UInt32exportedSymbolCount; };The fields in the loader header are as follows:
- The
mainSectionfield (4 bytes) specifies the number of the section in this container that contains the main symbol. If the fragment does not have a main symbol, this field is set to-1.- The
mainOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the section to the main symbol.- The
initSectionfield (4 bytes) contains the number of the section containing the initialization function's transition vector. If no initialization function exists, this field is set to-1.- The
initOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the section to the initialization function's transition vector.- The
termSectionfield (4 bytes) contains the number of the section containing the termination routine's transition vector. If no termination routine exists, this field is set to-1.- The
termOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the section to the termination routine's transition vector.- The
importedLibraryCountfield (4 bytes) indicates the number of imported libraries.- The
totalImportedSymbolCountfield (4 bytes) indicates the total number of imported symbols.- The
relocSectionCountfield (4 bytes) indicates the number of sections containing load-time relocations.- The
relocInstrOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the relocations area.- The
loaderStringsOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the loader string table.- The
exportHashOffsetfield (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the export hash table. The hash table should be 4-byte aligned with padding added if necessary.- The
exportHashTablePowerfield (4 bytes) indicates the number of hash index values (that is, the number of entries in the hash table). The number of entries is specified as a power of two. For example, a value of0indicates one entry, while a value of2indicates four entries.If no exports exist, the hash table still contains one entry, and the value of this field is
0.- The
exportedSymbolCountfield (4 bytes) indicates the number of symbols exported from this container.