From 399ee98923c8f464335deb689001c61fe74d19ab Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 4 Nov 2022 15:36:38 -0700 Subject: [PATCH] Add LE/LX import procedure name table --- .../LinearExecutable/Executable.cs | 7 ++- .../ImportProcedureNameTableEntry.cs | 49 +++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 BurnOutSharp.Models/LinearExecutable/ImportProcedureNameTableEntry.cs diff --git a/BurnOutSharp.Models/LinearExecutable/Executable.cs b/BurnOutSharp.Models/LinearExecutable/Executable.cs index 9d2a5b2b..504b9d98 100644 --- a/BurnOutSharp.Models/LinearExecutable/Executable.cs +++ b/BurnOutSharp.Models/LinearExecutable/Executable.cs @@ -60,11 +60,14 @@ namespace BurnOutSharp.Models.LinearExecutable // TODO: Fix-up record table /// - /// Imported module name table + /// Import module name table /// public ImportModuleNameTableEntry[] ImportModuleNameTable { get; set; } - // TODO: Imported procedures name table + /// + /// Import procedure name table + /// + public ImportModuleProcedureNameTableEntry[] ImportModuleProcedureNameTable { get; set; } // TODO: Preload Pages // TODO: Demand Load Pages diff --git a/BurnOutSharp.Models/LinearExecutable/ImportProcedureNameTableEntry.cs b/BurnOutSharp.Models/LinearExecutable/ImportProcedureNameTableEntry.cs new file mode 100644 index 00000000..3c95add4 --- /dev/null +++ b/BurnOutSharp.Models/LinearExecutable/ImportProcedureNameTableEntry.cs @@ -0,0 +1,49 @@ +using System.Runtime.InteropServices; + +namespace BurnOutSharp.Models.LinearExecutable +{ + /// + /// The import procedure name table defines the procedure name strings imported + /// by this module through dynamic link references. These strings are referenced + /// through the imported relocation fixups. + /// + /// To determine the length of the import procedure name table add the fixup + /// section size to the fixup page table offset, this computes the offset to + /// the end of the fixup section, then subtract the import procedure name table + /// offset. These values are located in the linear EXE header. The import + /// procedure name table is followed by the data pages section. Since the data + /// pages section is aligned on a 'page size' boundary, padded space may exist + /// between the last import name string and the first page in the data pages + /// section. If this padded space exists it will be zero filled. + /// + /// The strings are CASE SENSITIVE and NOT NULL TERMINATED. + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public class ImportModuleProcedureNameTableEntry + { + /// + /// String Length. + /// + /// + /// This defines the length of the string in bytes. The length of each + /// ascii name string is limited to 127 characters. + /// + /// The high bit in the LEN field (bit 7) is defined as an Overload bit. + /// This bit signifies that additional information is contained in the + /// linear EXE module and will be used in the future for parameter type + /// checking. + /// + public byte Length; + + /// + /// ASCII String. + /// + /// + /// This is a variable length string with it's length defined in bytes by + /// the LEN field. The string is case sensitive and is not null terminated. + /// + public byte[] Name; + } +}