Add simple NE tables

This commit is contained in:
Matt Nadareski
2022-11-04 09:40:29 -07:00
parent e33d6b3a0a
commit 4bdc5dc90f
5 changed files with 137 additions and 5 deletions

View File

@@ -26,12 +26,30 @@ namespace BurnOutSharp.Models.NewExecutable
/// </summary>
public SegmentTableEntry[] SegmentTable { get; set; }
// TODO: Resource Table
// TODO: Resident-Name Table
// TODO: Module-Reference Table
// TODO: Imported-Name Table
// TODO: NE Resource Table
/// <summary>
/// Resident-Name table
/// </summary>
public ResidentNameTableEntry[] ResidentNameTable { get; set; }
/// <summary>
/// Module-Reference table
/// </summary>
public ModuleReferenceTableEntry[] ModuleReferenceTable { get; set; }
/// <summary>
/// Imported-Name table
/// </summary>
public ImportedNameTableEntry[] ImportedNameTable { get; set; }
// TODO: Entry Table
// TODO: Nonresident-Name Table
/// <summary>
/// Nonresident-Name table
/// </summary>
public NonResidentNameTableEntry[] NonResidentNameTable { get; set; }
// TODO: Per Segment Data
}
}

View File

@@ -0,0 +1,28 @@
using System.Runtime.InteropServices;
namespace BurnOutSharp.Models.NewExecutable
{
/// <summary>
/// The imported-name table follows the module-reference table. This table
/// contains the names of modules and procedures that are imported by the
/// executable file. Each entry is composed of a 1-byte field that
/// contains the length of the string, followed by any number of
/// characters. The strings are not null-terminated and are case
/// sensitive.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public class ImportedNameTableEntry
{
/// <summary>
/// Length of the name string that follows. A zero value indicates
/// the end of the name table.
/// </summary>
public byte Length;
/// <summary>
/// ASCII text of the name string.
/// </summary>
public byte[] NameString;
}
}

View File

@@ -0,0 +1,19 @@
using System.Runtime.InteropServices;
namespace BurnOutSharp.Models.NewExecutable
{
/// <summary>
/// The module-reference table follows the resident-name table. Each entry
/// contains an offset for the module-name string within the imported-
/// names table; each entry is 2 bytes long.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public class ModuleReferenceTableEntry
{
/// <summary>
/// Offset within Imported Names Table to referenced module name string.
/// </summary>
public ushort Offset;
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.InteropServices;
namespace BurnOutSharp.Models.NewExecutable
{
/// <summary>
/// The nonresident-name table follows the entry table, and contains a
/// module description and nonresident exported procedure name strings.
/// The first string in this table is a module description. These name
/// strings are case-sensitive and are not null-terminated. The name
/// strings follow the same format as those defined in the resident name
/// table.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public class NonResidentNameTableEntry
{
/// <summary>
/// Length of the name string that follows. A zero value indicates
/// the end of the name table.
/// </summary>
public byte Length;
/// <summary>
/// ASCII text of the name string.
/// </summary>
public byte[] NameString;
/// <summary>
/// Ordinal number (index into entry table). This value is ignored
/// for the module name.
/// </summary>
public ushort OrdinalNumber;
}
}

View File

@@ -0,0 +1,33 @@
using System.Runtime.InteropServices;
namespace BurnOutSharp.Models.NewExecutable
{
/// <summary>
/// The resident-name table follows the resource table, and contains this
/// module's name string and resident exported procedure name strings. The
/// first string in this table is this module's name. These name strings
/// are case-sensitive and are not null-terminated. The following
/// describes the format of the name strings:
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public class ResidentNameTableEntry
{
/// <summary>
/// Length of the name string that follows. A zero value indicates
/// the end of the name table.
/// </summary>
public byte Length;
/// <summary>
/// ASCII text of the name string.
/// </summary>
public byte[] NameString;
/// <summary>
/// Ordinal number (index into entry table). This value is ignored
/// for the module name.
/// </summary>
public ushort OrdinalNumber;
}
}