From cfe889d5b306c80291b69a311dfebe18ab4c8f5d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 26 Aug 2023 22:51:55 -0400 Subject: [PATCH] Add and use `FilePathMatch` (fixes #262) --- .vscode/settings.json | 3 +++ BinaryObjectScanner.Matching/FilePathMatch.cs | 18 ++++++++++++++++ BinaryObjectScanner.Protection/Bitpool.cs | 13 ++++++------ BinaryObjectScanner.Protection/LaserLok.cs | 8 +++---- .../Macrovision.SafeDisc.cs | 8 +++---- BinaryObjectScanner.Protection/Macrovision.cs | 8 +++---- BinaryObjectScanner.Protection/SVKP.cs | 19 ++++++++--------- BinaryObjectScanner.Protection/SafeLock.cs | 7 +++---- BinaryObjectScanner.Protection/SmartE.cs | 9 ++++---- BinaryObjectScanner.Protection/SolidShield.cs | 13 ++++++------ BinaryObjectScanner.Protection/Uplay.cs | 21 +++++++++---------- .../WTMCDProtect.cs | 13 ++++++------ 12 files changed, 77 insertions(+), 63 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 BinaryObjectScanner.Matching/FilePathMatch.cs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..c2f1d208 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet.defaultSolution": "BurnOutSharp.sln" +} \ No newline at end of file diff --git a/BinaryObjectScanner.Matching/FilePathMatch.cs b/BinaryObjectScanner.Matching/FilePathMatch.cs new file mode 100644 index 00000000..9d1c0855 --- /dev/null +++ b/BinaryObjectScanner.Matching/FilePathMatch.cs @@ -0,0 +1,18 @@ +using System.IO; + +namespace BinaryObjectScanner.Matching +{ + /// + /// File path matching criteria + /// + public class FilePathMatch : PathMatch + { + /// + /// Constructor + /// + /// String representing the search + /// True to match exact casing, false otherwise + /// True to match the end only, false for all contents + public FilePathMatch(string needle) : base($"{Path.DirectorySeparatorChar}{needle}", false, true) { } + } +} \ No newline at end of file diff --git a/BinaryObjectScanner.Protection/Bitpool.cs b/BinaryObjectScanner.Protection/Bitpool.cs index f74ca12a..77a45fe6 100644 --- a/BinaryObjectScanner.Protection/Bitpool.cs +++ b/BinaryObjectScanner.Protection/Bitpool.cs @@ -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 { 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 { - 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 { 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"), diff --git a/BinaryObjectScanner.Protection/LaserLok.cs b/BinaryObjectScanner.Protection/LaserLok.cs index 0e331b7b..4c55b6df 100644 --- a/BinaryObjectScanner.Protection/LaserLok.cs +++ b/BinaryObjectScanner.Protection/LaserLok.cs @@ -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 { - 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]"), diff --git a/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs b/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs index 929db69b..49c8256d 100644 --- a/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs +++ b/BinaryObjectScanner.Protection/Macrovision.SafeDisc.cs @@ -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. diff --git a/BinaryObjectScanner.Protection/Macrovision.cs b/BinaryObjectScanner.Protection/Macrovision.cs index 284b183b..8cf1d023 100644 --- a/BinaryObjectScanner.Protection/Macrovision.cs +++ b/BinaryObjectScanner.Protection/Macrovision.cs @@ -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 { 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 { 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); diff --git a/BinaryObjectScanner.Protection/SVKP.cs b/BinaryObjectScanner.Protection/SVKP.cs index 6f8412e2..75443d78 100644 --- a/BinaryObjectScanner.Protection/SVKP.cs +++ b/BinaryObjectScanner.Protection/SVKP.cs @@ -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 { // 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 { // 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); diff --git a/BinaryObjectScanner.Protection/SafeLock.cs b/BinaryObjectScanner.Protection/SafeLock.cs index f0642da7..827cfd57 100644 --- a/BinaryObjectScanner.Protection/SafeLock.cs +++ b/BinaryObjectScanner.Protection/SafeLock.cs @@ -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 { - 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 { - 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"), diff --git a/BinaryObjectScanner.Protection/SmartE.cs b/BinaryObjectScanner.Protection/SmartE.cs index 9f594b5f..528e7c13 100644 --- a/BinaryObjectScanner.Protection/SmartE.cs +++ b/BinaryObjectScanner.Protection/SmartE.cs @@ -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 { - 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 { - 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); diff --git a/BinaryObjectScanner.Protection/SolidShield.cs b/BinaryObjectScanner.Protection/SolidShield.cs index 8bc85120..5034a290 100644 --- a/BinaryObjectScanner.Protection/SolidShield.cs +++ b/BinaryObjectScanner.Protection/SolidShield.cs @@ -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 { // 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 { - 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"), }; diff --git a/BinaryObjectScanner.Protection/Uplay.cs b/BinaryObjectScanner.Protection/Uplay.cs index 3845922f..81015b77 100644 --- a/BinaryObjectScanner.Protection/Uplay.cs +++ b/BinaryObjectScanner.Protection/Uplay.cs @@ -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); diff --git a/BinaryObjectScanner.Protection/WTMCDProtect.cs b/BinaryObjectScanner.Protection/WTMCDProtect.cs index 77be2819..e1e77248 100644 --- a/BinaryObjectScanner.Protection/WTMCDProtect.cs +++ b/BinaryObjectScanner.Protection/WTMCDProtect.cs @@ -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 { - 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 { - 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);