Add and use FilePathMatch (fixes #262)

This commit is contained in:
Matt Nadareski
2023-08-26 22:51:55 -04:00
parent 3045c41eda
commit cfe889d5b3
12 changed files with 77 additions and 63 deletions

View File

@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -19,7 +18,7 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("bitpool.rsc", useEndsWith: true), "Bitpool"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}CD.IDX", useEndsWith: true), "Bitpool"),
new PathMatchSet(new FilePathMatch("CD.IDX"), "Bitpool"),
// Completely empty file present on multiple discs with Bitpool (Redump entries 52626 and 50229).
new PathMatchSet(new PathMatch("LEADOUT.OFS", useEndsWith: true), "Bitpool"),
@@ -28,10 +27,10 @@ namespace BinaryObjectScanner.Protection
// Both examples with only having the first letter uppercase and as the whole file name being uppercase have been seen.
new PathMatchSet(new List<PathMatch>
{
new PathMatch($"{Path.DirectorySeparatorChar}Crc_a", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}Crc_b", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}Crc_c", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}Crc_d", useEndsWith: true),
new FilePathMatch("Crc_a"),
new FilePathMatch("Crc_b"),
new FilePathMatch("Crc_c"),
new FilePathMatch("Crc_d"),
}, "Bitpool"),
};
@@ -44,7 +43,7 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("bitpool.rsc", useEndsWith: true), "Bitpool"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}CD.IDX", useEndsWith: true), "Bitpool"),
new PathMatchSet(new FilePathMatch("CD.IDX"), "Bitpool"),
// Completely empty file present on multiple discs with Bitpool (Redump entries 52626 and 50229).
new PathMatchSet(new PathMatch("LEADOUT.OFS", useEndsWith: true), "Bitpool"),

View File

@@ -117,8 +117,8 @@ namespace BinaryObjectScanner.Protection
new PathMatchSet($"LASERLOK{Path.DirectorySeparatorChar}", "LaserLok [Check disc for physical ring]"),
// TODO: Verify if these are OR or AND
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}NOMOUSE.SP", useEndsWith: true), GetVersion16Bit, "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}NOMOUSE.COM", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new FilePathMatch("NOMOUSE.SP"), GetVersion16Bit, "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new FilePathMatch("NOMOUSE.COM"), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("l16dll.dll", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("laserlok.in", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("laserlok.o10", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
@@ -135,10 +135,10 @@ namespace BinaryObjectScanner.Protection
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}NOMOUSE.SP", useEndsWith: true), GetVersion16Bit, "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new FilePathMatch("NOMOUSE.SP"), GetVersion16Bit, "LaserLok [Check disc for physical ring]"),
// TODO: Verify if these are OR or AND
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}NOMOUSE.COM", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new FilePathMatch("NOMOUSE.COM"), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("l16dll.dll", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("laserlok.in", useEndsWith: true), "LaserLok [Check disc for physical ring]"),
new PathMatchSet(new PathMatch("laserlok.o10", useEndsWith: true), "LaserLok [Check disc for physical ring]"),

View File

@@ -157,8 +157,8 @@ namespace BinaryObjectScanner.Protection
// Found in many versions of SafeDisc, beginning in 2.05.030 and being used all the way until the final version 4.90.010. It is not always present, even in versions it has been used in. Found in Redump entries 56319 and 72195.
new PathMatchSet(new PathMatch("00000002.TMP", useEndsWith: true), "SafeDisc 2+"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}DPLAYERX.DLL", useEndsWith: true), GetSafeDiscDPlayerXVersion, "SafeDisc"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}drvmgt.dll", useEndsWith: true), GetSafeDiscDrvmgtVersion, "SafeDisc"),
new PathMatchSet(new FilePathMatch("DPLAYERX.DLL"), GetSafeDiscDPlayerXVersion, "SafeDisc"),
new PathMatchSet(new FilePathMatch("drvmgt.dll"), GetSafeDiscDrvmgtVersion, "SafeDisc"),
// The SD0XXX.dll files appear to solely contain custom strings that allowed the publisher to customize the SafeDisc error messages. They are currently only known to be used by EA.
// Each file appears to contain strings for a specific language each.
@@ -231,8 +231,8 @@ namespace BinaryObjectScanner.Protection
// TODO: Research "splash16.bmp" and "splash256.bmp".
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}DPLAYERX.DLL", useEndsWith: true), GetSafeDiscDPlayerXVersion, "SafeDisc"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}drvmgt.dll", useEndsWith: true), GetSafeDiscDrvmgtVersion, "SafeDisc"),
new PathMatchSet(new FilePathMatch("DPLAYERX.DLL"), GetSafeDiscDPlayerXVersion, "SafeDisc"),
new PathMatchSet(new FilePathMatch("drvmgt.dll"), GetSafeDiscDrvmgtVersion, "SafeDisc"),
// The SD0XXX.dll files appear to solely contain custom strings that allowed the publisher to customize the SafeDisc error messages. They are currently only known to be used by EA.
// Each file appears to contain strings for a specific language each.

View File

@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -6,7 +7,6 @@ using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
using System;
namespace BinaryObjectScanner.Protection
{
@@ -252,7 +252,7 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, string.Empty),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}secdrv.sys", useEndsWith: true), GetSecdrvFileSizeVersion, "Macrovision Security Driver"),
new PathMatchSet(new FilePathMatch("secdrv.sys"), GetSecdrvFileSizeVersion, "Macrovision Security Driver"),
};
return MatchUtil.GetAllMatches(files, matchers, any: false);
@@ -264,7 +264,7 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, string.Empty),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}secdrv.sys", useEndsWith: true), GetSecdrvFileSizeVersion, "Macrovision Security Driver"),
new PathMatchSet(new FilePathMatch("secdrv.sys"), GetSecdrvFileSizeVersion, "Macrovision Security Driver"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);

View File

@@ -1,9 +1,8 @@
using BinaryObjectScanner.Interfaces;
using System.Collections.Concurrent;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Wrappers;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
namespace BinaryObjectScanner.Protection
{
@@ -96,11 +95,11 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
// Found in the SVKP 1.05-1.32 demos.
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkp.exe", useEndsWith: true), "SVKP"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkp.key", useEndsWith: true), "SVKP"),
new PathMatchSet(new FilePathMatch("svkp.exe"), "SVKP"),
new PathMatchSet(new FilePathMatch("svkp.key"), "SVKP"),
// Found in the SVKP 1.32 demo.
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkpnd.dll", useEndsWith: true), "SVKP"),
new PathMatchSet(new FilePathMatch("svkpnd.dll"), "SVKP"),
};
return MatchUtil.GetAllMatches(files, matchers, any: false);
@@ -112,11 +111,11 @@ namespace BinaryObjectScanner.Protection
var matchers = new List<PathMatchSet>
{
// Found in the SVKP 1.05-1.32 demos.
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkp.exe", useEndsWith: true), "SVKP"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkp.key", useEndsWith: true), "SVKP"),
new PathMatchSet(new FilePathMatch("svkp.exe"), "SVKP"),
new PathMatchSet(new FilePathMatch("svkp.key"), "SVKP"),
// Found in the SVKP 1.32 demo.
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}svkpnd.dll", useEndsWith: true), "SVKP"),
new PathMatchSet(new FilePathMatch("svkpnd.dll"), "SVKP"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);

View File

@@ -1,5 +1,4 @@
using System.IO;
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Collections.Generic;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -26,7 +25,7 @@ namespace BinaryObjectScanner.Protection
// Technically all need to exist but some might be renamed
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}SafeLock.DAT", useEndsWith: true), "SafeLock"),
new PathMatchSet(new FilePathMatch("SafeLock.DAT"), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.002", useEndsWith: true), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"),
@@ -41,7 +40,7 @@ namespace BinaryObjectScanner.Protection
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}SafeLock.DAT", useEndsWith: true), "SafeLock"),
new PathMatchSet(new FilePathMatch("SafeLock.DAT"), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.002", useEndsWith: true), "SafeLock"),
new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"),

View File

@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -36,8 +35,8 @@ namespace BinaryObjectScanner.Protection
{
new PathMatchSet(new List<PathMatch>
{
new PathMatch($"{Path.DirectorySeparatorChar}00001.TMP", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}00002.TMP", useEndsWith: true)
new FilePathMatch("00001.TMP"),
new FilePathMatch("00002.TMP")
}, "SmartE"),
};
@@ -49,8 +48,8 @@ namespace BinaryObjectScanner.Protection
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}00001.TMP", useEndsWith: true), "SmartE"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}00002.TMP", useEndsWith: true), "SmartE"),
new PathMatchSet(new FilePathMatch("00001.TMP"), "SmartE"),
new PathMatchSet(new FilePathMatch("00002.TMP"), "SmartE"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -111,12 +110,12 @@ namespace BurnOutSharp.ProtectionType
var matchers = new List<PathMatchSet>
{
// Found in Redump entry 68166.
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}tdvm.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}tdvm.vds", useEndsWith: true), "SolidShield"),
new PathMatchSet(new FilePathMatch("tdvm.dll"), "SolidShield"),
new PathMatchSet(new FilePathMatch("tdvm.vds"), "SolidShield"),
new PathMatchSet(new PathMatch("vfs20.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}dvm.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}hc.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new FilePathMatch("dvm.dll"), "SolidShield"),
new PathMatchSet(new FilePathMatch("hc.dll"), "SolidShield"),
new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"),
};
@@ -130,8 +129,8 @@ namespace BurnOutSharp.ProtectionType
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}dvm.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}hc.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new FilePathMatch("dvm.dll"), "SolidShield"),
new PathMatchSet(new FilePathMatch("hc.dll"), "SolidShield"),
new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"),
new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"),
};

View File

@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Wrappers;
@@ -53,11 +52,11 @@ namespace BinaryObjectScanner.Protection
new PathMatchSet(new PathMatch("UbisoftGameLauncher.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch("UbisoftGameLauncher64.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch("UbisoftGameLauncherInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}Uplay.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayCrashReporter.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayService.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayWebCore.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("Uplay.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayCrashReporter.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayInstaller.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayService.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayWebCore.exe"), "Uplay / Ubisoft Connect"),
};
return MatchUtil.GetAllMatches(files, matchers, any: true);
@@ -72,11 +71,11 @@ namespace BinaryObjectScanner.Protection
new PathMatchSet(new PathMatch("UbisoftGameLauncher.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch("UbisoftGameLauncher64.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch("UbisoftGameLauncherInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}Uplay.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayCrashReporter.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayService.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}UplayWebCore.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("Uplay.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayCrashReporter.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayInstaller.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayService.exe"), "Uplay / Ubisoft Connect"),
new PathMatchSet(new FilePathMatch("UplayWebCore.exe"), "Uplay / Ubisoft Connect"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);

View File

@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -58,8 +57,8 @@ namespace BinaryObjectScanner.Protection
{
new PathMatchSet(new List<PathMatch>
{
new PathMatch($"{Path.DirectorySeparatorChar}wtmfiles.dat", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}Viewer.exe", useEndsWith: true),
new FilePathMatch("wtmfiles.dat"),
new FilePathMatch("Viewer.exe"),
}, "WTM Protection Viewer"),
};
@@ -72,10 +71,10 @@ namespace BinaryObjectScanner.Protection
// TODO: Add ImageX.imp as a wildcard, if possible
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}Image.imp", useEndsWith: true), "WTM CD Protect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}Image1.imp", useEndsWith: true), "WTM CD Protect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}imp.dat", useEndsWith: true), "WTM CD Protect"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}wtmfiles.dat", useEndsWith: true), "WTM Protection Viewer"),
new PathMatchSet(new FilePathMatch("Image.imp"), "WTM CD Protect"),
new PathMatchSet(new FilePathMatch("Image1.imp"), "WTM CD Protect"),
new PathMatchSet(new FilePathMatch("imp.dat"), "WTM CD Protect"),
new PathMatchSet(new FilePathMatch("wtmfiles.dat"), "WTM Protection Viewer"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);