diff --git a/BinaryObjectScanner/Packer/Crunch.cs b/BinaryObjectScanner/Packer/Crunch.cs index 31b15b9a..2f99f91d 100644 --- a/BinaryObjectScanner/Packer/Crunch.cs +++ b/BinaryObjectScanner/Packer/Crunch.cs @@ -11,6 +11,8 @@ namespace BinaryObjectScanner.Packer /// 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); diff --git a/BinaryObjectScanner/Protection/ProtectDISC.cs b/BinaryObjectScanner/Protection/ProtectDISC.cs index 9cfa3e99..02a0cd5c 100644 --- a/BinaryObjectScanner/Protection/ProtectDISC.cs +++ b/BinaryObjectScanner/Protection/ProtectDISC.cs @@ -16,6 +16,8 @@ namespace BinaryObjectScanner.Protection /// 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) { diff --git a/BinaryObjectScanner/Protection/SecuROM.cs b/BinaryObjectScanner/Protection/SecuROM.cs index 0da4e173..0ca6693a 100644 --- a/BinaryObjectScanner/Protection/SecuROM.cs +++ b/BinaryObjectScanner/Protection/SecuROM.cs @@ -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++) diff --git a/BinaryObjectScanner/Protection/SmartE.cs b/BinaryObjectScanner/Protection/SmartE.cs index c46b76be..5b6fd7c5 100644 --- a/BinaryObjectScanner/Protection/SmartE.cs +++ b/BinaryObjectScanner/Protection/SmartE.cs @@ -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; } /// @@ -70,7 +71,7 @@ namespace BinaryObjectScanner.Protection return MatchUtil.GetFirstMatch(path, matchers, any: true); } - + /// /// Generate the set of matchers used for each section /// @@ -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"), ]; } diff --git a/BinaryObjectScanner/Protection/SolidShield.cs b/BinaryObjectScanner/Protection/SolidShield.cs index 58edd3d5..4bacf76b 100644 --- a/BinaryObjectScanner/Protection/SolidShield.cs +++ b/BinaryObjectScanner/Protection/SolidShield.cs @@ -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++)