Add header padding data for searching

This commit is contained in:
Matt Nadareski
2022-12-05 15:56:37 -08:00
parent 2264fc0172
commit 24c77ecd07

View File

@@ -325,6 +325,33 @@ namespace BurnOutSharp.Wrappers
#region Extension Properties
/// <summary>
/// Header padding data, if it exists
/// </summary>
public byte[] HeaderPaddingData
{
get
{
lock (_sourceDataLock)
{
// If we already have cached data, just use that immediately
if (_headerPaddingData != null)
return _headerPaddingData;
// TODO: Don't scan the known header data as well
// Populate the raw header padding data based on the source
uint headerStartAddress = Stub_NewExeHeaderAddr;
uint firstSectionAddress = SectionTable.Select(s => s.PointerToRawData).Where(s => s != 0).OrderBy(s => s).First();
int headerLength = (int)(firstSectionAddress - headerStartAddress);
_headerPaddingData = ReadFromDataSource((int)headerStartAddress, headerLength);
// Cache and return the header padding data, even if null
return _headerPaddingData;
}
}
}
/// <summary>
/// Overlay data, if it exists
/// </summary>
@@ -606,6 +633,11 @@ namespace BurnOutSharp.Wrappers
/// </summary>
private Models.PortableExecutable.Executable _executable;
/// <summary>
/// Header padding data, if it exists
/// </summary>
private byte[] _headerPaddingData = null;
/// <summary>
/// Overlay data, if it exists
/// </summary>