mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-29 01:50:24 +00:00
Update NE entry table bundle
This commit is contained in:
@@ -305,6 +305,29 @@ namespace BurnOutSharp.Builder
|
||||
return (entry.ResourceID & 0x8000) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the segment entry type for an entry table bundle
|
||||
/// </summary>
|
||||
/// <param name="entry">Entry table bundle to check</param>
|
||||
/// <returns>SegmentEntryType corresponding to the type</returns>
|
||||
public static Models.NewExecutable.SegmentEntryType GetEntryType(this Models.NewExecutable.EntryTableBundle entry)
|
||||
{
|
||||
// We can't do anything with an invalid entry
|
||||
if (entry == null)
|
||||
return Models.NewExecutable.SegmentEntryType.Unused;
|
||||
|
||||
// Determine the entry type based on segment indicator
|
||||
if (entry.SegmentIndicator == 0x00)
|
||||
return Models.NewExecutable.SegmentEntryType.Unused;
|
||||
else if (entry.SegmentIndicator >= 0x01 && entry.SegmentIndicator <= 0xFE)
|
||||
return Models.NewExecutable.SegmentEntryType.FixedSegment;
|
||||
else if (entry.SegmentIndicator == 0xFF)
|
||||
return Models.NewExecutable.SegmentEntryType.MoveableSegment;
|
||||
|
||||
// We should never get here
|
||||
return Models.NewExecutable.SegmentEntryType.Unused;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -43,16 +43,42 @@
|
||||
/// </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;
|
||||
#region Fixed Segment Entry
|
||||
|
||||
/// <summary>
|
||||
/// Moveable segment entry
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
/// <remarks>Must be <c>NULL</c> if <see cref="FixedSegmentEntry"/> is used.</remarks>
|
||||
public MoveableSegmentEntry MoveableSegmentEntry;
|
||||
public FixedSegmentEntryFlag FixedFlagWord;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within segment to entry point.
|
||||
/// </summary>
|
||||
public ushort FixedOffset;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Moveable Segment Entry
|
||||
|
||||
/// <summary>
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
public MoveableSegmentEntryFlag MoveableFlagWord;
|
||||
|
||||
/// <summary>
|
||||
/// INT 3FH.
|
||||
/// </summary>
|
||||
public ushort MoveableReserved;
|
||||
|
||||
/// <summary>
|
||||
/// Segment number.
|
||||
/// </summary>
|
||||
public byte MoveableSegmentNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within segment to entry point.
|
||||
/// </summary>
|
||||
public ushort MoveableOffset;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +262,27 @@ namespace BurnOutSharp.Models.NewExecutable
|
||||
PRELOAD = 0x0040,
|
||||
}
|
||||
|
||||
public enum SegmentEntryType
|
||||
{
|
||||
/// <summary>
|
||||
/// 000h - 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.
|
||||
/// </summary>
|
||||
Unused,
|
||||
|
||||
/// <summary>
|
||||
/// 001h-0FEh - Segment number for fixed segment entries. A fixed segment
|
||||
/// entry is 3 bytes long.
|
||||
/// </summary>
|
||||
FixedSegment,
|
||||
|
||||
/// <summary>
|
||||
/// 0FFH - Moveable segment entries. The entry data contains the segment
|
||||
/// number for the entry points. A moveable segment entry is 6 bytes long.
|
||||
/// </summary>
|
||||
MoveableSegment,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SegmentTableEntryFlag : ushort
|
||||
{
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
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