Improve XCP detection to prevent false positives (#42)

* Improve XCP detection to prevent false positives

* Address comments
This commit is contained in:
SilasLaspada
2021-07-01 21:51:40 -06:00
committed by GitHub
parent dfd1141635
commit 9c3201aa4b
2 changed files with 16 additions and 4 deletions

View File

@@ -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
{

View File

@@ -15,9 +15,12 @@ namespace BurnOutSharp.ProtectionType
/// </summary>
private static readonly List<ContentMatchSet> contentMatchers = new List<ContentMatchSet>
{
// 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"),
};
/// <inheritdoc/>
@@ -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";
}