diff --git a/BurnOutSharp.Builder/MSDOS.cs b/BurnOutSharp.Builder/MSDOS.cs index 66f8a8f9..c7aef902 100644 --- a/BurnOutSharp.Builder/MSDOS.cs +++ b/BurnOutSharp.Builder/MSDOS.cs @@ -30,6 +30,8 @@ namespace BurnOutSharp.Builder // Create a new executable to fill var executable = new Executable(); + #region Executable Header + // Try to parse the executable header var executableHeader = ParseExecutableHeader(data, offset); if (executableHeader == null) @@ -38,6 +40,10 @@ namespace BurnOutSharp.Builder // Set the executable header executable.Header = executableHeader; + #endregion + + #region Relocation Table + // If the offset for the relocation table doesn't exist int tableAddress = initialOffset + executableHeader.RelocationTableAddr; if (tableAddress >= data.Length) @@ -51,6 +57,8 @@ namespace BurnOutSharp.Builder // Set the relocation table executable.RelocationTable = relocationTable; + #endregion + // Return the executable return executable; } @@ -165,6 +173,8 @@ namespace BurnOutSharp.Builder // Create a new executable to fill var executable = new Executable(); + #region Executable Header + // Try to parse the executable header var executableHeader = ParseExecutableHeader(data); if (executableHeader == null) @@ -173,6 +183,10 @@ namespace BurnOutSharp.Builder // Set the executable header executable.Header = executableHeader; + #endregion + + #region Relocation Table + // If the offset for the relocation table doesn't exist int tableAddress = initialOffset + executableHeader.RelocationTableAddr; if (tableAddress >= data.Length) @@ -187,6 +201,8 @@ namespace BurnOutSharp.Builder // Set the relocation table executable.RelocationTable = relocationTable; + #endregion + // Return the executable return executable; } diff --git a/BurnOutSharp.Builder/NewExecutable.cs b/BurnOutSharp.Builder/NewExecutable.cs index 5bc42af7..0babe094 100644 --- a/BurnOutSharp.Builder/NewExecutable.cs +++ b/BurnOutSharp.Builder/NewExecutable.cs @@ -30,6 +30,8 @@ namespace BurnOutSharp.Builder // Create a new executable to fill var executable = new Executable(); + #region MS-DOS Stub + // Parse the MS-DOS stub var stub = MSDOS.ParseExecutable(data, offset); if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0) @@ -38,6 +40,10 @@ namespace BurnOutSharp.Builder // Set the MS-DOS stub executable.Stub = stub; + #endregion + + #region Executable Header + // Try to parse the executable header var executableHeader = ParseExecutableHeader(data, offset); if (executableHeader == null) @@ -46,6 +52,10 @@ namespace BurnOutSharp.Builder // Set the executable header executable.Header = executableHeader; + #endregion + + #region Segment Table + // If the offset for the segment table doesn't exist int tableAddress = initialOffset + executableHeader.SegmentTableOffset; if (tableAddress >= data.Length) @@ -59,6 +69,8 @@ namespace BurnOutSharp.Builder // Set the segment table executable.SegmentTable = relocationTable; + #endregion + // TODO: Implement NE parsing return null; } @@ -166,6 +178,8 @@ namespace BurnOutSharp.Builder // Create a new executable to fill var executable = new Executable(); + #region MS-DOS Stub + // Parse the MS-DOS stub var stub = MSDOS.ParseExecutable(data); if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0) @@ -174,6 +188,10 @@ namespace BurnOutSharp.Builder // Set the MS-DOS stub executable.Stub = stub; + #endregion + + #region Executable Header + // Try to parse the executable header var executableHeader = ParseExecutableHeader(data); if (executableHeader == null) @@ -182,6 +200,10 @@ namespace BurnOutSharp.Builder // Set the executable header executable.Header = executableHeader; + #endregion + + #region Segment Table + // If the offset for the segment table doesn't exist int tableAddress = initialOffset + executableHeader.SegmentTableOffset; if (tableAddress >= data.Length) @@ -196,6 +218,8 @@ namespace BurnOutSharp.Builder // Set the segment table executable.SegmentTable = relocationTable; + #endregion + // TODO: Implement NE parsing return null; }