Skip to content

Commit 9caa917

Browse files
committed
Add notes to relevant places about entry point
1 parent 3ffbedd commit 9caa917

File tree

5 files changed

+52
-39
lines changed

5 files changed

+52
-39
lines changed

BinaryObjectScanner/Packer/Crunch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class Crunch : IExecutableCheck<PortableExecutable>
1111
/// <inheritdoc/>
1212
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1313
{
14+
// TODO: Investigate if this can be found by aligning to section containing entry point
15+
1416
// Get the last section strings, if they exist
1517
var sections = exe.SectionTable ?? [];
1618
var strs = exe.GetSectionStrings(sections.Length - 1);

BinaryObjectScanner/Protection/ProtectDISC.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class ProtectDISC : IExecutableCheck<PortableExecutable>, IPathCheck
1616
/// <inheritdoc/>
1717
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1818
{
19+
// TODO: Investigate if this can be found by aligning to section containing entry point
20+
1921
// Get the 4th and 5th sections, if they exist (example names: ACE4/ACE5) (Found in Redump entries 94792, 94793)
2022
var sections = exe.SectionTable ?? [];
2123
for (int i = 3; i < sections.Length; i++)
@@ -50,6 +52,8 @@ public class ProtectDISC : IExecutableCheck<PortableExecutable>, IPathCheck
5052
return match;
5153
}
5254

55+
// TODO: Investigate if this can be found by aligning to section containing entry point
56+
5357
// Get the second to last section
5458
if (sections.Length > 1)
5559
{
@@ -63,6 +67,8 @@ public class ProtectDISC : IExecutableCheck<PortableExecutable>, IPathCheck
6367
}
6468
}
6569

70+
// TODO: Investigate if this can be found by aligning to section containing entry point
71+
6672
// Get the last section (example names: ACE5, akxpxgcv, and piofinqb)
6773
if (sections.Length > 0)
6874
{

BinaryObjectScanner/Protection/SecuROM.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ public class SecuROM : IExecutableCheck<PortableExecutable>, IPathCheck
148148
if (v4Version != null)
149149
return $"SecuROM {v4Version}";
150150

151+
// TODO: Investigate if this can be found by aligning to section containing entry point
152+
151153
// Get the sections 5+, if they exist (example names: .fmqyrx, .vcltz, .iywiak)
152154
var sections = exe.SectionTable ?? [];
153155
for (int i = 4; i < sections.Length; i++)

BinaryObjectScanner/Protection/SmartE.cs

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,37 @@ public class SmartE : IPathCheck, IExecutableCheck<PortableExecutable>
1212
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1313
{
1414
string? name = exe.InternalName;
15-
16-
// Only works on stub generated from running the program yourself
15+
16+
// Only works on stub generated from running the program yourself
1717
if (name.OptionalEquals("SmarteSECURE"))
1818
return "SmartE";
19-
20-
var sections = exe.SectionTable ?? [];
2119

22-
if (sections.Length > 0)
23-
{
24-
// Get the last section data, if it exists
25-
var lastSectionData = exe.GetSectionData(sections.Length - 1);
26-
if (lastSectionData != null)
27-
{
28-
// All sections seen so far are the last sections, so this is "technically"
29-
// the only known needed check so far. Others kept as backups if this fails
30-
// on some future entry
31-
var matchers = GenerateMatchers();
32-
var match = MatchUtil.GetFirstMatch(file, lastSectionData, matchers, includeDebug);
33-
if (!string.IsNullOrEmpty(match))
34-
return match;
35-
}
36-
}
37-
38-
// Specific known named sections:
39-
// .bss (Rise of Nations)
40-
// .tls (Zoo Tycoon 2)
41-
// .idata (http://redump.org/disc/58561/ and http://redump.org/disc/71983/)
42-
// .edata (http://redump.org/disc/36619/)
43-
44-
return null;
20+
// TODO: Investigate if this can be found by aligning to section containing entry point
21+
22+
var sections = exe.SectionTable ?? [];
23+
if (sections.Length > 0)
24+
{
25+
// Get the last section data, if it exists
26+
var lastSectionData = exe.GetSectionData(sections.Length - 1);
27+
if (lastSectionData != null)
28+
{
29+
// All sections seen so far are the last sections, so this is "technically"
30+
// the only known needed check so far. Others kept as backups if this fails
31+
// on some future entry
32+
var matchers = GenerateMatchers();
33+
var match = MatchUtil.GetFirstMatch(file, lastSectionData, matchers, includeDebug);
34+
if (!string.IsNullOrEmpty(match))
35+
return match;
36+
}
37+
}
38+
39+
// Specific known named sections:
40+
// .bss (Rise of Nations)
41+
// .tls (Zoo Tycoon 2)
42+
// .idata (http://redump.org/disc/58561/ and http://redump.org/disc/71983/)
43+
// .edata (http://redump.org/disc/36619/)
44+
45+
return null;
4546
}
4647

4748
/// <inheritdoc/>
@@ -70,7 +71,7 @@ public List<string> CheckDirectoryPath(string path, List<string>? files)
7071

7172
return MatchUtil.GetFirstMatch(path, matchers, any: true);
7273
}
73-
74+
7475
/// <summary>
7576
/// Generate the set of matchers used for each section
7677
/// </summary>
@@ -81,18 +82,18 @@ private static List<ContentMatchSet> GenerateMatchers()
8182
// Matches most games, but a few like http://redump.org/disc/16541/
8283
// are only matched on the 00001/2.TMP files. PiD and other programs
8384
// don't detect this game either, though (Aside from the stub)
84-
new(new byte?[]
85+
new(new byte?[]
8586
{
86-
0xEB, 0x15, 0x03, 0x00, 0x00, 0x00, null, 0x00,
87-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88-
0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x55,
89-
0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81, 0xED,
90-
0x1D, 0x00, 0x00, 0x00, 0x8B, 0xC5, 0x55, 0x60,
91-
0x9C, 0x2B, 0x85, 0x8F, 0x07, 0x00, 0x00, 0x89,
92-
0x85, 0x83, 0x07, 0x00, 0x00, 0xFF, 0x74, 0x24,
93-
0x2C, 0xE8, 0xBB, 0x01, 0x00, 0x00, 0x0F, 0x82,
94-
0x2F, 0x06, 0x00, 0x00, 0xE8, 0x8E, 0x04, 0x00,
95-
0x00, 0x49, 0x0F, 0x88, 0x23, 0x06
87+
0xEB, 0x15, 0x03, 0x00, 0x00, 0x00, null, 0x00,
88+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89+
0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x55,
90+
0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81, 0xED,
91+
0x1D, 0x00, 0x00, 0x00, 0x8B, 0xC5, 0x55, 0x60,
92+
0x9C, 0x2B, 0x85, 0x8F, 0x07, 0x00, 0x00, 0x89,
93+
0x85, 0x83, 0x07, 0x00, 0x00, 0xFF, 0x74, 0x24,
94+
0x2C, 0xE8, 0xBB, 0x01, 0x00, 0x00, 0x0F, 0x82,
95+
0x2F, 0x06, 0x00, 0x00, 0xE8, 0x8E, 0x04, 0x00,
96+
0x00, 0x49, 0x0F, 0x88, 0x23, 0x06
9697
}, "SmartE"),
9798
];
9899
}

BinaryObjectScanner/Protection/SolidShield.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class SolidShield : IExecutableCheck<PortableExecutable>, IPathCheck
7575
if (exe.FindResourceByNamedType("BIN, IDR_SGT").Count > 0)
7676
return "SolidShield EXE Wrapper v1";
7777

78+
// TODO: Investigate if this can be found by aligning to section containing entry point
79+
7880
// Search the last two available sections
7981
var sections = exe.SectionTable ?? [];
8082
for (int i = Math.Max(sections.Length - 2, 0); i < sections.Length; i++)

0 commit comments

Comments
 (0)