diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index d2fd86dd..8d1e5941 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -10,26 +10,8 @@ using BurnOutSharp.Wrappers; namespace BurnOutSharp.ProtectionType { - /// - /// CactusDataShield was a copy protection originally developed by Midbar Technologies, which was then purchased by Macrovision in 2002 (https://variety.com/2002/digital/news/macrovision-acquires-midbar-cuts-ttr-link-1117875824/). - /// Macrovision's product page for CDS: https://web.archive.org/web/20050215235405/http://www.macrovision.com/products/cds/index.shtml - /// CDS-100 appears to function by attempting to prevent dumping/ripping the discs protected with it. - /// CDS-200+ uses a dedicated audio player to play the music "legitimately". - /// Patent relating to CDS-100: https://patents.google.com/patent/US6425098B1/ - /// Known CDS versions: - /// CDS-100 ("The Loveparade Compilation 2001" by various artists (Barcode 74321 86986 2) (Likely Discogs Release Code [r155963]) and "World Of Our Own" (Limited Edition) by Westlife (Barcode 7 43218 98572 0) (Discogs Release Code [r1357706])). - /// CDS-200 (PlayJ) (("Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427])) (Confirmed to be CDS-200 from https://www.cdrinfo.com/d7/content/cactus-data-shield-200?page=2). - /// CDS200.0.4 - 3.0 build 16a (Redump entry 95036) - /// CDS200.0.4 - 3.0 build 16c ("TMF Hitzone 20" by various artists (Barcode 7 31458 37062 8)). - /// CDS200.0.4 - 4.1 build 2a ("Ich Habe Einen Traum" by Uwe Busse (Barcode 9 002723 251203)). - /// CDS200.0.4 - 4.1 build 2e ("Hallucinations" by David Usher (Barcode 7 24359 30322 2)). - /// CDS200.5.11.90 - 5.10.090 ("Finn 5 Fel!" by Gyllene Tider (Barcode 7 24357 10922 2)). - /// CDS-300 - /// Further information: - /// https://www.cdrinfo.com/d7/content/cactus-data-shield-200 - /// https://www.cdmediaworld.com/hardware/cdrom/cd_protections_cactus_data_shield.shtml - /// - public class CactusDataShield : IContentCheck, IPathCheck, IPortableExecutableCheck + + public class CactusDataShield : IContentCheck, IPathCheck { /// public string CheckContents(string file, byte[] fileContent, bool includeDebug) @@ -54,34 +36,6 @@ namespace BurnOutSharp.ProtectionType return null; } - /// - public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) - { - // Get the sections from the executable, if possible - var sections = pex?.SectionTable; - if (sections == null) - return null; - - // Get the .data/DATA section strings, if they exist - List strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA"); - if (strs != null) - { - if (strs.Any(s => s.Contains("\\*.CDS"))) - return "Cactus Data Shield 200"; - - if (strs.Any(s => s.Contains("DATA.CDS"))) - return "Cactus Data Shield 200"; - } - - // Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]). - // Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable. - var resources = pex.FindGenericResource("CactusPJ"); - if (resources.Any()) - return "PlayJ Music Player (Cactus Data Shield 200)"; - - return null; - } - /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { diff --git a/BurnOutSharp/ProtectionType/Macrovision.CactusDataShield.cs b/BurnOutSharp/ProtectionType/Macrovision.CactusDataShield.cs index 0d96045d..88c85c10 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.CactusDataShield.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; -using BurnOutSharp.Interfaces; -using BurnOutSharp.Matching; -using BurnOutSharp.Tools; +using System.Linq; using BurnOutSharp.Wrappers; namespace BurnOutSharp.ProtectionType @@ -30,6 +26,32 @@ namespace BurnOutSharp.ProtectionType /// public partial class Macrovision { - // TODO: Port existing CactusDataShield checks here. + /// + internal string CactusDataShieldCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) + { + // Get the sections from the executable, if possible + var sections = pex?.SectionTable; + if (sections == null) + return null; + + // Get the .data/DATA section strings, if they exist + List strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA"); + if (strs != null) + { + if (strs.Any(s => s.Contains("\\*.CDS"))) + return "Cactus Data Shield 200"; + + if (strs.Any(s => s.Contains("DATA.CDS"))) + return "Cactus Data Shield 200"; + } + + // Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]). + // Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable. + var resources = pex.FindGenericResource("CactusPJ"); + if (resources.Any()) + return "PlayJ Music Player (Cactus Data Shield 200)"; + + return null; + } } } diff --git a/BurnOutSharp/ProtectionType/Macrovision.cs b/BurnOutSharp/ProtectionType/Macrovision.cs index f1fcae54..80f838cb 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -69,6 +68,11 @@ namespace BurnOutSharp.ProtectionType resultsList.Add(match); } + // Run Cactus Data Shield PE checks + match = CactusDataShieldCheckPortableExecutable(file, pex, includeDebug); + if (!string.IsNullOrWhiteSpace(match)) + resultsList.Add(match); + // Run C-Dilla PE checks match = CDillaCheckPortableExecutable(file, pex, includeDebug); if (!string.IsNullOrWhiteSpace(match)) @@ -100,16 +104,13 @@ namespace BurnOutSharp.ProtectionType /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { - // TODO: Add all common Macrovision directory path checks here - - var matchers = new List - { - // Present in SafeDisc and CDS-300. - new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Macrovision Protection File"), - }; - ConcurrentQueue results = new ConcurrentQueue(); + // Run Macrovision file checks + var macrovision = CDillaCheckDirectoryPath(path, files); + if (macrovision != null && !macrovision.IsEmpty) + results.AddRange(macrovision); + // Run C-Dilla directory checks var cDilla = CDillaCheckDirectoryPath(path, files); if (cDilla != null && !cDilla.IsEmpty) @@ -128,7 +129,7 @@ namespace BurnOutSharp.ProtectionType if (results != null && results.Count > 0) return results; - return MatchUtil.GetAllMatches(files, matchers, any: false); + return null; } /// @@ -162,7 +163,18 @@ namespace BurnOutSharp.ProtectionType return null; } - /// + /// + internal ConcurrentQueue MacrovisionCheckDirectoryPath(string path, IEnumerable files) + { + var matchers = new List + { + new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, string.Empty), + }; + + return MatchUtil.GetAllMatches(files, matchers, any: false); + } + + /// internal string MacrovisionCheckFilePath(string path) { var matchers = new List