mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-05-21 07:36:29 +00:00
Add regions for easier code navigation
This commit is contained in:
@@ -30,6 +30,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Create a new executable to fill
|
// Create a new executable to fill
|
||||||
var executable = new Executable();
|
var executable = new Executable();
|
||||||
|
|
||||||
|
#region Executable Header
|
||||||
|
|
||||||
// Try to parse the executable header
|
// Try to parse the executable header
|
||||||
var executableHeader = ParseExecutableHeader(data, offset);
|
var executableHeader = ParseExecutableHeader(data, offset);
|
||||||
if (executableHeader == null)
|
if (executableHeader == null)
|
||||||
@@ -38,6 +40,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the executable header
|
// Set the executable header
|
||||||
executable.Header = executableHeader;
|
executable.Header = executableHeader;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Relocation Table
|
||||||
|
|
||||||
// If the offset for the relocation table doesn't exist
|
// If the offset for the relocation table doesn't exist
|
||||||
int tableAddress = initialOffset + executableHeader.RelocationTableAddr;
|
int tableAddress = initialOffset + executableHeader.RelocationTableAddr;
|
||||||
if (tableAddress >= data.Length)
|
if (tableAddress >= data.Length)
|
||||||
@@ -51,6 +57,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the relocation table
|
// Set the relocation table
|
||||||
executable.RelocationTable = relocationTable;
|
executable.RelocationTable = relocationTable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// Return the executable
|
// Return the executable
|
||||||
return executable;
|
return executable;
|
||||||
}
|
}
|
||||||
@@ -165,6 +173,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Create a new executable to fill
|
// Create a new executable to fill
|
||||||
var executable = new Executable();
|
var executable = new Executable();
|
||||||
|
|
||||||
|
#region Executable Header
|
||||||
|
|
||||||
// Try to parse the executable header
|
// Try to parse the executable header
|
||||||
var executableHeader = ParseExecutableHeader(data);
|
var executableHeader = ParseExecutableHeader(data);
|
||||||
if (executableHeader == null)
|
if (executableHeader == null)
|
||||||
@@ -173,6 +183,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the executable header
|
// Set the executable header
|
||||||
executable.Header = executableHeader;
|
executable.Header = executableHeader;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Relocation Table
|
||||||
|
|
||||||
// If the offset for the relocation table doesn't exist
|
// If the offset for the relocation table doesn't exist
|
||||||
int tableAddress = initialOffset + executableHeader.RelocationTableAddr;
|
int tableAddress = initialOffset + executableHeader.RelocationTableAddr;
|
||||||
if (tableAddress >= data.Length)
|
if (tableAddress >= data.Length)
|
||||||
@@ -187,6 +201,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the relocation table
|
// Set the relocation table
|
||||||
executable.RelocationTable = relocationTable;
|
executable.RelocationTable = relocationTable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// Return the executable
|
// Return the executable
|
||||||
return executable;
|
return executable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Create a new executable to fill
|
// Create a new executable to fill
|
||||||
var executable = new Executable();
|
var executable = new Executable();
|
||||||
|
|
||||||
|
#region MS-DOS Stub
|
||||||
|
|
||||||
// Parse the MS-DOS stub
|
// Parse the MS-DOS stub
|
||||||
var stub = MSDOS.ParseExecutable(data, offset);
|
var stub = MSDOS.ParseExecutable(data, offset);
|
||||||
if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0)
|
if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0)
|
||||||
@@ -38,6 +40,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the MS-DOS stub
|
// Set the MS-DOS stub
|
||||||
executable.Stub = stub;
|
executable.Stub = stub;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Executable Header
|
||||||
|
|
||||||
// Try to parse the executable header
|
// Try to parse the executable header
|
||||||
var executableHeader = ParseExecutableHeader(data, offset);
|
var executableHeader = ParseExecutableHeader(data, offset);
|
||||||
if (executableHeader == null)
|
if (executableHeader == null)
|
||||||
@@ -46,6 +52,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the executable header
|
// Set the executable header
|
||||||
executable.Header = executableHeader;
|
executable.Header = executableHeader;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Segment Table
|
||||||
|
|
||||||
// If the offset for the segment table doesn't exist
|
// If the offset for the segment table doesn't exist
|
||||||
int tableAddress = initialOffset + executableHeader.SegmentTableOffset;
|
int tableAddress = initialOffset + executableHeader.SegmentTableOffset;
|
||||||
if (tableAddress >= data.Length)
|
if (tableAddress >= data.Length)
|
||||||
@@ -59,6 +69,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the segment table
|
// Set the segment table
|
||||||
executable.SegmentTable = relocationTable;
|
executable.SegmentTable = relocationTable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// TODO: Implement NE parsing
|
// TODO: Implement NE parsing
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -166,6 +178,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Create a new executable to fill
|
// Create a new executable to fill
|
||||||
var executable = new Executable();
|
var executable = new Executable();
|
||||||
|
|
||||||
|
#region MS-DOS Stub
|
||||||
|
|
||||||
// Parse the MS-DOS stub
|
// Parse the MS-DOS stub
|
||||||
var stub = MSDOS.ParseExecutable(data);
|
var stub = MSDOS.ParseExecutable(data);
|
||||||
if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0)
|
if (stub?.Header == null || stub.Header.NewExeHeaderAddr == 0)
|
||||||
@@ -174,6 +188,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the MS-DOS stub
|
// Set the MS-DOS stub
|
||||||
executable.Stub = stub;
|
executable.Stub = stub;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Executable Header
|
||||||
|
|
||||||
// Try to parse the executable header
|
// Try to parse the executable header
|
||||||
var executableHeader = ParseExecutableHeader(data);
|
var executableHeader = ParseExecutableHeader(data);
|
||||||
if (executableHeader == null)
|
if (executableHeader == null)
|
||||||
@@ -182,6 +200,10 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the executable header
|
// Set the executable header
|
||||||
executable.Header = executableHeader;
|
executable.Header = executableHeader;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Segment Table
|
||||||
|
|
||||||
// If the offset for the segment table doesn't exist
|
// If the offset for the segment table doesn't exist
|
||||||
int tableAddress = initialOffset + executableHeader.SegmentTableOffset;
|
int tableAddress = initialOffset + executableHeader.SegmentTableOffset;
|
||||||
if (tableAddress >= data.Length)
|
if (tableAddress >= data.Length)
|
||||||
@@ -196,6 +218,8 @@ namespace BurnOutSharp.Builder
|
|||||||
// Set the segment table
|
// Set the segment table
|
||||||
executable.SegmentTable = relocationTable;
|
executable.SegmentTable = relocationTable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
// TODO: Implement NE parsing
|
// TODO: Implement NE parsing
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user