diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs
index 91a22a84..c990c392 100644
--- a/BurnOutSharp/PackerType/AdvancedInstaller.cs
+++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs
@@ -1,5 +1,5 @@
-using System;
-using System.IO;
+using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.PackerType
{
@@ -9,12 +9,20 @@ namespace BurnOutSharp.PackerType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- // Software\Caphyon\Advanced Installer
- byte?[] check = new byte?[] { 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E, 0x5C, 0x41, 0x64, 0x76, 0x61, 0x6E, 0x63, 0x65, 0x64, 0x20, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x65, 0x72 };
- if (fileContent.FirstPosition(check, out int position))
- return "Caphyon Advanced Installer" + (includePosition ? $" (Index {position})" : string.Empty);
+ var matchers = new List
+ {
+ // Software\Caphyon\Advanced Installer
+ new Matcher(new byte?[]
+ {
+ 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
+ 0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E,
+ 0x5C, 0x41, 0x64, 0x76, 0x61, 0x6E, 0x63, 0x65,
+ 0x64, 0x20, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C,
+ 0x6C, 0x65, 0x72
+ }, "Caphyon Advanced Installer"),
+ };
- return null;
+ return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs
index 8f4aa0da..94c2686d 100644
--- a/BurnOutSharp/PackerType/CExe.cs
+++ b/BurnOutSharp/PackerType/CExe.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.IO;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.PackerType
{
- // The official website for CExe also includes the source code (which does have to be retrieved by the Wayback Machine). http://www.scottlu.com/Content/CExe.html
+ // The official website for CExe also includes the source code (which does have to be retrieved by the Wayback Machine)
+ // http://www.scottlu.com/Content/CExe.html
public class CExe : IContentCheck, IScannable
{
///
@@ -12,14 +14,22 @@ namespace BurnOutSharp.PackerType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- // "%WoÁa6.’a6.’a6.’a6.’{6.’.).’f6.’‰).’`6.’Ù0.’`6.’"
- byte?[] check = new byte?[] { 0x25, 0x57, 0x6F, 0xC1, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x00, 0x92, 0x7B, 0x36, 0x01, 0x92, 0x03, 0x29, 0x12, 0x92, 0x66, 0x36, 0x01, 0x92, 0x89, 0x29, 0x0A, 0x92, 0x60, 0x36, 0x01, 0x92, 0xD9, 0x30, 0x07, 0x92, 0x60, 0x36, 0x01, 0x92 };
- if (fileContent.FirstPosition(check, out int position, end: 200))
+ var matchers = new List
{
- return "CExe";
- }
+ // %Wo�a6.�a6.�a6.�a6.�{6.�.).�f6.��).�`6.��0.�`6.�
+ new Matcher(
+ new ContentMatch(new byte?[]
+ {
+ 0x25, 0x57, 0x6F, 0xC1, 0x61, 0x36, 0x01, 0x92,
+ 0x61, 0x36, 0x01, 0x92, 0x61, 0x36, 0x01, 0x92,
+ 0x61, 0x36, 0x00, 0x92, 0x7B, 0x36, 0x01, 0x92,
+ 0x03, 0x29, 0x12, 0x92, 0x66, 0x36, 0x01, 0x92,
+ 0x89, 0x29, 0x0A, 0x92, 0x60, 0x36, 0x01, 0x92,
+ 0xD9, 0x30, 0x07, 0x92, 0x60, 0x36, 0x01, 0x92
+ }, end: 200), "CExe"),
+ };
- return null;
+ return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs
index 03eaa559..5317a45b 100644
--- a/BurnOutSharp/PackerType/SetupFactory.cs
+++ b/BurnOutSharp/PackerType/SetupFactory.cs
@@ -12,10 +12,6 @@ namespace BurnOutSharp.PackerType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- // Longer version of the check that can be used if false positves become an issue:
- // S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n
- // byte?[] check = new byte?[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00, 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E };
-
var matchers = new List
{
// S.e.t.u.p. .F.a.c.t.o.r.y.
@@ -26,6 +22,26 @@ namespace BurnOutSharp.PackerType
0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00,
0x79, 0x00
}, GetVersion, "Setup Factory"),
+
+ // Longer version of the check that can be used if false positves become an issue:
+ // S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n.
+ // new Matcher(new byte?[]
+ // {
+ // 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00,
+ // 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00,
+ // 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00,
+ // 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00,
+ // 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00,
+ // 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00,
+ // 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00,
+ // 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00,
+ // 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00,
+ // 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00,
+ // 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00,
+ // 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00,
+ // 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00,
+ // 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00
+ // }, GetVersion, "Setup Factory"),
};
return Utilities.GetFirstContentMatch(file, fileContent, matchers, includePosition);
@@ -44,7 +60,8 @@ namespace BurnOutSharp.PackerType
}
///
- // Add extraction, which is possible but the only tools available that can do this seem to be Universal Extractor 2 and InstallExplorer (https://totalcmd.net/plugring/InstallExplorer.html)
+ // TODO: Add extraction, which is possible but the only tools available that can
+ // do this seem to be Universal Extractor 2 and InstallExplorer (https://totalcmd.net/plugring/InstallExplorer.html)
public Dictionary> Scan(Scanner scanner, Stream stream, string file)
{
return null;