From 9e4836826df97a2b8a9c0c3db6eb7a6bec5d2303 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 22 Jul 2018 23:48:44 -0700 Subject: [PATCH] Fix "FileProtection" callback, add InnoSetup The InnoSetup placeholder here will eventually be a way to call to an external library to extract the contents of the installer, similar to how CAB files are handled right now. The code to o so need sto be converted before that can happen, so in the meantime, this adds Inno Steup itself as a "protection" since other protections could be hidden within. --- BurnOutSharp/ProtectionFind.cs | 39 ++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs index 2a310883..15daa9be 100644 --- a/BurnOutSharp/ProtectionFind.cs +++ b/BurnOutSharp/ProtectionFind.cs @@ -52,12 +52,12 @@ namespace BurnOutSharp /// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm) /// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm) /// - public static Dictionary Scan(string path, IProgress progress = null) + public static Dictionary Scan(string path, IProgress progress = null) { var protections = new Dictionary(); // Checkpoint - progress?.Report(new Progress(null, 0, null)); + progress?.Report(new FileProtection(null, 0, null)); // Create mappings for checking against var mappings = CreateFilenameProtectionMapping(); @@ -79,7 +79,7 @@ namespace BurnOutSharp protections[path] = protectionname; // Checkpoint - progress?.Report(new Progress(path, 1, protectionname)); + progress?.Report(new FileProtection(path, 1, protectionname)); } // If we have a directory else if (Directory.Exists(path)) @@ -127,7 +127,7 @@ namespace BurnOutSharp protections[file] = protectionname; // Checkpoint - progress?.Report(new Progress(file, i / files.Length, protectionname)); + progress?.Report(new FileProtection(file, i / files.Length, protectionname)); } } @@ -193,6 +193,13 @@ namespace BurnOutSharp + (char)0x00 + "I" + (char)0x00 + "O" + (char)0x00 + "N")) return "Impulse Reactor " + GetFileVersion(file); + // Inno Setup + if ((position = FileContent.IndexOf("Inno")) == 0x30) + { + // TOOO: Add Inno Setup extraction + return "Inno Setup " + GetInnoSetupVersion(file); + } + // JoWooD X-Prot if (FileContent.Contains(".ext ") && (position = FileContent.IndexOf("kernel32.dll" + (char)0x00 + (char)0x00 + (char)0x00 + "VirtualProtect")) > -1) @@ -738,6 +745,30 @@ namespace BurnOutSharp return new string(version); } + private static string GetInnoSetupVersion(string file) + { + BinaryReader br = new BinaryReader(new StreamReader(file).BaseStream); + br.BaseStream.Seek(0x30, SeekOrigin.Begin); + string signature = new String(br.ReadChars(12)); + + if (signature == "rDlPtS02" + (char)0x87 + "eVx") + return "1.2.10"; + else if (signature == "rDlPtS04" + (char)0x87 + "eVx") + return "4.0.0"; + else if (signature == "rDlPtS05" + (char)0x87 + "eVx") + return "4.0.3"; + else if (signature == "rDlPtS06" + (char)0x87 + "eVx") + return "4.0.10"; + else if (signature == "rDlPtS07" + (char)0x87 + "eVx") + return "4.1.6"; + else if (signature == "rDlPtS" + (char)0xcd + (char)0xe6 + (char)0xd7 + "{" + (char)0x0b + "*") + return "5.1.5"; + else if (signature == "nS5W7dT" + (char)0x83 + (char)0xaa + (char)0x1b + (char)0x0f + "j") + return "5.1.5"; + + return string.Empty; + } + private static string GetJoWooDXProt1Version(string file, int position) { char[] version = new char[5];