Add DOS stub passthrough for LE/NE/PE

This commit is contained in:
Matt Nadareski
2022-12-02 15:35:10 -08:00
parent f24004c949
commit 7c1edab6ca
3 changed files with 216 additions and 9 deletions

View File

@@ -6,6 +6,75 @@ namespace BurnOutSharp.Wrappers
{
#region Pass-Through Properties
#region MS-DOS Stub
#region Standard Fields
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Magic"/>
public byte[] Stub_Magic => _executable.Stub.Header.Magic;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.LastPageBytes"/>
public ushort Stub_LastPageBytes => _executable.Stub.Header.LastPageBytes;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Pages"/>
public ushort Stub_Pages => _executable.Stub.Header.Pages;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationItems"/>
public ushort Stub_RelocationItems => _executable.Stub.Header.RelocationItems;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.HeaderParagraphSize"/>
public ushort Stub_HeaderParagraphSize => _executable.Stub.Header.HeaderParagraphSize;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MinimumExtraParagraphs"/>
public ushort Stub_MinimumExtraParagraphs => _executable.Stub.Header.MinimumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MaximumExtraParagraphs"/>
public ushort Stub_MaximumExtraParagraphs => _executable.Stub.Header.MaximumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSSValue"/>
public ushort Stub_InitialSSValue => _executable.Stub.Header.InitialSSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSPValue"/>
public ushort Stub_Stub_InitialSPValue => _executable.Stub.Header.InitialSPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Checksum"/>
public ushort Stub_Checksum => _executable.Stub.Header.Checksum;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialIPValue"/>
public ushort Stub_InitialIPValue => _executable.Stub.Header.InitialIPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialCSValue"/>
public ushort Stub_InitialCSValue => _executable.Stub.Header.InitialCSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationTableAddr"/>
public ushort Stub_RelocationTableAddr => _executable.Stub.Header.RelocationTableAddr;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OverlayNumber"/>
public ushort Stub_OverlayNumber => _executable.Stub.Header.OverlayNumber;
#endregion
#region PE Extensions
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved1"/>
public ushort[] Stub_Reserved1 => _executable.Stub.Header.Reserved1;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMIdentifier"/>
public ushort Stub_OEMIdentifier => _executable.Stub.Header.OEMIdentifier;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMInformation"/>
public ushort Stub_OEMInformation => _executable.Stub.Header.OEMInformation;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved2"/>
public ushort[] Stub_Reserved2 => _executable.Stub.Header.Reserved2;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.NewExeHeaderAddr"/>
public uint Stub_NewExeHeaderAddr => _executable.Stub.Header.NewExeHeaderAddr;
#endregion
#endregion
// TODO: Determine what properties can be passed through
#endregion
@@ -21,7 +90,7 @@ namespace BurnOutSharp.Wrappers
/// <summary>
/// Internal representation of the executable
/// </summary>
private BurnOutSharp.Models.LinearExecutable.Executable _executable;
private Models.LinearExecutable.Executable _executable;
#endregion
@@ -38,7 +107,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>An LE/LX executable wrapper on success, null on failure</returns>
public static LinearExecutable Create(byte[] data, int offset)
{
var executable = BurnOutSharp.Builder.LinearExecutable.ParseExecutable(data, offset);
var executable = Builder.LinearExecutable.ParseExecutable(data, offset);
if (executable == null)
return null;
@@ -53,7 +122,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>An LE/LX executable wrapper on success, null on failure</returns>
public static LinearExecutable Create(Stream data)
{
var executable = BurnOutSharp.Builder.LinearExecutable.ParseExecutable(data);
var executable = Builder.LinearExecutable.ParseExecutable(data);
if (executable == null)
return null;

View File

@@ -6,6 +6,75 @@ namespace BurnOutSharp.Wrappers
{
#region Pass-Through Properties
#region MS-DOS Stub
#region Standard Fields
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Magic"/>
public byte[] Stub_Magic => _executable.Stub.Header.Magic;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.LastPageBytes"/>
public ushort Stub_LastPageBytes => _executable.Stub.Header.LastPageBytes;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Pages"/>
public ushort Stub_Pages => _executable.Stub.Header.Pages;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationItems"/>
public ushort Stub_RelocationItems => _executable.Stub.Header.RelocationItems;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.HeaderParagraphSize"/>
public ushort Stub_HeaderParagraphSize => _executable.Stub.Header.HeaderParagraphSize;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MinimumExtraParagraphs"/>
public ushort Stub_MinimumExtraParagraphs => _executable.Stub.Header.MinimumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MaximumExtraParagraphs"/>
public ushort Stub_MaximumExtraParagraphs => _executable.Stub.Header.MaximumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSSValue"/>
public ushort Stub_InitialSSValue => _executable.Stub.Header.InitialSSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSPValue"/>
public ushort Stub_Stub_InitialSPValue => _executable.Stub.Header.InitialSPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Checksum"/>
public ushort Stub_Checksum => _executable.Stub.Header.Checksum;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialIPValue"/>
public ushort Stub_InitialIPValue => _executable.Stub.Header.InitialIPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialCSValue"/>
public ushort Stub_InitialCSValue => _executable.Stub.Header.InitialCSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationTableAddr"/>
public ushort Stub_RelocationTableAddr => _executable.Stub.Header.RelocationTableAddr;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OverlayNumber"/>
public ushort Stub_OverlayNumber => _executable.Stub.Header.OverlayNumber;
#endregion
#region PE Extensions
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved1"/>
public ushort[] Stub_Reserved1 => _executable.Stub.Header.Reserved1;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMIdentifier"/>
public ushort Stub_OEMIdentifier => _executable.Stub.Header.OEMIdentifier;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMInformation"/>
public ushort Stub_OEMInformation => _executable.Stub.Header.OEMInformation;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved2"/>
public ushort[] Stub_Reserved2 => _executable.Stub.Header.Reserved2;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.NewExeHeaderAddr"/>
public uint Stub_NewExeHeaderAddr => _executable.Stub.Header.NewExeHeaderAddr;
#endregion
#endregion
// TODO: Determine what properties can be passed through
#endregion
@@ -21,7 +90,7 @@ namespace BurnOutSharp.Wrappers
/// <summary>
/// Internal representation of the executable
/// </summary>
private BurnOutSharp.Models.NewExecutable.Executable _executable;
private Models.NewExecutable.Executable _executable;
#endregion
@@ -38,7 +107,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>An NE executable wrapper on success, null on failure</returns>
public static NewExecutable Create(byte[] data, int offset)
{
var executable = BurnOutSharp.Builder.NewExecutable.ParseExecutable(data, offset);
var executable = Builder.NewExecutable.ParseExecutable(data, offset);
if (executable == null)
return null;
@@ -53,7 +122,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>An NE executable wrapper on success, null on failure</returns>
public static NewExecutable Create(Stream data)
{
var executable = BurnOutSharp.Builder.NewExecutable.ParseExecutable(data);
var executable = Builder.NewExecutable.ParseExecutable(data);
if (executable == null)
return null;

View File

@@ -6,6 +6,75 @@ namespace BurnOutSharp.Wrappers
{
#region Pass-Through Properties
#region MS-DOS Stub
#region Standard Fields
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Magic"/>
public byte[] Stub_Magic => _executable.Stub.Header.Magic;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.LastPageBytes"/>
public ushort Stub_LastPageBytes => _executable.Stub.Header.LastPageBytes;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Pages"/>
public ushort Stub_Pages => _executable.Stub.Header.Pages;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationItems"/>
public ushort Stub_RelocationItems => _executable.Stub.Header.RelocationItems;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.HeaderParagraphSize"/>
public ushort Stub_HeaderParagraphSize => _executable.Stub.Header.HeaderParagraphSize;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MinimumExtraParagraphs"/>
public ushort Stub_MinimumExtraParagraphs => _executable.Stub.Header.MinimumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.MaximumExtraParagraphs"/>
public ushort Stub_MaximumExtraParagraphs => _executable.Stub.Header.MaximumExtraParagraphs;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSSValue"/>
public ushort Stub_InitialSSValue => _executable.Stub.Header.InitialSSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialSPValue"/>
public ushort Stub_Stub_InitialSPValue => _executable.Stub.Header.InitialSPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Checksum"/>
public ushort Stub_Checksum => _executable.Stub.Header.Checksum;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialIPValue"/>
public ushort Stub_InitialIPValue => _executable.Stub.Header.InitialIPValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.InitialCSValue"/>
public ushort Stub_InitialCSValue => _executable.Stub.Header.InitialCSValue;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.RelocationTableAddr"/>
public ushort Stub_RelocationTableAddr => _executable.Stub.Header.RelocationTableAddr;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OverlayNumber"/>
public ushort Stub_OverlayNumber => _executable.Stub.Header.OverlayNumber;
#endregion
#region PE Extensions
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved1"/>
public ushort[] Stub_Reserved1 => _executable.Stub.Header.Reserved1;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMIdentifier"/>
public ushort Stub_OEMIdentifier => _executable.Stub.Header.OEMIdentifier;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.OEMInformation"/>
public ushort Stub_OEMInformation => _executable.Stub.Header.OEMInformation;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.Reserved2"/>
public ushort[] Stub_Reserved2 => _executable.Stub.Header.Reserved2;
/// <inheritdoc cref="Models.MSDOS.ExecutableHeader.NewExeHeaderAddr"/>
public uint Stub_NewExeHeaderAddr => _executable.Stub.Header.NewExeHeaderAddr;
#endregion
#endregion
// TODO: Determine what properties can be passed through
#endregion
@@ -21,7 +90,7 @@ namespace BurnOutSharp.Wrappers
/// <summary>
/// Internal representation of the executable
/// </summary>
private BurnOutSharp.Models.PortableExecutable.Executable _executable;
private Models.PortableExecutable.Executable _executable;
#endregion
@@ -38,7 +107,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>A PE executable wrapper on success, null on failure</returns>
public static PortableExecutable Create(byte[] data, int offset)
{
var executable = BurnOutSharp.Builder.PortableExecutable.ParseExecutable(data, offset);
var executable = Builder.PortableExecutable.ParseExecutable(data, offset);
if (executable == null)
return null;
@@ -53,7 +122,7 @@ namespace BurnOutSharp.Wrappers
/// <returns>A PE executable wrapper on success, null on failure</returns>
public static PortableExecutable Create(Stream data)
{
var executable = BurnOutSharp.Builder.PortableExecutable.ParseExecutable(data);
var executable = Builder.PortableExecutable.ParseExecutable(data);
if (executable == null)
return null;