From 9c3201aa4b4dde5b4a7af35a9dae3c362810705d Mon Sep 17 00:00:00 2001 From: SilasLaspada Date: Thu, 1 Jul 2021 21:51:40 -0600 Subject: [PATCH] Improve XCP detection to prevent false positives (#42) * Improve XCP detection to prevent false positives * Address comments --- BurnOutSharp/FileType/Textfile.cs | 4 ++++ BurnOutSharp/ProtectionType/XCP.cs | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/BurnOutSharp/FileType/Textfile.cs b/BurnOutSharp/FileType/Textfile.cs index 906e269f..806402b9 100644 --- a/BurnOutSharp/FileType/Textfile.cs +++ b/BurnOutSharp/FileType/Textfile.cs @@ -80,6 +80,10 @@ namespace BurnOutSharp.FileType // MediaMax if (fileContent.Contains("MediaMax technology")) Utilities.AppendToDictionary(protections, file, "MediaMax CD-3"); + + // XCP + if (fileContent.Contains("http://cp.sonybmg.com/xcp/")) + Utilities.AppendToDictionary(protections, file, "XCP"); } catch { diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index eadfe4a7..15a2ac60 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -15,9 +15,12 @@ namespace BurnOutSharp.ProtectionType /// private static readonly List contentMatchers = new List { + + // Found in GO.EXE // XCP.DAT new ContentMatchSet(new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }, "XCP"), + // Found in GO.EXE // XCPPlugins.dll new ContentMatchSet(new byte?[] { @@ -25,12 +28,19 @@ namespace BurnOutSharp.ProtectionType 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }, "XCP"), + // Found in GO.EXE // XCPPhoenix.dll new ContentMatchSet(new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C }, "XCP"), + + // xcpdrive + new ContentMatchSet(new byte?[] + { + 0x78, 0x63, 0x70, 0x64, 0x72, 0x69, 0x76, 0x65 + }, "XCP"), }; /// @@ -44,8 +54,7 @@ namespace BurnOutSharp.ProtectionType { // TODO: Verify if these are OR or AND if (files.Any(f => Path.GetFileName(f).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase)) - || files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)) - || files.Any(f => Path.GetFileName(f).Equals("go.exe", StringComparison.OrdinalIgnoreCase))) // Path.Combine("contents", "go.exe") + || files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase))) { string versionDatPath = files.FirstOrDefault(f => Path.GetFileName(f).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrWhiteSpace(versionDatPath)) @@ -65,8 +74,7 @@ namespace BurnOutSharp.ProtectionType public string CheckFilePath(string path) { if (Path.GetFileName(path).Equals("XCP.DAT", StringComparison.OrdinalIgnoreCase) - || Path.GetFileName(path).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase) - || Path.GetFileName(path).Equals("go.exe", StringComparison.OrdinalIgnoreCase)) + || Path.GetFileName(path).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)) { return "XCP"; }