From 0e7d98158e7ef60139e4798d80522eb6e7e7d6eb Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 20 Mar 2021 13:29:46 -0700 Subject: [PATCH] Split out generic online registration --- BurnOutSharp/ProtectionType/ElectronicArts.cs | 8 +------- .../ProtectionType/OnlineRegistration.cs | 16 ++++++++++++++++ README.md | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 BurnOutSharp/ProtectionType/OnlineRegistration.cs diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 2b3f062f..6c98a0c7 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -38,13 +38,7 @@ check = 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, 0x43, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00 }; if (fileContent.Contains(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); - - // TODO: Figure out a better variant of this that doesn't over-match - // 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 + E + (char)0x00 + R + (char)0x00 + e + (char)0x00 + g + (char)0x00 - // check = 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, 0x45, 0x00, 0x52, 0x00, 0x65, 0x00, 0x67, 0x00 }; - // if (fileContent.Contains(check, out position)) - // return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); - + // EReg Config Form check = new byte[] { 0x45, 0x52, 0x65, 0x67, 0x20, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x20, 0x46, 0x6F, 0x72, 0x6D }; if (fileContent.Contains(check, out position)) diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs new file mode 100644 index 00000000..04c0647c --- /dev/null +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -0,0 +1,16 @@ +namespace BurnOutSharp.ProtectionType +{ + public class OnlineRegistration : IContentCheck + { + /// + public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + { + // 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 + E + (char)0x00 + R + (char)0x00 + e + (char)0x00 + g + (char)0x00 + byte[] check = 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, 0x45, 0x00, 0x52, 0x00, 0x65, 0x00, 0x67, 0x00 }; + if (fileContent.Contains(check, out int position)) + return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); + + return null; + } + } +} diff --git a/README.md b/README.md index dc6d8d0f..be3b3c5b 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Below is a list of the protections that can be detected using this code: - EA Protections (Including ~~Cucko~~, EA CDKey, and EA DRM) - Freelock - Games for Windows - Live (partial) +- Generic CD Check +- Generic Online Registration - Hexalock Autolock - Impulse Reactor - IndyVCD