diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 1a376e75..1def1a25 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -154,11 +154,6 @@ namespace BurnOutSharp.FileType if (!string.IsNullOrWhiteSpace(protection)) Utilities.AppendToDictionary(protections, file, protection); - // Inno Setup - protection = new InnoSetup().CheckContents(file, fileContent, scanner.IncludePosition); - if (!string.IsNullOrWhiteSpace(protection)) - Utilities.AppendToDictionary(protections, file, protection); - // INTENIUM Trial & Buy Protection protection = new Intenium().CheckContents(file, fileContent, scanner.IncludePosition); if (!string.IsNullOrWhiteSpace(protection)) @@ -271,6 +266,14 @@ namespace BurnOutSharp.FileType // If we're looking for archives too, run scans if (scanner.ScanArchives) { + // Inno Setup + if (file != null && !string.IsNullOrEmpty(new InnoSetup().CheckContents(file, fileContent, scanner.IncludePosition))) + { + var subProtections = new InnoSetup().Scan(scanner, null, file); + Utilities.PrependToKeys(subProtections, file); + Utilities.AppendToDictionary(protections, subProtections); + } + // Wise Installer if (file != null && !string.IsNullOrEmpty(new WiseInstaller().CheckContents(file, fileContent, scanner.IncludePosition))) { @@ -302,6 +305,11 @@ namespace BurnOutSharp.FileType if (!string.IsNullOrWhiteSpace(protection)) Utilities.AppendToDictionary(protections, file, protection); + // Inno Setup + protection = new InnoSetup().CheckContents(file, fileContent, scanner.IncludePosition); + if (!string.IsNullOrWhiteSpace(protection)) + Utilities.AppendToDictionary(protections, file, protection); + // NSIS protection = new NSIS().CheckContents(file, fileContent, scanner.IncludePosition); if (!string.IsNullOrWhiteSpace(protection)) diff --git a/BurnOutSharp/ProtectionType/InnoSetup.cs b/BurnOutSharp/ProtectionType/InnoSetup.cs index c225c7a5..2577baa6 100644 --- a/BurnOutSharp/ProtectionType/InnoSetup.cs +++ b/BurnOutSharp/ProtectionType/InnoSetup.cs @@ -1,12 +1,16 @@ using System; +using System.Collections.Generic; +using System.IO; using System.Linq; namespace BurnOutSharp.ProtectionType { - public class InnoSetup : IContentCheck + public class InnoSetup : IContentCheck, IScannable { - // TOOO: Add Inno Setup extraction - // https://github.com/dscharrer/InnoExtract + /// + public bool ShouldScan(byte[] magic) => true; + + /// /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { @@ -18,6 +22,26 @@ namespace BurnOutSharp.ProtectionType return null; } + /// + public Dictionary> Scan(Scanner scanner, string file) + { + if (!File.Exists(file)) + return null; + + using (var fs = File.OpenRead(file)) + { + return Scan(scanner, fs, file); + } + } + + // TOOO: Add Inno Setup extraction + // https://github.com/dscharrer/InnoExtract + /// + public Dictionary> Scan(Scanner scanner, Stream stream, string file) + { + return null; + } + private static string GetVersion(byte[] fileContent) { byte[] signature = new ArraySegment(fileContent, 0x30, 12).ToArray();