mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-15 13:25:05 +00:00
Add NE segment table
This commit is contained in:
@@ -48,4 +48,43 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
WINDOWS = 0x02,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SegmentTableEntryFlag : ushort
|
||||
{
|
||||
/// <summary>
|
||||
/// Segment-type field.
|
||||
/// </summary>
|
||||
TYPE_MASK = 0x0007,
|
||||
|
||||
/// <summary>
|
||||
/// Code-segment type.
|
||||
/// </summary>
|
||||
CODE = 0x0000,
|
||||
|
||||
/// <summary>
|
||||
/// Data-segment type.
|
||||
/// </summary>
|
||||
DATA = 0x0001,
|
||||
|
||||
/// <summary>
|
||||
/// Segment is not fixed.
|
||||
/// </summary>
|
||||
MOVEABLE = 0x0010,
|
||||
|
||||
/// <summary>
|
||||
/// Segment will be preloaded; read-only if this is a data segment.
|
||||
/// </summary>
|
||||
PRELOAD = 0x0040,
|
||||
|
||||
/// <summary>
|
||||
/// Set if segment has relocation records.
|
||||
/// </summary>
|
||||
RELOCINFO = 0x0100,
|
||||
|
||||
/// <summary>
|
||||
/// Discard priority.
|
||||
/// </summary>
|
||||
DISCARD = 0xF000,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,11 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
/// </summary>
|
||||
public ExecutableHeader Header { get; set; }
|
||||
|
||||
// TODO: Segment Table
|
||||
/// <summary>
|
||||
/// Segment table
|
||||
/// </summary>
|
||||
public SegmentTableEntry[] SegmentTable { get; set; }
|
||||
|
||||
// TODO: Resource Table
|
||||
// TODO: Resident-Name Table
|
||||
// TODO: Module-Reference Table
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
|
||||
38
BurnOutSharp.Models/NewExecutable/SegmentTableEntry.cs
Normal file
38
BurnOutSharp.Models/NewExecutable/SegmentTableEntry.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The segment table contains an entry for each segment in the executable
|
||||
/// file. The number of segment table entries are defined in the segmented
|
||||
/// EXE header. The first entry in the segment table is segment number 1.
|
||||
/// The following is the structure of a segment table entry.
|
||||
/// </summary>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class SegmentTableEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Logical-sector offset (n byte) to the contents of the segment
|
||||
/// data, relative to the beginning of the file. Zero means no
|
||||
/// file data.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
|
||||
/// <summary>
|
||||
/// Length of the segment in the file, in bytes. Zero means 64K.
|
||||
/// </summary>
|
||||
public ushort Length;
|
||||
|
||||
/// <summary>
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
public SegmentTableEntryFlag FlagWord;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum allocation size of the segment, in bytes. Total size
|
||||
/// of the segment. Zero means 64K.
|
||||
/// </summary>
|
||||
public ushort MinimumAllocationSize;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user