using System.Runtime.InteropServices; namespace BurnOutSharp.Models.LinearExecutable { /// /// The `information block` in the LE header contains the linker version number, /// length of various tables that further describe the executable file, the /// offsets from the beginning of the header to the beginning of these tables, /// the heap and stack sizes, and so on. The following list summarizes the /// contents of the header `information block` (the locations are relative to /// the beginning of the block): /// /// /// [StructLayout(LayoutKind.Sequential)] public class InformationBlock { /// /// Specifies the signature word /// 'LE' (4Ch 45H) /// 'LX' (4Ch 58H) /// /// /// The signature word is used by the loader to identify the EXE /// file as a valid 32-bit Linear Executable Module Format. /// public char[] Signature; /// /// Byte Ordering. /// /// /// This byte specifies the byte ordering for the linear EXE format. /// public ByteOrder ByteOrder; /// /// Word Ordering. /// /// /// This byte specifies the Word ordering for the linear EXE format. /// public WordOrder WordOrder; /// /// Linear EXE Format Level. /// /// /// The Linear EXE Format Level is set to 0 for the initial version of the /// 32-bit linear EXE format. Each incompatible change to the linear EXE /// format must increment this value. This allows the system to recognized /// future EXE file versions so that an appropriate error message may be /// displayed if an attempt is made to load them. /// public uint ExecutableFormatLevel; /// /// Module CPU Type. /// /// /// This field specifies the type of CPU required by this module to run. /// public CPUType CPUType; /// /// Module OS Type. /// /// /// This field specifies the type of Operating system required to run this module. /// public OperatingSystem ModuleOS; /// /// Module version /// /// /// This is useful for differentiating between revisions of dynamic linked modules. /// This value is specified at link time by the user. /// public uint ModuleVersion; /// /// Module type flags /// public ModuleFlags ModuleTypeFlags; /// /// Number of pages in module. /// /// /// This field specifies the number of pages physically contained in this module. /// In other words, pages containing either enumerated or iterated data, or /// zero-fill pages that have relocations, not invalid or zero-fill pages implied /// by the Virtual Size in the Object Table being larger than the number of pages /// actually in the linear EXE file. These pages are contained in the 'preload /// pages', 'demand load pages' and 'iterated data pages' sections of the linear /// EXE module. This is used to determine the size of the page information tables /// in the linear EXE module. /// public uint ModuleNumberPages; /// /// The Object number to which the Entry Address is relative. /// /// /// This specifies the object to which the Entry Address is relative. This must be /// a nonzero value for a program module to be correctly loaded. A zero value for /// a library module indicates that no library entry routine exists. If this value /// is zero, then both the Per-process Library Initialization bit and the Per-process /// Library Termination bit must be clear in the module flags, or else the loader /// will fail to load the module. Further, if the Per-process Library Termination bit /// is set, then the object to which this field refers must be a 32-bit object (i.e., /// the Big/Default bit must be set in the object flags; see below). /// public uint InitialObjectCS; /// /// Entry Address of module. /// /// /// The Entry Address is the starting address for program modules and the library /// initialization and Library termination address for library modules. /// public uint InitialEIP; /// /// The Object number to which the ESP is relative. /// /// /// This specifies the object to which the starting ESP is relative. This must be a /// nonzero value for a program module to be correctly loaded. This field is ignored /// for a library module. /// public uint InitialObjectSS; /// /// Starting stack address of module. /// /// /// The ESP defines the starting stack pointer address for program modules. A zero /// value in this field indicates that the stack pointer is to be initialized to the /// highest address/offset in the object. This field is ignored for a library module. /// public uint InitialESP; /// /// The size of one page for this system. /// /// /// This field specifies the page size used by the linear EXE format and the system. /// For the initial version of this linear EXE format the page size is 4Kbytes. /// (The 4K page size is specified by a value of 4096 in this field.) /// public uint MemoryPageSize; /// /// The shift left bits for page offsets. /// /// /// This field gives the number of bit positions to shift left when interpreting /// the Object Page Table entries' page offset field. This determines the alignment /// of the page information in the file. For example, a value of 4 in this field /// would align all pages in the Data Pages and Iterated Pages sections on 16 byte /// (paragraph) boundaries. A Page Offset Shift of 9 would align all pages on a /// 512 byte (disk sector) basis. The default value for this field is 12 (decimal), /// which give a 4096 byte alignment. All other offsets are byte aligned. /// public uint BytesOnLastPage; /// /// Total size of the fixup information in bytes. /// /// /// This includes the following 4 tables: /// - Fixup Page Table /// - Fixup Record Table /// - Import Module name Table /// - Import Procedure Name Table /// public uint FixupSectionSize; /// /// Checksum for fixup information. /// /// /// This is a cryptographic checksum covering all of the fixup information. The /// checksum for the fixup information is kept separate because the fixup data is /// not always loaded into main memory with the 'loader section'. If the checksum /// feature is not implemented, then the linker will set these fields to zero. /// public uint FixupSectionChecksum; /// /// Size of memory resident tables. /// /// /// This is the total size in bytes of the tables required to be memory resident /// for the module, while the module is in use. This total size includes all /// tables from the Object Table down to and including the Per-Page Checksum Table. /// public uint LoaderSectionSize; /// /// Checksum for loader section. /// /// /// This is a cryptographic checksum covering all of the loader section information. /// If the checksum feature is not implemented, then the linker will set these fields /// to zero. /// public uint LoaderSectionChecksum; /// /// Object Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ObjectTableOffset; /// /// Object Table Count. /// /// /// This defines the number of entries in Object Table. /// public uint ObjectTableCount; /// /// Object Page Table offset /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ObjectPageMapOffset; /// /// Object Iterated Pages offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ObjectIterateDataMapOffset; /// /// Resource Table offset /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ResourceTableOffset; /// /// Number of entries in Resource Table. /// public uint ResourceTableCount; /// /// Resident Name Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ResidentNamesTableOffset; /// /// Entry Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint EntryTableOffset; /// /// Module Format Directives Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ModuleDirectivesTableOffset; /// /// Number of Module Format Directives in the Table. /// /// /// This field specifies the number of entries in the /// Module Format Directives Table. /// public uint ModuleDirectivesCount; /// /// Fixup Page Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint FixupPageTableOffset; /// /// Fixup Record Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint FixupRecordTableOffset; /// /// Import Module Name Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ImportedModulesNameTableOffset; /// /// The number of entries in the Import Module Name Table. /// public uint ImportedModulesCount; /// /// Import Procedure Name Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint ImportProcedureNameTableOffset; /// /// Per-page Checksum Table offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint PerPageChecksumTableOffset; /// /// Data Pages Offset. /// /// /// This offset is relative to the beginning of the EXE file. /// public uint DataPagesOffset; /// /// Number of Preload pages for this module. /// /// /// Note that OS/2 2.0 does not respect the preload of pages as specified /// in the executable file for performance reasons. /// public uint PreloadPageCount; /// /// Non-Resident Name Table offset. /// /// /// This offset is relative to the beginning of the EXE file. /// public uint NonResidentNamesTableOffset; /// /// Number of bytes in the Non-resident name table. /// public uint NonResidentNamesTableLength; /// /// Non-Resident Name Table Checksum. /// /// /// This is a cryptographic checksum of the Non-Resident Name Table. /// public uint NonResidentNamesTableChecksum; /// /// The Auto Data Segment Object number. /// /// /// This is the object number for the Auto Data Segment used by 16-bit modules. /// This field is supported for 16-bit compatibility only and is not used by /// 32-bit modules. /// public uint AutomaticDataObject; /// /// Debug Information offset. /// /// /// This offset is relative to the beginning of the linear EXE header. /// public uint DebugInformationOffset; /// /// Debug Information length. /// /// /// The length of the debug information in bytes. /// public uint DebugInformationLength; /// /// Instance pages in preload section. /// /// /// The number of instance data pages found in the preload section. /// public uint PreloadInstancePagesNumber; /// /// Instance pages in demand section. /// /// /// The number of instance data pages found in the demand section. /// public uint DemandInstancePagesNumber; /// /// Heap size added to the Auto DS Object. /// /// /// The heap size is the number of bytes added to the Auto Data Segment /// by the loader. This field is supported for 16-bit compatibility only and /// is not used by 32-bit modules. /// public uint ExtraHeapAllocation; } }