Add notes to relevant places about entry point

This commit is contained in:
Matt Nadareski
2025-09-20 20:29:57 -04:00
parent 3ffbeddcbe
commit 9caa91736c
5 changed files with 52 additions and 39 deletions

View File

@@ -11,6 +11,8 @@ namespace BinaryObjectScanner.Packer
/// <inheritdoc/>
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// TODO: Investigate if this can be found by aligning to section containing entry point
// Get the last section strings, if they exist
var sections = exe.SectionTable ?? [];
var strs = exe.GetSectionStrings(sections.Length - 1);

View File

@@ -16,6 +16,8 @@ namespace BinaryObjectScanner.Protection
/// <inheritdoc/>
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// TODO: Investigate if this can be found by aligning to section containing entry point
// Get the 4th and 5th sections, if they exist (example names: ACE4/ACE5) (Found in Redump entries 94792, 94793)
var sections = exe.SectionTable ?? [];
for (int i = 3; i < sections.Length; i++)
@@ -50,6 +52,8 @@ namespace BinaryObjectScanner.Protection
return match;
}
// TODO: Investigate if this can be found by aligning to section containing entry point
// Get the second to last section
if (sections.Length > 1)
{
@@ -63,6 +67,8 @@ namespace BinaryObjectScanner.Protection
}
}
// TODO: Investigate if this can be found by aligning to section containing entry point
// Get the last section (example names: ACE5, akxpxgcv, and piofinqb)
if (sections.Length > 0)
{

View File

@@ -148,6 +148,8 @@ namespace BinaryObjectScanner.Protection
if (v4Version != null)
return $"SecuROM {v4Version}";
// TODO: Investigate if this can be found by aligning to section containing entry point
// Get the sections 5+, if they exist (example names: .fmqyrx, .vcltz, .iywiak)
var sections = exe.SectionTable ?? [];
for (int i = 4; i < sections.Length; i++)

View File

@@ -12,36 +12,37 @@ namespace BinaryObjectScanner.Protection
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
string? name = exe.InternalName;
// Only works on stub generated from running the program yourself
// Only works on stub generated from running the program yourself
if (name.OptionalEquals("SmarteSECURE"))
return "SmartE";
var sections = exe.SectionTable ?? [];
if (sections.Length > 0)
{
// Get the last section data, if it exists
var lastSectionData = exe.GetSectionData(sections.Length - 1);
if (lastSectionData != null)
{
// All sections seen so far are the last sections, so this is "technically"
// the only known needed check so far. Others kept as backups if this fails
// on some future entry
var matchers = GenerateMatchers();
var match = MatchUtil.GetFirstMatch(file, lastSectionData, matchers, includeDebug);
if (!string.IsNullOrEmpty(match))
return match;
}
}
// Specific known named sections:
// .bss (Rise of Nations)
// .tls (Zoo Tycoon 2)
// .idata (http://redump.org/disc/58561/ and http://redump.org/disc/71983/)
// .edata (http://redump.org/disc/36619/)
return null;
// TODO: Investigate if this can be found by aligning to section containing entry point
var sections = exe.SectionTable ?? [];
if (sections.Length > 0)
{
// Get the last section data, if it exists
var lastSectionData = exe.GetSectionData(sections.Length - 1);
if (lastSectionData != null)
{
// All sections seen so far are the last sections, so this is "technically"
// the only known needed check so far. Others kept as backups if this fails
// on some future entry
var matchers = GenerateMatchers();
var match = MatchUtil.GetFirstMatch(file, lastSectionData, matchers, includeDebug);
if (!string.IsNullOrEmpty(match))
return match;
}
}
// Specific known named sections:
// .bss (Rise of Nations)
// .tls (Zoo Tycoon 2)
// .idata (http://redump.org/disc/58561/ and http://redump.org/disc/71983/)
// .edata (http://redump.org/disc/36619/)
return null;
}
/// <inheritdoc/>
@@ -70,7 +71,7 @@ namespace BinaryObjectScanner.Protection
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
/// <summary>
/// Generate the set of matchers used for each section
/// </summary>
@@ -81,18 +82,18 @@ namespace BinaryObjectScanner.Protection
// Matches most games, but a few like http://redump.org/disc/16541/
// are only matched on the 00001/2.TMP files. PiD and other programs
// don't detect this game either, though (Aside from the stub)
new(new byte?[]
new(new byte?[]
{
0xEB, 0x15, 0x03, 0x00, 0x00, 0x00, null, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x55,
0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81, 0xED,
0x1D, 0x00, 0x00, 0x00, 0x8B, 0xC5, 0x55, 0x60,
0x9C, 0x2B, 0x85, 0x8F, 0x07, 0x00, 0x00, 0x89,
0x85, 0x83, 0x07, 0x00, 0x00, 0xFF, 0x74, 0x24,
0x2C, 0xE8, 0xBB, 0x01, 0x00, 0x00, 0x0F, 0x82,
0x2F, 0x06, 0x00, 0x00, 0xE8, 0x8E, 0x04, 0x00,
0x00, 0x49, 0x0F, 0x88, 0x23, 0x06
0xEB, 0x15, 0x03, 0x00, 0x00, 0x00, null, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x55,
0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81, 0xED,
0x1D, 0x00, 0x00, 0x00, 0x8B, 0xC5, 0x55, 0x60,
0x9C, 0x2B, 0x85, 0x8F, 0x07, 0x00, 0x00, 0x89,
0x85, 0x83, 0x07, 0x00, 0x00, 0xFF, 0x74, 0x24,
0x2C, 0xE8, 0xBB, 0x01, 0x00, 0x00, 0x0F, 0x82,
0x2F, 0x06, 0x00, 0x00, 0xE8, 0x8E, 0x04, 0x00,
0x00, 0x49, 0x0F, 0x88, 0x23, 0x06
}, "SmartE"),
];
}

View File

@@ -75,6 +75,8 @@ namespace BinaryObjectScanner.Protection
if (exe.FindResourceByNamedType("BIN, IDR_SGT").Count > 0)
return "SolidShield EXE Wrapper v1";
// TODO: Investigate if this can be found by aligning to section containing entry point
// Search the last two available sections
var sections = exe.SectionTable ?? [];
for (int i = Math.Max(sections.Length - 2, 0); i < sections.Length; i++)