mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-22 06:45:03 +00:00
Split printing into methods, add notes
This commit is contained in:
@@ -286,6 +286,8 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor
|
||||
/// </summary>
|
||||
@@ -333,11 +335,11 @@ namespace BurnOutSharp.Wrappers
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Printing
|
||||
|
||||
/// <summary>
|
||||
/// Pretty print the Linear Executable information
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public override void Print()
|
||||
{
|
||||
// TODO: Implement printing
|
||||
|
||||
@@ -90,6 +90,8 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor
|
||||
/// </summary>
|
||||
@@ -137,17 +139,26 @@ namespace BurnOutSharp.Wrappers
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Printing
|
||||
|
||||
/// <summary>
|
||||
/// Pretty print the MS-DOS executable information
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public override void Print()
|
||||
{
|
||||
Console.WriteLine("MS-DOS Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
|
||||
PrintHeader();
|
||||
PrintRelocationTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {BitConverter.ToString(_executable.Header.Magic).Replace("-", string.Empty)}");
|
||||
@@ -164,7 +175,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Initial CS value: {_executable.Header.InitialCSValue}");
|
||||
Console.WriteLine($" Relocation table address: {_executable.Header.RelocationTableAddr}");
|
||||
Console.WriteLine($" Overlay number: {_executable.Header.OverlayNumber}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print relocation table information
|
||||
/// </summary>
|
||||
private void PrintRelocationTable()
|
||||
{
|
||||
Console.WriteLine(" Relocation Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.RelocationItems == 0 || _executable.RelocationTable.Length == 0)
|
||||
|
||||
@@ -218,6 +218,8 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor
|
||||
/// </summary>
|
||||
@@ -264,23 +266,41 @@ namespace BurnOutSharp.Wrappers
|
||||
};
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Printing
|
||||
|
||||
/// <summary>
|
||||
/// Pretty print the New Executable information
|
||||
/// </summary>
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Print()
|
||||
{
|
||||
Console.WriteLine("New Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine(" MS-DOS Stub Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine();
|
||||
// Stub
|
||||
PrintStubHeader();
|
||||
PrintStubExtendedHeader();
|
||||
|
||||
Console.WriteLine(" Header Information:");
|
||||
// Header
|
||||
PrintHeader();
|
||||
|
||||
// Tables
|
||||
PrintSegmentTable();
|
||||
PrintResourceTable();
|
||||
PrintResidentNameTable();
|
||||
PrintModuleReferenceTable();
|
||||
PrintImportedNameTable();
|
||||
PrintEntryTable();
|
||||
PrintNonresidentNameTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub header information
|
||||
/// </summary>
|
||||
private void PrintStubHeader()
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {BitConverter.ToString(_executable.Stub.Header.Magic).Replace("-", string.Empty)}");
|
||||
Console.WriteLine($" Last page bytes: {_executable.Stub.Header.LastPageBytes}");
|
||||
@@ -297,8 +317,14 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Relocation table address: {_executable.Stub.Header.RelocationTableAddr}");
|
||||
Console.WriteLine($" Overlay number: {_executable.Stub.Header.OverlayNumber}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
Console.WriteLine(" Extended Header Information:");
|
||||
/// <summary>
|
||||
/// Print stub extended header information
|
||||
/// </summary>
|
||||
private void PrintStubExtendedHeader()
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", _executable.Stub.Header.Reserved1)}");
|
||||
Console.WriteLine($" OEM identifier: {_executable.Stub.Header.OEMIdentifier}");
|
||||
@@ -306,7 +332,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", _executable.Stub.Header.Reserved2)}");
|
||||
Console.WriteLine($" New EXE header address: {_executable.Stub.Header.NewExeHeaderAddr}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {BitConverter.ToString(_executable.Header.Magic).Replace("-", string.Empty)}");
|
||||
@@ -341,7 +373,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Windows SDK revision: {_executable.Header.WindowsSDKRevision}");
|
||||
Console.WriteLine($" Windows SDK version: {_executable.Header.WindowsSDKVersion}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print segment table information
|
||||
/// </summary>
|
||||
private void PrintSegmentTable()
|
||||
{
|
||||
Console.WriteLine(" Segment Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.FileSegmentCount == 0 || _executable.SegmentTable.Length == 0)
|
||||
@@ -361,7 +399,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resource table information
|
||||
/// </summary>
|
||||
private void PrintResourceTable()
|
||||
{
|
||||
Console.WriteLine(" Resource Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Alignment shift count: {_executable.ResourceTable.AlignmentShiftCount}");
|
||||
@@ -415,7 +459,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resident-name table information
|
||||
/// </summary>
|
||||
private void PrintResidentNameTable()
|
||||
{
|
||||
Console.WriteLine(" Resident-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.ResidentNameTableOffset == 0 || _executable.ResidentNameTable.Length == 0)
|
||||
@@ -434,7 +484,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print module-reference table information
|
||||
/// </summary>
|
||||
private void PrintModuleReferenceTable()
|
||||
{
|
||||
Console.WriteLine(" Module-Reference Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.ModuleReferenceTableSize == 0 || _executable.ModuleReferenceTable.Length == 0)
|
||||
@@ -452,7 +508,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print imported-name table information
|
||||
/// </summary>
|
||||
private void PrintImportedNameTable()
|
||||
{
|
||||
Console.WriteLine(" Imported-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.ImportedNamesTableOffset == 0 || _executable.ImportedNameTable.Count == 0)
|
||||
@@ -469,7 +531,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print entry table information
|
||||
/// </summary>
|
||||
private void PrintEntryTable()
|
||||
{
|
||||
Console.WriteLine(" Entry Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.EntryTableSize == 0 || _executable.EntryTable.Length == 0)
|
||||
@@ -500,7 +568,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print nonresident-name table information
|
||||
/// </summary>
|
||||
private void PrintNonresidentNameTable()
|
||||
{
|
||||
Console.WriteLine(" Nonresident-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.Header.NonResidentNameTableSize == 0 || _executable.NonResidentNameTable.Length == 0)
|
||||
@@ -520,7 +594,7 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace BurnOutSharp.Wrappers
|
||||
public uint OH_BaseOfCode => _executable.OptionalHeader.BaseOfCode;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.BaseOfData"/>
|
||||
public uint? OH_BaseOfData => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public uint? OH_BaseOfData => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? (uint?)_executable.OptionalHeader.BaseOfData
|
||||
: null;
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Windows-Specific Fields
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.ImageBase_PE32"/>
|
||||
public ulong OH_ImageBase => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public ulong OH_ImageBase => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? _executable.OptionalHeader.ImageBase_PE32
|
||||
: _executable.OptionalHeader.ImageBase_PE32Plus;
|
||||
|
||||
@@ -193,22 +193,22 @@ namespace BurnOutSharp.Wrappers
|
||||
public Models.PortableExecutable.DllCharacteristics OH_DllCharacteristics => _executable.OptionalHeader.DllCharacteristics;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.SizeOfStackReserve_PE32"/>
|
||||
public ulong OH_SizeOfStackReserve => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public ulong OH_SizeOfStackReserve => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? _executable.OptionalHeader.SizeOfStackReserve_PE32
|
||||
: _executable.OptionalHeader.SizeOfStackReserve_PE32Plus;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.SizeOfStackCommit_PE32"/>
|
||||
public ulong OH_SizeOfStackCommit => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public ulong OH_SizeOfStackCommit => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? _executable.OptionalHeader.SizeOfStackCommit_PE32
|
||||
: _executable.OptionalHeader.SizeOfStackCommit_PE32Plus;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.SizeOfHeapReserve_PE32"/>
|
||||
public ulong OH_SizeOfHeapReserve => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public ulong OH_SizeOfHeapReserve => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? _executable.OptionalHeader.SizeOfHeapReserve_PE32
|
||||
: _executable.OptionalHeader.SizeOfHeapReserve_PE32Plus;
|
||||
|
||||
/// <inheritdoc cref="Models.PortableExecutable.OptionalHeader.SizeOfHeapCommit_PE32"/>
|
||||
public ulong OH_SizeOfHeapCommit => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
public ulong OH_SizeOfHeapCommit => _executable.OptionalHeader.Magic == Models.PortableExecutable.OptionalHeaderMagicNumber.PE32
|
||||
? _executable.OptionalHeader.SizeOfHeapCommit_PE32
|
||||
: _executable.OptionalHeader.SizeOfHeapCommit_PE32Plus;
|
||||
|
||||
@@ -315,6 +315,25 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#region Extension Properties
|
||||
|
||||
/// <summary>
|
||||
/// Overlay data, if it exists
|
||||
/// </summary>
|
||||
public byte[] Overlay
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_overlayDataLock)
|
||||
{
|
||||
// Use the cached data if possible
|
||||
if (_overlayData != null)
|
||||
return _overlayData;
|
||||
|
||||
// TODO: Implement from https://www.autoitscript.com/forum/topic/153277-pe-file-overlay-extraction/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array of sanitized section names
|
||||
/// </summary>
|
||||
@@ -322,23 +341,26 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
get
|
||||
{
|
||||
// Use the cached data if possible
|
||||
if (_sectionNames != null)
|
||||
return _sectionNames;
|
||||
|
||||
// Otherwise, build and return the cached array
|
||||
_sectionNames = new string[_executable.SectionTable.Length];
|
||||
for (int i = 0; i < _sectionNames.Length; i++)
|
||||
lock (_sectionNamesLock)
|
||||
{
|
||||
var section = _executable.SectionTable[i];
|
||||
// Use the cached data if possible
|
||||
if (_sectionNames != null)
|
||||
return _sectionNames;
|
||||
|
||||
// TODO: Handle long section names with leading `/`
|
||||
byte[] sectionNameBytes = section.Name;
|
||||
string sectionNameString = Encoding.UTF8.GetString(sectionNameBytes).TrimEnd('\0');
|
||||
_sectionNames[i] = sectionNameString;
|
||||
// Otherwise, build and return the cached array
|
||||
_sectionNames = new string[_executable.SectionTable.Length];
|
||||
for (int i = 0; i < _sectionNames.Length; i++)
|
||||
{
|
||||
var section = _executable.SectionTable[i];
|
||||
|
||||
// TODO: Handle long section names with leading `/`
|
||||
byte[] sectionNameBytes = section.Name;
|
||||
string sectionNameString = Encoding.UTF8.GetString(sectionNameBytes).TrimEnd('\0');
|
||||
_sectionNames[i] = sectionNameString;
|
||||
}
|
||||
|
||||
return _sectionNames;
|
||||
}
|
||||
|
||||
return _sectionNames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,16 +375,16 @@ namespace BurnOutSharp.Wrappers
|
||||
/// </summary>
|
||||
private Models.PortableExecutable.Executable _executable;
|
||||
|
||||
/// <summary>
|
||||
/// Overlay data, if it exists
|
||||
/// </summary>
|
||||
private byte[] _overlayData = null;
|
||||
|
||||
/// <summary>
|
||||
/// Array of sanitized section names
|
||||
/// </summary>
|
||||
private string[] _sectionNames = null;
|
||||
|
||||
/// <summary>
|
||||
/// Lock object for concurrent modifications on <see cref="_rawSectionData"/>
|
||||
/// </summary>
|
||||
private readonly object _rawSectionsLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Cached raw section data
|
||||
/// </summary>
|
||||
@@ -370,6 +392,27 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Lock Objects
|
||||
|
||||
/// <summary>
|
||||
/// Lock object for concurrent modifications on <see cref="_overlayData"/>
|
||||
/// </summary>
|
||||
private readonly object _overlayDataLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Lock object for concurrent modifications on <see cref="_sectionNames"/>
|
||||
/// </summary>
|
||||
private readonly object _sectionNamesLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Lock object for concurrent modifications on <see cref="_rawSectionData"/>
|
||||
/// </summary>
|
||||
private readonly object _rawSectionsLock = new object();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Private constructor
|
||||
/// </summary>
|
||||
@@ -417,6 +460,14 @@ namespace BurnOutSharp.Wrappers
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: Write methods for manifest and version data
|
||||
// TODO: Cache both objects for easy access
|
||||
// TODO: Cache all resource objects, key has to be "path"
|
||||
// TODO: Cache all certificate objects
|
||||
// TODO: Cache all import/export tables
|
||||
|
||||
/// <summary>
|
||||
/// Get raw section data from the source file
|
||||
/// </summary>
|
||||
@@ -446,8 +497,10 @@ namespace BurnOutSharp.Wrappers
|
||||
uint sectionAddress = section.VirtualAddress.ConvertVirtualAddress(_executable.SectionTable);
|
||||
if (sectionAddress == 0)
|
||||
return null;
|
||||
|
||||
uint sectionSize = section.SizeOfRawData;
|
||||
|
||||
// TODO: Use section name and index to combat duplicates
|
||||
lock (_rawSectionsLock)
|
||||
{
|
||||
// If we already have cached data, just use that immediately
|
||||
@@ -465,20 +518,38 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#region Printing
|
||||
|
||||
/// <summary>
|
||||
/// Pretty print the New Executable information
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public override void Print()
|
||||
{
|
||||
Console.WriteLine("Portable Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine(" MS-DOS Stub Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine();
|
||||
// Stub
|
||||
PrintStubHeader();
|
||||
PrintStubExtendedHeader();
|
||||
|
||||
Console.WriteLine(" Header Information:");
|
||||
// Header
|
||||
PrintCOFFFileHeader();
|
||||
PrintOptionalHeader();
|
||||
|
||||
// Tables
|
||||
PrintSectionTable();
|
||||
PrintCOFFSymbolTable();
|
||||
PrintAttributeCertificateTable();
|
||||
PrintDelayLoadDirectoryTable();
|
||||
PrintDebugTable();
|
||||
PrintExportTable();
|
||||
PrintImportTable();
|
||||
PrintResourceDirectoryTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub header information
|
||||
/// </summary>
|
||||
private void PrintStubHeader()
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {BitConverter.ToString(_executable.Stub.Header.Magic).Replace("-", string.Empty)}");
|
||||
Console.WriteLine($" Last page bytes: {_executable.Stub.Header.LastPageBytes}");
|
||||
@@ -495,8 +566,14 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Relocation table address: {_executable.Stub.Header.RelocationTableAddr}");
|
||||
Console.WriteLine($" Overlay number: {_executable.Stub.Header.OverlayNumber}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
Console.WriteLine(" Extended Header Information:");
|
||||
/// <summary>
|
||||
/// Print stub extended header information
|
||||
/// </summary>
|
||||
private void PrintStubExtendedHeader()
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", _executable.Stub.Header.Reserved1)}");
|
||||
Console.WriteLine($" OEM identifier: {_executable.Stub.Header.OEMIdentifier}");
|
||||
@@ -504,7 +581,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", _executable.Stub.Header.Reserved2)}");
|
||||
Console.WriteLine($" New EXE header address: {_executable.Stub.Header.NewExeHeaderAddr}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print COFF file header information
|
||||
/// </summary>
|
||||
private void PrintCOFFFileHeader()
|
||||
{
|
||||
Console.WriteLine(" COFF File Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(_executable.Signature).Replace("-", string.Empty)}");
|
||||
@@ -516,7 +599,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Size of optional header: {_executable.COFFFileHeader.SizeOfOptionalHeader}");
|
||||
Console.WriteLine($" Characteristics: {_executable.COFFFileHeader.Characteristics}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print optional header information
|
||||
/// </summary>
|
||||
private void PrintOptionalHeader()
|
||||
{
|
||||
Console.WriteLine(" Optional Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.COFFFileHeader.SizeOfOptionalHeader == 0 || _executable.OptionalHeader == null)
|
||||
@@ -572,7 +661,7 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Size of heap commit: {_executable.OptionalHeader.SizeOfHeapCommit_PE32Plus}");
|
||||
Console.WriteLine($" Loader flags: {_executable.OptionalHeader.LoaderFlags}");
|
||||
Console.WriteLine($" Number of data-directory entries: {_executable.OptionalHeader.NumberOfRvaAndSizes}");
|
||||
|
||||
|
||||
if (_executable.OptionalHeader.ExportTable != null)
|
||||
{
|
||||
Console.WriteLine(" Export Table (1)");
|
||||
@@ -671,7 +760,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print section table information
|
||||
/// </summary>
|
||||
private void PrintSectionTable()
|
||||
{
|
||||
Console.WriteLine(" Section Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.COFFFileHeader.NumberOfSections == 0 || _executable.SectionTable.Length == 0)
|
||||
@@ -699,7 +794,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print COFF symbol table information
|
||||
/// </summary>
|
||||
private void PrintCOFFSymbolTable()
|
||||
{
|
||||
Console.WriteLine(" COFF Symbol Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.COFFFileHeader.PointerToSymbolTable == 0
|
||||
@@ -848,7 +949,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print attribute certificate table information
|
||||
/// </summary>
|
||||
private void PrintAttributeCertificateTable()
|
||||
{
|
||||
Console.WriteLine(" Attribute Certificate Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.CertificateTable == null
|
||||
@@ -897,7 +1004,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print delay-load directory table information
|
||||
/// </summary>
|
||||
private void PrintDelayLoadDirectoryTable()
|
||||
{
|
||||
Console.WriteLine(" Delay-Load Directory Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.DelayImportDescriptor == null
|
||||
@@ -918,7 +1031,13 @@ namespace BurnOutSharp.Wrappers
|
||||
Console.WriteLine($" Timestamp = {_executable.DelayLoadDirectoryTable.TimeStamp}");
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print debug table information
|
||||
/// </summary>
|
||||
private void PrintDebugTable()
|
||||
{
|
||||
Console.WriteLine(" Debug Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.Debug == null
|
||||
@@ -945,7 +1064,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print export table information
|
||||
/// </summary>
|
||||
private void PrintExportTable()
|
||||
{
|
||||
Console.WriteLine(" Export Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.ExportTable == null
|
||||
@@ -1041,7 +1166,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print import table information
|
||||
/// </summary>
|
||||
private void PrintImportTable()
|
||||
{
|
||||
Console.WriteLine(" Import Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.ImportTable == null
|
||||
@@ -1166,7 +1297,13 @@ namespace BurnOutSharp.Wrappers
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resource directory table information
|
||||
/// </summary>
|
||||
private void PrintResourceDirectoryTable()
|
||||
{
|
||||
Console.WriteLine(" Resource Directory Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
if (_executable.OptionalHeader?.ResourceTable == null
|
||||
@@ -1888,7 +2025,7 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user