mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-08-02 05:59:24 +00:00
Make SourceArray private in NE
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.NE
|
||||
/// <summary>
|
||||
/// Source array that the executable was parsed from
|
||||
/// </summary>
|
||||
public byte[] SourceArray { get; } = null;
|
||||
private readonly byte[] _sourceArray = null;
|
||||
|
||||
/// <summary>
|
||||
/// Source stream that the executable was parsed from
|
||||
@@ -83,7 +83,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.NE
|
||||
return;
|
||||
|
||||
this.Initialized = Deserialize(fileContent, offset);
|
||||
this.SourceArray = fileContent;
|
||||
this._sourceArray = fileContent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -169,7 +169,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.NE
|
||||
return ReadArbitraryRangeFromSourceStream(rangeStart, length);
|
||||
|
||||
// If we have a source array, use that
|
||||
if (this.SourceArray != null)
|
||||
if (this._sourceArray != null)
|
||||
return ReadArbitraryRangeFromSourceArray(rangeStart, length);
|
||||
|
||||
// Otherwise, return null
|
||||
@@ -206,11 +206,11 @@ namespace BurnOutSharp.ExecutableType.Microsoft.NE
|
||||
private byte[] ReadArbitraryRangeFromSourceArray(int rangeStart, int length)
|
||||
{
|
||||
int startingIndex = (int)Math.Max(rangeStart, 0);
|
||||
int readLength = (int)Math.Min(length == -1 ? length = Int32.MaxValue : length, this.SourceArray.Length);
|
||||
int readLength = (int)Math.Min(length == -1 ? length = Int32.MaxValue : length, this._sourceArray.Length);
|
||||
|
||||
try
|
||||
{
|
||||
return this.SourceArray.ReadBytes(ref startingIndex, readLength);
|
||||
return this._sourceArray.ReadBytes(ref startingIndex, readLength);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace BurnOutSharp.PackerType
|
||||
|
||||
private static string GetOldVersion(string file, NewExecutable nex)
|
||||
{
|
||||
// TODO: Don't read entire file
|
||||
// TODO: Only 64 bytes at the end of the file is needed
|
||||
var data = nex.ReadArbitraryRange();
|
||||
if (data != null)
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace BurnOutSharp.PackerType
|
||||
if (stub == null)
|
||||
return null;
|
||||
|
||||
// TODO: Don't read entire file
|
||||
var data = nex.ReadArbitraryRange();
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
// TODO: Keep this around until it can be confirmed with NE checks as well
|
||||
// TODO: This _may_ actually over-match. See msvbvm50.exe for an example
|
||||
var neMatchSets = new List<ContentMatchSet>
|
||||
@@ -31,7 +36,7 @@ namespace BurnOutSharp.PackerType
|
||||
new ContentMatchSet(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, "Wise Installation Wizard Module"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(file, nex.SourceArray, neMatchSets, includeDebug);
|
||||
return MatchUtil.GetFirstMatch(file, data, neMatchSets, includeDebug);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -48,6 +48,11 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (stub == null)
|
||||
return null;
|
||||
|
||||
// TODO: Don't read entire file
|
||||
var data = nex.ReadArbitraryRange();
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
// TODO: Do something with these strings in the NE header(?)
|
||||
// - CDCOPS
|
||||
// - CDcops assembly-language DLL
|
||||
@@ -63,7 +68,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}, GetVersion, "CD-Cops"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(file, nex.SourceArray, neMatchSets, includeDebug);
|
||||
return MatchUtil.GetFirstMatch(file, data, neMatchSets, includeDebug);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user