mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-15 13:25:05 +00:00
Add NE per segment data
This commit is contained in:
@@ -184,6 +184,65 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
Unknown = 0xF0,
|
||||
}
|
||||
|
||||
public enum OSFixupType : ushort
|
||||
{
|
||||
/// <summary>
|
||||
/// FIARQQ, FJARQQ
|
||||
/// </summary>
|
||||
FIARQQ = 0x0001,
|
||||
|
||||
/// <summary>
|
||||
/// FISRQQ, FJSRQQ
|
||||
/// </summary>
|
||||
FISRQQ = 0x0002,
|
||||
|
||||
/// <summary>
|
||||
/// FICRQQ, FJCRQQ
|
||||
/// </summary>
|
||||
FICRQQ = 0x0003,
|
||||
|
||||
FIERQQ = 0x0004,
|
||||
|
||||
FIDRQQ = 0x0005,
|
||||
|
||||
FIWRQQ = 0x0006,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum RelocationRecordFlag : byte
|
||||
{
|
||||
TARGET_MASK = 0x03,
|
||||
|
||||
INTERNALREF = 0x00,
|
||||
|
||||
IMPORTORDINAL = 0x01,
|
||||
|
||||
IMPORTNAME = 0x02,
|
||||
|
||||
OSFIXUP = 0x03,
|
||||
|
||||
ADDITIVE = 0x04,
|
||||
}
|
||||
|
||||
public enum RelocationRecordSourceType : byte
|
||||
{
|
||||
SOURCE_MASK = 0x0F,
|
||||
|
||||
LOBYTE = 0x00,
|
||||
|
||||
SEGMENT = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// 32-bit pointer
|
||||
/// </summary>
|
||||
FAR_ADDR = 0x03,
|
||||
|
||||
/// <summary>
|
||||
/// 16-bit offset
|
||||
/// </summary>
|
||||
OFFSET = 0x05,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ResourceTypeResourceFlag : ushort
|
||||
{
|
||||
|
||||
@@ -55,7 +55,5 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
/// Nonresident-Name table
|
||||
/// </summary>
|
||||
public NonResidentNameTableEntry[] NonResidentNameTable { get; set; }
|
||||
|
||||
// TODO: Per Segment Data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ImportNameRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Index into module reference table for the imported module.
|
||||
/// </summary>
|
||||
public ushort Index;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within Imported Names Table to procedure name string.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ImportOrdinalRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Index into module reference table for the imported module.
|
||||
/// </summary>
|
||||
public ushort Index;
|
||||
|
||||
/// <summary>
|
||||
/// Procedure ordinal number.
|
||||
/// </summary>
|
||||
public ushort Ordinal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class InternalRefRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Segment number for a fixed segment, or 0FFh for a
|
||||
/// movable segment.
|
||||
/// </summary>
|
||||
public byte SegmentNumber;
|
||||
|
||||
/// <summary>
|
||||
/// 0
|
||||
/// </summary>
|
||||
public byte Reserved;
|
||||
|
||||
/// <summary>
|
||||
/// Offset into segment if fixed segment, or ordinal
|
||||
/// number index into Entry Table if movable segment.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
}
|
||||
}
|
||||
20
BurnOutSharp.Models/NewExecutable/OSFixupRelocationRecord.cs
Normal file
20
BurnOutSharp.Models/NewExecutable/OSFixupRelocationRecord.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class OSFixupRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system fixup type.
|
||||
/// Floating-point fixups.
|
||||
/// </summary>
|
||||
public OSFixupType FixupType;
|
||||
|
||||
/// <summary>
|
||||
/// 0
|
||||
/// </summary>
|
||||
public ushort Reserved;
|
||||
}
|
||||
}
|
||||
23
BurnOutSharp.Models/NewExecutable/PerSegmentData.cs
Normal file
23
BurnOutSharp.Models/NewExecutable/PerSegmentData.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The location and size of the per-segment data is defined in the
|
||||
/// segment table entry for the segment. If the segment has relocation
|
||||
/// fixups, as defined in the segment table entry flags, they directly
|
||||
/// follow the segment data in the file. The relocation fixup information
|
||||
/// is defined as follows:
|
||||
/// </summary>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public class PerSegmentData
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of relocation records that follow.
|
||||
/// </summary>
|
||||
public ushort RelocationRecordCount;
|
||||
|
||||
/// <summary>
|
||||
/// A table of relocation records follows.
|
||||
/// </summary>
|
||||
public RelocationRecord[] RelocationRecords;
|
||||
}
|
||||
}
|
||||
60
BurnOutSharp.Models/NewExecutable/RelocationRecord.cs
Normal file
60
BurnOutSharp.Models/NewExecutable/RelocationRecord.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// A table of relocation records follows. The following is the format
|
||||
/// of each relocation record.
|
||||
/// </summary>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class RelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Source type.
|
||||
/// </summary>
|
||||
public RelocationRecordSourceType SourceType;
|
||||
|
||||
/// <summary>
|
||||
/// Flags byte.
|
||||
///
|
||||
/// The target value has four types that are defined in the flag
|
||||
/// byte field.
|
||||
/// </summary>
|
||||
public RelocationRecordFlag Flags;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within this segment of the source chain.
|
||||
/// If the ADDITIVE flag is set, then target value is added to
|
||||
/// the source contents, instead of replacing the source and
|
||||
/// following the chain. The source chain is an 0FFFFh
|
||||
/// terminated linked list within this segment of all
|
||||
/// references to the target.
|
||||
/// </summary>
|
||||
public ushort Offset;
|
||||
|
||||
/// <summary>
|
||||
/// INTERNALREF
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.INTERNALREF"/></remarks>
|
||||
public InternalRefRelocationRecord InternalRefRelocationRecord;
|
||||
|
||||
/// <summary>
|
||||
/// IMPORTNAME
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTNAME"/></remarks>
|
||||
public ImportNameRelocationRecord ImportNameRelocationRecord;
|
||||
|
||||
/// <summary>
|
||||
/// IMPORTORDINAL
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTORDINAL"/></remarks>
|
||||
public ImportOrdinalRelocationRecord ImportOrdinalRelocationRecord;
|
||||
|
||||
/// <summary>
|
||||
/// IMPORTORDINAL
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.OSFIXUP"/></remarks>
|
||||
public OSFixupRelocationRecord OSFixupRelocationRecord;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user