From 96d6e8bd2f23377a54d2c8a6f1075406b6a23a3e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 7 Jul 2018 00:08:22 -0700 Subject: [PATCH] Bits and Bobs (#88) * Finally overhaul UI element naming * Re-enable disk scan button * Add cabfile scanning * Fix csproj * Fix TODO * Add a couple more protections, disable one for now * Fix SecuROM 7 detection Thanks antimatter for helping test * No beep for eject and speed check * Fix Options after renames * Ensure disc information in couple places again --- DICUI/App.config | 6 +- DICUI/DICUI.csproj | 12 ++ DICUI/External/ProtectionFind.cs | 58 +++++++- DICUI/MainWindow.xaml | 26 ++-- DICUI/MainWindow.xaml.cs | 204 +++++++++++++++-------------- DICUI/Options.cs | 12 +- DICUI/OptionsWindow.xaml | 24 ++-- DICUI/OptionsWindow.xaml.cs | 20 +-- DICUI/Utilities/DumpEnvironment.cs | 8 +- DICUI/mspack.dll | Bin 0 -> 174592 bytes DICUI/packages.config | 5 + 11 files changed, 224 insertions(+), 151 deletions(-) create mode 100644 DICUI/mspack.dll create mode 100644 DICUI/packages.config diff --git a/DICUI/App.config b/DICUI/App.config index df13d9d4..3140b2cf 100644 --- a/DICUI/App.config +++ b/DICUI/App.config @@ -1,9 +1,9 @@  - - - + + + diff --git a/DICUI/DICUI.csproj b/DICUI/DICUI.csproj index 4ef001e4..da38deb1 100644 --- a/DICUI/DICUI.csproj +++ b/DICUI/DICUI.csproj @@ -67,6 +67,12 @@ + + ..\packages\LessIO.0.5.0\lib\net40\LessIO.dll + + + ..\packages\libmspack4n.0.8.0\lib\net40\libmspackn.dll + @@ -130,6 +136,7 @@ + @@ -166,5 +173,10 @@ True + + + Always + + \ No newline at end of file diff --git a/DICUI/External/ProtectionFind.cs b/DICUI/External/ProtectionFind.cs index 7ce2e49a..9d490319 100644 --- a/DICUI/External/ProtectionFind.cs +++ b/DICUI/External/ProtectionFind.cs @@ -21,6 +21,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using LibMSPackN; namespace DICUI.External { @@ -88,7 +89,7 @@ namespace DICUI.External /// Scan an individual file for copy protection /// /// - /// TODO: Handle archives (zip, arc, cab[ms], cab[is]) + /// TODO: Handle archives (zip, arc, cab[is]) /// TODO: Find protection mentions in text files /// TODO: Might have to work on Streams instead to later support archives /// @@ -98,7 +99,10 @@ namespace DICUI.External #region EXE/DLL/ICD/DAT Content Checks - if (extension == "exe" || extension == "dll" || extension == "dat" || extension == "icd") + if (extension == "exe" || extension == "ex_" + || extension == "dll" || extension == "dl_" + || extension == "dat" + || extension == "icd") { try { @@ -205,7 +209,8 @@ namespace DICUI.External if ((position = FileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1) return "SecuROM " + GetSecuROM4and5Version(file, position); - if (FileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0)) + if (FileContent.Contains(".securom")) + //if (FileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0)) return "SecuROM " + GetSecuROM7Version(file); if (FileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit")) @@ -228,7 +233,7 @@ namespace DICUI.External string desc = FileVersionInfo.GetVersionInfo(file).FileDescription.ToLower(); if (!string.IsNullOrEmpty(version) && desc.Contains("solidshield")) return "SolidShield Core.dll " + version; - return "SolidShield EXE Wrapper"; + //return "SolidShield EXE Wrapper"; } } @@ -349,10 +354,44 @@ namespace DICUI.External #region Archive Content Checks - if (extension == "7z" || extension == "cab" || extension == "rar" || extension == "zip") + if (extension == "7z" || extension == "rar" || extension == "zip") { // No-op } + else if (extension == "cab") + { + string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); + Directory.CreateDirectory(tempPath); + + try + { + MSCabinet cabfile = new MSCabinet(file); + foreach (var sub in cabfile.GetFiles()) + { + string tempfile = Path.Combine(tempPath, sub.Filename); + sub.ExtractTo(tempfile); + string protection = ScanInFile(tempfile); + File.Delete(tempfile); + + if (!String.IsNullOrEmpty(protection)) + { + return protection; + } + } + } + catch + { + // We assume it's an InstallShield CAB and ignore + } + finally + { + try + { + Directory.Delete(tempPath, true); + } + catch { } + } + } #endregion @@ -1119,6 +1158,12 @@ namespace DICUI.External // CopyKiller mapping["Tom Commander"] = "CopyKiller"; + // Cucko (EA Custom) - TODO: Verify this doesn't over-match + mapping["EASTL"] = "Cucko (EA Custom)"; + + // dotFuscator - Not a protection + //mapping["DotfuscatorAttribute"] = "dotFuscator"; + // EXE Stealth mapping["??[[__[[_" + (char)0x00 + "{{" + (char)0x0 + (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0 @@ -1142,6 +1187,9 @@ namespace DICUI.External mapping["LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK" + (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"] = "LaserLock 5"; + // PE Compact 2 - Not a protection + //mapping["PEC2"] = "PE Compact 2"; + // Ring-Protech mapping[(char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00] = "Ring-Protech"; diff --git a/DICUI/MainWindow.xaml b/DICUI/MainWindow.xaml index 7e8008b0..dce06998 100644 --- a/DICUI/MainWindow.xaml +++ b/DICUI/MainWindow.xaml @@ -56,14 +56,14 @@