mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-29 01:50:24 +00:00
Add NE entry table
This commit is contained in:
58
BurnOutSharp.Models/NewExecutable/EntryTableBundle.cs
Normal file
58
BurnOutSharp.Models/NewExecutable/EntryTableBundle.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The entry table follows the imported-name table. This table contains
|
||||
/// bundles of entry-point definitions. Bundling is done to save space in
|
||||
/// the entry table. The entry table is accessed by an ordinal value.
|
||||
/// Ordinal number one is defined to index the first entry in the entry
|
||||
/// table. To find an entry point, the bundles are scanned searching for a
|
||||
/// specific entry point using an ordinal number. The ordinal number is
|
||||
/// adjusted as each bundle is checked. When the bundle that contains the
|
||||
/// entry point is found, the ordinal number is multiplied by the size of
|
||||
/// the bundle's entries to index the proper entry.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The linker forms bundles in the most dense manner it can, under the
|
||||
/// restriction that it cannot reorder entry points to improve bundling.
|
||||
/// The reason for this restriction is that other .EXE files may refer to
|
||||
/// entry points within this bundle by their ordinal number. The following
|
||||
/// describes the format of the entry table bundles.
|
||||
/// </remarks>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public class EntryTableBundle
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of entries in this bundle. All records in one bundle
|
||||
/// are either moveable or refer to the same fixed segment. A zero
|
||||
/// value in this field indicates the end of the entry table.
|
||||
/// </summary>
|
||||
public byte EntryCount;
|
||||
|
||||
/// <summary>
|
||||
/// Segment indicator for this bundle. This defines the type of
|
||||
/// entry table entry data within the bundle. There are three
|
||||
/// types of entries that are defined.
|
||||
/// - 000h = Unused entries. There is no entry data in an unused
|
||||
/// bundle. The next bundle follows this field. This is
|
||||
/// used by the linker to skip ordinal numbers.
|
||||
/// - 001h-0FEh = Segment number for fixed segment entries. A fixed
|
||||
/// segment entry is 3 bytes long.
|
||||
/// - 0FFH = Moveable segment entries. The entry data contains the
|
||||
/// segment number for the entry points. A moveable segment
|
||||
/// entry is 6 bytes long.
|
||||
/// </summary>
|
||||
public byte SegmentIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Fixed segment entry
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="MoveableSegmentEntry"/> is used.</remarks>
|
||||
public FixedSegmentEntry FixedSegmentEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Moveable segment entry
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="FixedSegmentEntry"/> is used.</remarks>
|
||||
public MoveableSegmentEntry MoveableSegmentEntry;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,26 @@
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
[Flags]
|
||||
public enum FixedSegmentEntryFlag : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Set if the entry is exported.
|
||||
/// </summary>
|
||||
Exported = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// Set if the entry uses a global (shared) data segments.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The first assembly-language instruction in the
|
||||
/// entry point prologue must be "MOV AX,data
|
||||
/// segment number". This may be set only for
|
||||
/// SINGLEDATA library modules.
|
||||
/// </remarks>
|
||||
Global = 0x02,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum HeaderFlag : ushort
|
||||
{
|
||||
@@ -112,6 +132,20 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MoveableSegmentEntryFlag : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Set if the entry is exported.
|
||||
/// </summary>
|
||||
Exported = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// Set if the entry uses a global (shared) data segments.
|
||||
/// </summary>
|
||||
Global = 0x02,
|
||||
}
|
||||
|
||||
public enum OperatingSystem : byte
|
||||
{
|
||||
OS2 = 0x01,
|
||||
|
||||
@@ -46,7 +46,10 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
/// </summary>
|
||||
public ImportedNameTableEntry[] ImportedNameTable { get; set; }
|
||||
|
||||
// TODO: Entry Table
|
||||
/// <summary>
|
||||
/// Entry table
|
||||
/// </summary>
|
||||
public EntryTableBundle[] EntryTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nonresident-Name table
|
||||
|
||||
25
BurnOutSharp.Models/NewExecutable/FixedSegmentEntry.cs
Normal file
25
BurnOutSharp.Models/NewExecutable/FixedSegmentEntry.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// Segment number for fixed segment entries. A fixed
|
||||
/// segment entry is 3 bytes long and has the following
|
||||
/// format.
|
||||
/// </summary>
|
||||
/// <remarks>001h-0FEh</remarks>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class FixedSegmentEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
public FixedSegmentEntryFlag FlagWord;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within segment to entry point.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
}
|
||||
}
|
||||
35
BurnOutSharp.Models/NewExecutable/MoveableSegmentEntry.cs
Normal file
35
BurnOutSharp.Models/NewExecutable/MoveableSegmentEntry.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// Moveable segment entries. The entry data contains the
|
||||
/// segment number for the entry points. A moveable segment
|
||||
/// entry is 6 bytes long and has the following format.
|
||||
/// </summary>
|
||||
/// <remarks>0FFH</remarks>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class MoveableSegmentEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
public MoveableSegmentEntryFlag FlagWord;
|
||||
|
||||
/// <summary>
|
||||
/// INT 3FH.
|
||||
/// </summary>
|
||||
public ushort Reserved;
|
||||
|
||||
/// <summary>
|
||||
/// Segment number.
|
||||
/// </summary>
|
||||
public byte SegmentNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within segment to entry point.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user