diff --git a/BurnOutSharp/ProtectionType/CDKey.cs b/BurnOutSharp/ProtectionType/CDKey.cs new file mode 100644 index 00000000..eb8f115d --- /dev/null +++ b/BurnOutSharp/ProtectionType/CDKey.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using BurnOutSharp.Matching; + +namespace BurnOutSharp.ProtectionType +{ + public class CDKey : IContentCheck + { + /// + /// Set of all ContentMatchSets for this protection + /// + private static readonly List contentMatchers = new List + { + // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 + new ContentMatchSet(new byte?[] + { + 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, + 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, + 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, + 0x00, 0x00, 0x43, 0x00, 0x44, 0x00, 0x4B, 0x00, + 0x65, 0x00, 0x79, 0x00 + }, Utilities.GetFileVersion, "CD-Key / Serial"), + }; + + /// + public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + { + return MatchUtil.GetFirstMatch(file, fileContent, contentMatchers, includePosition); + } + } +} diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 165ba873..79809c1c 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -49,17 +49,6 @@ namespace BurnOutSharp.ProtectionType 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00 }, Utilities.GetFileVersion, "EA CdKey Registration Module"), - // Overmatches with a more generic protection - /* // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 - new ContentMatchSet(new byte?[] - { - 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, - 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, - 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, - 0x00, 0x00, 0x43, 0x00, 0x44, 0x00, 0x4B, 0x00, - 0x65, 0x00, 0x79, 0x00 - }, Utilities.GetFileVersion, "EA CdKey Registration Module"), */ - // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + C + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 new ContentMatchSet(new byte?[] {