diff --git a/BurnOutSharp/FileType/BFPK.cs b/BurnOutSharp/FileType/BFPK.cs index a56a196e..8aa67b20 100644 --- a/BurnOutSharp/FileType/BFPK.cs +++ b/BurnOutSharp/FileType/BFPK.cs @@ -12,7 +12,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x42, 0x46, 0x50, 0x4b })) + if (magic.StartsWith(new byte?[] { 0x42, 0x46, 0x50, 0x4b })) return true; return false; diff --git a/BurnOutSharp/FileType/BZip2.cs b/BurnOutSharp/FileType/BZip2.cs index 7dbc6bf0..55228d2d 100644 --- a/BurnOutSharp/FileType/BZip2.cs +++ b/BurnOutSharp/FileType/BZip2.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x42, 0x52, 0x68 })) + if (magic.StartsWith(new byte?[] { 0x42, 0x52, 0x68 })) return true; return false; diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 4aa3dd5b..8d025381 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -18,31 +18,31 @@ namespace BurnOutSharp.FileType public bool ShouldScan(byte[] magic) { // DOS MZ executable file format (and descendants) - if (magic.StartsWith(new byte[] { 0x4d, 0x5a })) + if (magic.StartsWith(new byte?[] { 0x4d, 0x5a })) return true; // Executable and Linkable Format - if (magic.StartsWith(new byte[] { 0x7f, 0x45, 0x4c, 0x46 })) + if (magic.StartsWith(new byte?[] { 0x7f, 0x45, 0x4c, 0x46 })) return true; // Mach-O binary (32-bit) - if (magic.StartsWith(new byte[] { 0xfe, 0xed, 0xfa, 0xce })) + if (magic.StartsWith(new byte?[] { 0xfe, 0xed, 0xfa, 0xce })) return true; // Mach-O binary (32-bit, reverse byte ordering scheme) - if (magic.StartsWith(new byte[] { 0xce, 0xfa, 0xed, 0xfe })) + if (magic.StartsWith(new byte?[] { 0xce, 0xfa, 0xed, 0xfe })) return true; // Mach-O binary (64-bit) - if (magic.StartsWith(new byte[] { 0xfe, 0xed, 0xfa, 0xcf })) + if (magic.StartsWith(new byte?[] { 0xfe, 0xed, 0xfa, 0xcf })) return true; // Mach-O binary (64-bit, reverse byte ordering scheme) - if (magic.StartsWith(new byte[] { 0xcf, 0xfa, 0xed, 0xfe })) + if (magic.StartsWith(new byte?[] { 0xcf, 0xfa, 0xed, 0xfe })) return true; // Prefrred Executable File Format - if (magic.StartsWith(new byte[] { 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66 })) + if (magic.StartsWith(new byte?[] { 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66 })) return true; return false; diff --git a/BurnOutSharp/FileType/GZIP.cs b/BurnOutSharp/FileType/GZIP.cs index 6d65642b..6bc4b766 100644 --- a/BurnOutSharp/FileType/GZIP.cs +++ b/BurnOutSharp/FileType/GZIP.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x1f, 0x8b })) + if (magic.StartsWith(new byte?[] { 0x1f, 0x8b })) return true; return false; diff --git a/BurnOutSharp/FileType/InstallShieldCAB.cs b/BurnOutSharp/FileType/InstallShieldCAB.cs index 9f89e3cd..d0954846 100644 --- a/BurnOutSharp/FileType/InstallShieldCAB.cs +++ b/BurnOutSharp/FileType/InstallShieldCAB.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x49, 0x53, 0x63 })) + if (magic.StartsWith(new byte?[] { 0x49, 0x53, 0x63 })) return true; return false; diff --git a/BurnOutSharp/FileType/MPQ.cs b/BurnOutSharp/FileType/MPQ.cs index e63ca659..8d0b297c 100644 --- a/BurnOutSharp/FileType/MPQ.cs +++ b/BurnOutSharp/FileType/MPQ.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x4d, 0x50, 0x51, 0x1a })) + if (magic.StartsWith(new byte?[] { 0x4d, 0x50, 0x51, 0x1a })) return true; return false; diff --git a/BurnOutSharp/FileType/MSI.cs b/BurnOutSharp/FileType/MSI.cs index 23dd897d..1d41b3b1 100644 --- a/BurnOutSharp/FileType/MSI.cs +++ b/BurnOutSharp/FileType/MSI.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 })) + if (magic.StartsWith(new byte?[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 })) return true; return false; diff --git a/BurnOutSharp/FileType/MicrosoftCAB.cs b/BurnOutSharp/FileType/MicrosoftCAB.cs index a2c46205..dc870976 100644 --- a/BurnOutSharp/FileType/MicrosoftCAB.cs +++ b/BurnOutSharp/FileType/MicrosoftCAB.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x4d, 0x53, 0x43, 0x46 })) + if (magic.StartsWith(new byte?[] { 0x4d, 0x53, 0x43, 0x46 })) return true; return false; diff --git a/BurnOutSharp/FileType/PKZIP.cs b/BurnOutSharp/FileType/PKZIP.cs index a2aba1f7..6fba6ab2 100644 --- a/BurnOutSharp/FileType/PKZIP.cs +++ b/BurnOutSharp/FileType/PKZIP.cs @@ -12,15 +12,15 @@ namespace BurnOutSharp.FileType public bool ShouldScan(byte[] magic) { // PKZIP - if (magic.StartsWith(new byte[] { 0x50, 0x4b, 0x03, 0x04 })) + if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x03, 0x04 })) return true; // PKZIP (Empty Archive) - if (magic.StartsWith(new byte[] { 0x50, 0x4b, 0x05, 0x06 })) + if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x05, 0x06 })) return true; // PKZIP (Spanned Archive) - if (magic.StartsWith(new byte[] { 0x50, 0x4b, 0x07, 0x08 })) + if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x07, 0x08 })) return true; return false; diff --git a/BurnOutSharp/FileType/RAR.cs b/BurnOutSharp/FileType/RAR.cs index 5cf4c5fd..f69e7c2c 100644 --- a/BurnOutSharp/FileType/RAR.cs +++ b/BurnOutSharp/FileType/RAR.cs @@ -12,11 +12,11 @@ namespace BurnOutSharp.FileType public bool ShouldScan(byte[] magic) { // RAR archive version 1.50 onwards - if (magic.StartsWith(new byte[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 })) + if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 })) return true; // RAR archive version 5.0 onwards - if (magic.StartsWith(new byte[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00 })) + if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00 })) return true; return false; diff --git a/BurnOutSharp/FileType/SevenZip.cs b/BurnOutSharp/FileType/SevenZip.cs index 53a4ee0f..432bc6dd 100644 --- a/BurnOutSharp/FileType/SevenZip.cs +++ b/BurnOutSharp/FileType/SevenZip.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c })) + if (magic.StartsWith(new byte?[] { 0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c })) return true; return false; diff --git a/BurnOutSharp/FileType/TapeArchive.cs b/BurnOutSharp/FileType/TapeArchive.cs index 1ae94f51..33fa41c2 100644 --- a/BurnOutSharp/FileType/TapeArchive.cs +++ b/BurnOutSharp/FileType/TapeArchive.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30 })) + if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30 })) return true; - if (magic.StartsWith(new byte[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00 })) + if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00 })) return true; return false; diff --git a/BurnOutSharp/FileType/Textfile.cs b/BurnOutSharp/FileType/Textfile.cs index 9a392419..906e269f 100644 --- a/BurnOutSharp/FileType/Textfile.cs +++ b/BurnOutSharp/FileType/Textfile.cs @@ -22,19 +22,19 @@ namespace BurnOutSharp.FileType public bool ShouldScan(byte[] magic, string extension) { // Rich Text File - if (magic.StartsWith(new byte[] { 0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31 })) + if (magic.StartsWith(new byte?[] { 0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31 })) return true; // HTML - if (magic.StartsWith(new byte[] { 0x3c, 0x68, 0x74, 0x6d, 0x6c })) + if (magic.StartsWith(new byte?[] { 0x3c, 0x68, 0x74, 0x6d, 0x6c })) return true; // HTML and XML - if (magic.StartsWith(new byte[] { 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45 })) + if (magic.StartsWith(new byte?[] { 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45 })) return true; // Microsoft Office File (old) - if (magic.StartsWith(new byte[] { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 })) + if (magic.StartsWith(new byte?[] { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 })) return true; // Generic textfile (no header) diff --git a/BurnOutSharp/FileType/Valve.cs b/BurnOutSharp/FileType/Valve.cs index 9877b3fd..7623ac80 100644 --- a/BurnOutSharp/FileType/Valve.cs +++ b/BurnOutSharp/FileType/Valve.cs @@ -11,23 +11,23 @@ namespace BurnOutSharp.FileType public bool ShouldScan(byte[] magic) { // GCF - if (magic.StartsWith(new byte[] { 0x01, 0x00, 0x00, 0x00 })) + if (magic.StartsWith(new byte?[] { 0x01, 0x00, 0x00, 0x00 })) return true; // PAK - if (magic.StartsWith(new byte[] { 0x50, 0x41, 0x43, 0x4b })) + if (magic.StartsWith(new byte?[] { 0x50, 0x41, 0x43, 0x4b })) return true; // SGA - if (magic.StartsWith(new byte[] { 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 })) + if (magic.StartsWith(new byte?[] { 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 })) return true; // VPK - if (magic.StartsWith(new byte[] { 0x55, 0xaa, 0x12, 0x34 })) + if (magic.StartsWith(new byte?[] { 0x55, 0xaa, 0x12, 0x34 })) return true; // WAD - if (magic.StartsWith(new byte[] { 0x57, 0x41, 0x44, 0x33 })) + if (magic.StartsWith(new byte?[] { 0x57, 0x41, 0x44, 0x33 })) return true; return false; diff --git a/BurnOutSharp/FileType/XZ.cs b/BurnOutSharp/FileType/XZ.cs index a611037a..c9aaa33c 100644 --- a/BurnOutSharp/FileType/XZ.cs +++ b/BurnOutSharp/FileType/XZ.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.FileType /// public bool ShouldScan(byte[] magic) { - if (magic.StartsWith(new byte[] { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00 })) + if (magic.StartsWith(new byte?[] { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00 })) return true; return false; diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs index 7a4f5441..695b89c1 100644 --- a/BurnOutSharp/PackerType/Armadillo.cs +++ b/BurnOutSharp/PackerType/Armadillo.cs @@ -6,12 +6,12 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // ".nicode" + (char)0x00 - byte[] check = new byte[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }; + byte?[] check = new byte?[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return $"Armadillo" + (includePosition ? $" (Index {position})" : string.Empty); // "ARMDEBUG" - check = new byte[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }; + check = new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }; if (fileContent.FirstPosition(check, out position)) return $"Armadillo" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs index 1e18c44d..726ffe8e 100644 --- a/BurnOutSharp/PackerType/EXEStealth.cs +++ b/BurnOutSharp/PackerType/EXEStealth.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "??[[__[[_" + (char)0x00 + "{{" + (char)0x0 + (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "?;??;??" - byte[] check = new byte[] { 0x3F, 0x3F, 0x5B, 0x5B, 0x5F, 0x5F, 0x5B, 0x5B, 0x5F, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x3F, 0x3B, 0x3F, 0x3F, 0x3B, 0x3F, 0x3F }; + byte?[] check = new byte?[] { 0x3F, 0x3F, 0x5B, 0x5B, 0x5F, 0x5F, 0x5B, 0x5B, 0x5F, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x3F, 0x3B, 0x3F, 0x3F, 0x3B, 0x3F, 0x3F }; if (fileContent.FirstPosition(check, out int position)) return $"EXE Stealth" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs index d479f045..1c30d065 100644 --- a/BurnOutSharp/PackerType/InnoSetup.cs +++ b/BurnOutSharp/PackerType/InnoSetup.cs @@ -15,7 +15,7 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "Inno" - byte[] check = new byte[] { 0x49, 0x6E, 0x6E, 0x6F }; + byte?[] check = new byte?[] { 0x49, 0x6E, 0x6E, 0x6F }; if (fileContent.FirstPosition(check, out int position) && position == 0x30) return $"Inno Setup {GetVersion(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index bbcafa80..0cf969f1 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // Nullsoft Install System - byte[] check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d }; + byte?[] check = new byte?[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d }; if (fileContent.FirstPosition(check, out int position)) { string version = GetVersion(fileContent, position); @@ -18,7 +18,7 @@ namespace BurnOutSharp.PackerType } // NullsoftInst - check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74 }; + check = new byte?[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74 }; if (fileContent.FirstPosition(check, out position)) { return $"NSIS" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index 7feb1cf8..22f97358 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "PEC2" - byte[] check = new byte[] { 0x50, 0x45, 0x43, 0x32 }; + byte?[] check = new byte?[] { 0x50, 0x45, 0x43, 0x32 }; if (fileContent.FirstPosition(check, out int position, end: 2048)) return "PE Compact 2" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs index 61daea5b..0412643c 100644 --- a/BurnOutSharp/PackerType/SetupFactory.cs +++ b/BurnOutSharp/PackerType/SetupFactory.cs @@ -17,9 +17,9 @@ namespace BurnOutSharp.PackerType { /* Longer version of the check that can be used if false positves become an issue: "S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n" - byte[] check = new byte[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00, 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E }; */ + byte?[] check = new byte?[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00, 0x20, 0x00, 0x69, 0x00, 0x73, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x20, 0x00, 0x6F, 0x00, 0x66, 0x00, 0x20, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x69, 0x00, 0x67, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E }; */ // "S.e.t.u.p. .F.a.c.t.o.r.y." - byte[] check = new byte[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00 }; + byte?[] check = new byte?[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x79, 0x00 }; if (fileContent.FirstPosition(check, out int position)) { // Check the manifest version first diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs index e9ebef77..6a863f45 100644 --- a/BurnOutSharp/PackerType/UPX.cs +++ b/BurnOutSharp/PackerType/UPX.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // UPX! - byte[] check = new byte[] { 0x55, 0x50, 0x58, 0x21 }; + byte?[] check = new byte?[] { 0x55, 0x50, 0x58, 0x21 }; if (fileContent.FirstPosition(check, out int position)) { string version = GetVersion(fileContent, position); @@ -16,7 +16,7 @@ namespace BurnOutSharp.PackerType } // NOS - check = new byte[] { 0x55, 0x50, 0x58, 0x21 }; + check = new byte?[] { 0x55, 0x50, 0x58, 0x21 }; if (fileContent.FirstPosition(check, out position)) { string version = GetVersion(fileContent, position); @@ -24,11 +24,11 @@ namespace BurnOutSharp.PackerType } // UPX0 - check = new byte[] { 0x55, 0x50, 0x58, 0x30 }; + check = new byte?[] { 0x55, 0x50, 0x58, 0x30 }; if (fileContent.FirstPosition(check, out position, end: 2048)) { // UPX1 - byte[] check2 = new byte[] { 0x55, 0x50, 0x58, 0x31 }; + byte?[] check2 = new byte?[] { 0x55, 0x50, 0x58, 0x31 }; if (fileContent.FirstPosition(check2, out int position2, end: 2048)) { return $"UPX (Unknown Version)" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); @@ -36,11 +36,11 @@ namespace BurnOutSharp.PackerType } // NOS0 - check = new byte[] { 0x4E, 0x4F, 0x53, 0x30 }; + check = new byte?[] { 0x4E, 0x4F, 0x53, 0x30 }; if (fileContent.FirstPosition(check, out position, end: 2048)) { // NOS1 - byte[] check2 = new byte[] { 0x4E, 0x4F, 0x53, 0x31 }; + byte?[] check2 = new byte?[] { 0x4E, 0x4F, 0x53, 0x31 }; if (fileContent.FirstPosition(check2, out int position2, end: 2048)) { return $"UPX (NOS Variant) (Unknown Version)" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index 9e8e982e..a2aedefc 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -17,12 +17,12 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // WinZip Self-Extractor - byte[] check = new byte[] { 0x57, 0x69, 0x6E, 0x5A, 0x69, 0x70, 0x20, 0x53, 0x65, 0x6C, 0x66, 0x2D, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6F, 0x72 }; + byte?[] check = new byte?[] { 0x57, 0x69, 0x6E, 0x5A, 0x69, 0x70, 0x20, 0x53, 0x65, 0x6C, 0x66, 0x2D, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6F, 0x72 }; if (fileContent.FirstPosition(check, out int position)) return $"WinZip SFX {GetVersion(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty); // _winzip_ - check = new byte[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }; + check = new byte?[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }; if (fileContent.FirstPosition(check, out position)) return $"WinZip SFX {GetVersion(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty); @@ -104,7 +104,7 @@ namespace BurnOutSharp.PackerType { #region 16-bit NE Header Checks - byte[] check = new byte[] + byte?[] check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -118,7 +118,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.0 (MS-DOS/16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -132,7 +132,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.0 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -146,7 +146,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "Compact 2.0 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xCD, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -160,7 +160,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "Software Installation 2.0 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -174,7 +174,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.1 RC2 (MS-DOS/16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -188,7 +188,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.1 RC2 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -202,7 +202,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "Compact 2.1 RC2 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -216,7 +216,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "Software Installation 2.1 RC2 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -230,7 +230,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.1 (MS-DOS/16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -244,7 +244,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "2.1 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -258,7 +258,7 @@ namespace BurnOutSharp.PackerType if (fileContent.FirstPosition(check, out _)) return "Compact 2.1 (16-bit)"; - check = new byte[] + check = new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -278,7 +278,7 @@ namespace BurnOutSharp.PackerType #region 32-bit SFX Header Checks // .............8�92....�P..............�P..�P..�P..VW95SE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9C, 0x39, @@ -293,7 +293,7 @@ namespace BurnOutSharp.PackerType return "2.0 (32-bit)"; // .............]�92....�P..............�P..�P..�P..VW95SRE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x9C, 0x39, @@ -308,7 +308,7 @@ namespace BurnOutSharp.PackerType return "Software Installation 2.0 (32-bit)"; // .............���3....�P..............�P..�P..�P..VW95SE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x82, 0x94, @@ -323,7 +323,7 @@ namespace BurnOutSharp.PackerType return "2.1 RC2 (32-bit)"; // .............���3....�P..............�P..�P..�P..VW95SRE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x82, 0x94, @@ -338,7 +338,7 @@ namespace BurnOutSharp.PackerType return "Software Installation 2.1 RC2 (32-bit)"; // .............U��3....�P..............�P..�P..�P..VW95SE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xCD, 0xCC, @@ -353,7 +353,7 @@ namespace BurnOutSharp.PackerType return "2.1 (32-bit)"; // .............{��3....�P..............�P..�P..�P..VW95SRE.SFX - check = new byte[] + check = new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xCD, 0xCC, @@ -372,7 +372,7 @@ namespace BurnOutSharp.PackerType #region 32-bit PE Header Checks // PE..L...i.[:........�........J...*......�9.......`....@. - check = new byte[] + check = new byte?[] { 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x05, 0x00, 0x69, 0x1B, 0x5B, 0x3A, 0x00, 0x00, 0x00, 0x00, @@ -386,7 +386,7 @@ namespace BurnOutSharp.PackerType return "2.2.4003"; // PE..L.....[:........�........V...*.......?.......p....@. - check = new byte[] + check = new byte?[] { 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x05, 0x00, 0x81, 0x1B, 0x5B, 0x3A, 0x00, 0x00, 0x00, 0x00, diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index 7d84b286..6d202efb 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // WiseMain - byte[] check = new byte[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }; + byte?[] check = new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }; if (fileContent.FirstPosition(check, out int position)) return "Wise Installation Wizard Module" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs index b15c7ec9..466a72ed 100644 --- a/BurnOutSharp/PackerType/dotFuscator.cs +++ b/BurnOutSharp/PackerType/dotFuscator.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "DotfuscatorAttribute" - byte[] check = new byte[] { 0x44, 0x6F, 0x74, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65 }; + byte?[] check = new byte?[] { 0x44, 0x6F, 0x74, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65 }; if (fileContent.FirstPosition(check, out int position)) return "dotFuscator" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index 38f8a34d..f1a2d307 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -6,12 +6,12 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "TMSAMVOF" - byte[] check = new byte[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }; + byte?[] check = new byte?[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }; if (fileContent.FirstPosition(check, out int position)) return "ActiveMARK" + (includePosition ? $" (Index {position})" : string.Empty); // " " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0xB8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x86 + (char)0xC8 + (char)0x16 + (char)0x0 + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00 - check = new byte[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x0, 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 }; + check = new byte?[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x0, 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "ActiveMARK 5" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index f5b6b948..50b32c4a 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "SETTEC" - byte[] check = new byte[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }; + byte?[] check = new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }; if (fileContent.FirstPosition(check, out int position)) return "Alpha-ROM" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index abf3d2c4..5bb9253c 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -6,12 +6,12 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // MGS CDCheck - byte[] check = new byte[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }; + byte?[] check = new byte?[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }; if (fileContent.FirstPosition(check, out int position)) return "Microsoft Game Studios CD Check" + (includePosition ? $" (Index {position})" : string.Empty); // CDCheck - check = new byte[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }; + check = new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }; if (fileContent.FirstPosition(check, out position)) return "Executable-Based CD Check" + (includePosition ? $" (Index {position})" : string.Empty); @@ -22,12 +22,12 @@ private static string CheckContentsBroad(byte[] fileContent, bool includePosition = false) { // GetDriveType - byte[] check = new byte[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 }; + byte?[] check = new byte?[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 }; if (fileContent.FirstPosition(check, out int position)) return "CD Check" + (includePosition ? $" (Index {position})" : string.Empty); // GetVolumeInformation - check = new byte[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E }; + check = new byte?[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E }; if (fileContent.FirstPosition(check, out position)) return "CD Check" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index 7c8c9ed9..7c8adbfc 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -11,12 +11,12 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "CD-Cops, ver. " - byte[] check = new byte[] { 0x43, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }; + byte?[] check = new byte?[] { 0x43, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }; if (fileContent.FirstPosition(check, out int position)) return $"CD-Cops {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); // ".grand" + (char)0x00 - check = new byte[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00}; + check = new byte?[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00}; if (fileContent.FirstPosition(check, out position)) return "CD-Cops" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index 4da38efe..a6e208a7 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "2" + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B + "$" + (char)0x99 + (char)0xAD + "'C" + (char)0xE4 + (char)0x9D + "st" + (char)0x99 + (char)0xFA + "2$" + (char)0x9D + ")4" + (char)0xFF + "t" - byte[] check = new byte[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, 0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF, 0x74 }; + byte?[] check = new byte?[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, 0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF, 0x74 }; if (fileContent.FirstPosition(check, out int position)) return "CD-Lock" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index a33be28d..3ff2bc19 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "~0017.tmp" - byte[] check = new byte[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }; + byte?[] check = new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }; if (fileContent.FirstPosition(check, out int position)) return "CDSHiELD SE" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index 89e6a09d..57ecd234 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -12,17 +12,17 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // DATA.CDS - byte[] check = new byte[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }; + byte?[] check = new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }; if (fileContent.FirstPosition(check, out int position)) return "Cactus Data Shield 200" + (includePosition ? $" (Index {position})" : string.Empty); // \*.CDS - check = new byte[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }; + check = new byte?[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }; if (fileContent.FirstPosition(check, out position)) return "Cactus Data Shield 200" + (includePosition ? $" (Index {position})" : string.Empty); // CDSPlayer - check = new byte[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }; + check = new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }; if (fileContent.FirstPosition(check, out position)) return "Cactus Data Shield 200" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs index 847e92ae..a7310427 100644 --- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // ".cenega" - byte[] check = new byte[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }; + byte?[] check = new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }; if (fileContent.FirstPosition(check, out int position)) return "Cenega ProtectDVD" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index ae91bbaa..96147710 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -7,17 +7,17 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "icd1" + (char)0x00 - byte[] check = new byte[] { 0x69, 0x63, 0x64, 0x31, 0x00 }; + byte?[] check = new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty); // "icd2" + (char)0x00 - check = new byte[] { 0x69, 0x63, 0x64, 0x32, 0x00 }; + check = new byte?[] { 0x69, 0x63, 0x64, 0x32, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty); // "CODE-LOCK.OCX" - check = new byte[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 }; + check = new byte?[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 }; if (fileContent.FirstPosition(check, out position)) return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index 665e35ef..94406027 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "Tom Commander" - byte[] check = new byte[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 }; + byte?[] check = new byte?[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 }; if (fileContent.FirstPosition(check, out int position)) return "CopyKiller" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index d20a9a1b..6a1961a2 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "DVD-Cops, ver. " - byte[] check = new byte[] { 0x44, 0x56, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }; + byte?[] check = new byte?[] { 0x44, 0x56, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }; if (fileContent.FirstPosition(check, out int position)) return $"DVD-Cops {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 852c691a..3f71bcb3 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -10,52 +10,52 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // EASTL - // byte[] check = new byte[] { 0x45, 0x41, 0x53, 0x54, 0x4C }; + // byte?[] check = new byte?[] { 0x45, 0x41, 0x53, 0x54, 0x4C }; // if (fileContent.Contains(check, out int position)) // return "Cucko (EA Custom)" + (includePosition ? $" (Index {position})" : string.Empty); // R + (char)0x00 + e + (char)0x00 + g + (char)0x00 + i + (char)0x00 + s + (char)0x00 + t + (char)0x00 + r + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + C + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 + + (char)0x00 + i + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + e + (char)0x00 + r + (char)0x00 + + (char)0x00 + p + (char)0x00 + r + (char)0x00 + o + (char)0x00 + g + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 - byte[] check = new byte[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6D, 0x00 }; + byte?[] check = new byte?[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6D, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // R + (char)0x00 + e + (char)0x00 + g + (char)0x00 + i + (char)0x00 + s + (char)0x00 + t + (char)0x00 + r + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + c + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 + + (char)0x00 + i + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + e + (char)0x00 + r + (char)0x00 + + (char)0x00 + p + (char)0x00 + r + (char)0x00 + o + (char)0x00 + g + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 - check = new byte[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6D, 0x00 }; + check = new byte?[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6D, 0x00 }; if (fileContent.FirstPosition(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // A + (char)0x00 + b + (char)0x00 + o + (char)0x00 + u + (char)0x00 + t + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 - check = new byte[] { 0x41, 0x00, 0x62, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x43, 0x00, 0x44, 0x00, 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00 }; + check = new byte?[] { 0x41, 0x00, 0x62, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x43, 0x00, 0x44, 0x00, 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00 }; if (fileContent.FirstPosition(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // 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 - 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, 0x4B, 0x00, 0x65, 0x00, 0x79, 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, 0x43, 0x00, 0x44, 0x00, 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00 }; if (fileContent.FirstPosition(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // 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 - 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 }; + 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.FirstPosition(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 }; + check = new byte?[] { 0x45, 0x52, 0x65, 0x67, 0x20, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x20, 0x46, 0x6F, 0x72, 0x6D }; if (fileContent.FirstPosition(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // ereg.ea-europe.com - check = new byte[] { 0x65, 0x72, 0x65, 0x67, 0x2E, 0x65, 0x61, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x65, 0x2E, 0x63, 0x6F, 0x6D }; + check = new byte?[] { 0x65, 0x72, 0x65, 0x67, 0x2E, 0x65, 0x61, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x65, 0x2E, 0x63, 0x6F, 0x6D }; if (fileContent.FirstPosition(check, out position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // GenericEA + (char)0x00 + (char)0x00 + (char)0x00 + Activation - check = new byte[] { 0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x45, 0x41, 0x00, 0x00, 0x00, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E }; + check = new byte?[] { 0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x45, 0x41, 0x00, 0x00, 0x00, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E }; if (fileContent.FirstPosition(check, out position)) return "EA DRM Protection" + (includePosition ? $" (Index {position})" : string.Empty); // E + (char)0x00 + A + (char)0x00 + + (char)0x00 + D + (char)0x00 + R + (char)0x00 + M + (char)0x00 + + (char)0x00 + H + (char)0x00 + e + (char)0x00 + l + (char)0x00 + p + (char)0x00 + e + (char)0x00 + r + (char)0x00 - check = new byte[] { 0x45, 0x00, 0x41, 0x00, 0x20, 0x00, 0x44, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00 }; + check = new byte?[] { 0x45, 0x00, 0x41, 0x00, 0x20, 0x00, 0x44, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "EA DRM Protection" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index 7e2b5d87..8f3728d2 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "xlive.dll" - byte[] check = new byte[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }; + byte?[] check = new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }; if (fileContent.FirstPosition(check, out int position)) return "Games for Windows - Live" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index 8d9e96a5..89935098 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -11,11 +11,11 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "CVPInitializeClient" - byte[] check = new byte[] { 0x43, 0x56, 0x50, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74 }; + byte?[] check = new byte?[] { 0x43, 0x56, 0x50, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74 }; if (fileContent.FirstPosition(check, out int position)) { // "A" + (char)0x00 + "T" + (char)0x00 + "T" + (char)0x00 + "L" + (char)0x00 + "I" + (char)0x00 + "S" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "E" + (char)0x00 + "L" + (char)0x00 + "E" + (char)0x00 + "M" + (char)0x00 + "E" + (char)0x00 + "N" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "N" + (char)0x00 + "O" + (char)0x00 + "T" + (char)0x00 + "A" + (char)0x00 + "T" + (char)0x00 + "I" + (char)0x00 + "O" + (char)0x00 + "N" - byte[] check2 = new byte[] { 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, 0x45, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x4F, 0x00, 0x54, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E }; + byte?[] check2 = new byte?[] { 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, 0x45, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x4F, 0x00, 0x54, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E }; if (fileContent.FirstPosition(check2, out int position2)) return $"Impulse Reactor {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); else diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs index b8cf3181..483a5305 100644 --- a/BurnOutSharp/ProtectionType/Intenium.cs +++ b/BurnOutSharp/ProtectionType/Intenium.cs @@ -22,7 +22,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // Trial + (char)0x00 + P - byte[] check = new byte[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }; + byte?[] check = new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }; if (fileContent.FirstPosition(check, out int position)) return "INTENIUM Trial & Buy Protection" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs index 16ec6a89..d921353e 100644 --- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs +++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs @@ -9,11 +9,11 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // ".ext " - byte[] check = new byte[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }; + byte?[] check = new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }; if (fileContent.FirstPosition(check, out int position)) { // "kernel32.dll" + (char)0x00 + (char)0x00 + (char)0x00 + "VirtualProtect" - byte[] check2 = new byte[] { 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74 }; + byte?[] check2 = new byte?[] { 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74 }; if (fileContent.FirstPosition(check2, out int position2)) return $"JoWooD X-Prot {GetVersion(fileContent, --position2)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); else @@ -21,7 +21,7 @@ namespace BurnOutSharp.ProtectionType } // "@HC09 " - check = new byte[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 }; + check = new byte?[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 }; if (fileContent.FirstPosition(check, out position)) return $"JoWooD X-Prot v2" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index 71af9339..2ed86339 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "KEY-LOCK COMMAND" - byte[] check = new byte[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 }; + byte?[] check = new byte?[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 }; if (fileContent.FirstPosition(check, out int position)) return $"Key-Lock (Dongle)" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs index e8516cb2..fc8226cf 100644 --- a/BurnOutSharp/ProtectionType/LaserLock.cs +++ b/BurnOutSharp/ProtectionType/LaserLock.cs @@ -11,11 +11,11 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "Packed by SPEEnc V2 Asterios Parlamentas.PE" - byte[] check = new byte[] { 0x50, 0x61, 0x63, 0x6B, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x53, 0x50, 0x45, 0x45, 0x6E, 0x63, 0x20, 0x56, 0x32, 0x20, 0x41, 0x73, 0x74, 0x65, 0x72, 0x69, 0x6F, 0x73, 0x20, 0x50, 0x61, 0x72, 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; + byte?[] check = new byte?[] { 0x50, 0x61, 0x63, 0x6B, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x53, 0x50, 0x45, 0x45, 0x6E, 0x63, 0x20, 0x56, 0x32, 0x20, 0x41, 0x73, 0x74, 0x65, 0x72, 0x69, 0x6F, 0x73, 0x20, 0x50, 0x61, 0x72, 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; bool containsCheck = fileContent.FirstPosition(check, out int position); // "GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00 + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF" - byte[] check2 = { 0x47, 0x65, 0x74, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6F, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x6F, 0x61, 0x64, 0x4C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x00, 0x00, 0x4B, 0x45, 0x52, 0x4E, 0x45, 0x4C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0xEB, 0x79, 0x01, 0x53, 0x4E, 0x49, 0x46 }; + byte?[] check2 = { 0x47, 0x65, 0x74, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6F, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x6F, 0x61, 0x64, 0x4C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x00, 0x00, 0x4B, 0x45, 0x52, 0x4E, 0x45, 0x4C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0xEB, 0x79, 0x01, 0x53, 0x4E, 0x49, 0x46 }; bool containsCheck2 = fileContent.FirstPosition(check2, out int position2); if (containsCheck && containsCheck2) @@ -29,12 +29,12 @@ namespace BurnOutSharp.ProtectionType return $"LaserLock {GetVersion16Bit(fileContent)}" + (includePosition ? $" (Index 71)" : string.Empty); // ":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP" - check = new byte[] { 0x3A, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x2E, 0x49, 0x4E, 0x00, 0x43, 0x3A, 0x5C, 0x5C, 0x4E, 0x4F, 0x4D, 0x4F, 0x55, 0x53, 0x45, 0x2E, 0x53, 0x50 }; + check = new byte?[] { 0x3A, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x2E, 0x49, 0x4E, 0x00, 0x43, 0x3A, 0x5C, 0x5C, 0x4E, 0x4F, 0x4D, 0x4F, 0x55, 0x53, 0x45, 0x2E, 0x53, 0x50 }; if (fileContent.FirstPosition(check, out position)) return "LaserLock 3" + (includePosition ? $" (Index {position})" : string.Empty); // "LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK" + (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3" - check = new byte[] { 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x49, 0x4E, 0x49, 0x54, 0x0C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x52, 0x55, 0x4E, 0x0E, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x32, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x33 }; + check = new byte?[] { 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x49, 0x4E, 0x49, 0x54, 0x0C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x52, 0x55, 0x4E, 0x0E, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x32, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x33 }; if (fileContent.FirstPosition(check, out position)) return "LaserLock 5" + (includePosition ? $" (Index {position})" : string.Empty); @@ -85,7 +85,7 @@ namespace BurnOutSharp.ProtectionType private static string GetBuild(byte[] fileContent, bool versionTwo) { // "Unkown" + (char)0x00 + "Unkown" // TODO: Is this supposed to be "Unknown"? - byte[] check = new byte[] { 0x55, 0x6E, 0x6B, 0x6F, 0x77, 0x6E, 0x00, 0x55, 0x6E, 0x6B, 0x6F, 0x77, 0x6E }; + byte?[] check = new byte?[] { 0x55, 0x6E, 0x6B, 0x6F, 0x77, 0x6E, 0x00, 0x55, 0x6E, 0x6B, 0x6F, 0x77, 0x6E }; fileContent.FirstPosition(check, out int position); string year, month, day; if (versionTwo) diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs index 596ec153..04f4b581 100644 --- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs +++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs @@ -11,12 +11,12 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // Cd3Ctl - byte[] check = new byte[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }; + byte?[] check = new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }; if (fileContent.FirstPosition(check, out int position)) return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty); // DllInstallSbcp - check = new byte[] { 0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 }; + check = new byte?[] { 0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 }; if (fileContent.FirstPosition(check, out position)) return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs index b8bd92f1..ad63d115 100644 --- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -6,7 +6,7 @@ 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 }; + 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.FirstPosition(check, out int position)) return $"EA CdKey Registration Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs index 0c43b36c..5438bbc2 100644 --- a/BurnOutSharp/ProtectionType/Origin.cs +++ b/BurnOutSharp/ProtectionType/Origin.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // O + (char)0x00 + r + (char)0x00 + i + (char)0x00 + g + (char)0x00 + i + (char)0x00 + n + (char)0x00 + S + (char)0x00 + e + (char)0x00 + t + (char)0x00 + u + (char)0x00 + p + (char)0x00 + . + (char)0x00 + e + (char)0x00 + x + (char)0x00 + e + (char)0x00 - byte[] check = new byte[] { 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00 }; + byte?[] check = new byte?[] { 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return "Origin" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs index 07839791..28db69ae 100644 --- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs +++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs @@ -8,12 +8,12 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // " SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690" - byte[] check = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x41, 0x54, 0x45, 0x44, 0x5C, 0x6E, 0x43, 0x4F, 0x4E, 0x53, 0x4F, 0x4C, 0x45, 0x20, 0x4D, 0x41, 0x59, 0x20, 0x48, 0x41, 0x56, 0x45, 0x20, 0x42, 0x45, 0x45, 0x4E, 0x20, 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5C, 0x6E, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x31, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x37, 0x38, 0x30, 0x2D, 0x37, 0x36, 0x39, 0x30 }; + byte?[] check = new byte?[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x41, 0x54, 0x45, 0x44, 0x5C, 0x6E, 0x43, 0x4F, 0x4E, 0x53, 0x4F, 0x4C, 0x45, 0x20, 0x4D, 0x41, 0x59, 0x20, 0x48, 0x41, 0x56, 0x45, 0x20, 0x42, 0x45, 0x45, 0x4E, 0x20, 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5C, 0x6E, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x31, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x37, 0x38, 0x30, 0x2D, 0x37, 0x36, 0x39, 0x30 }; if (fileContent.FirstPosition(check, out int position)) return $"PlayStation Anti-modchip (English)" + (includePosition ? $"(Index {position})" : string.Empty); // "強制終了しました。\n本体が改造されている\nおそれがあります。" - check = new byte[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, 0x30, 0x02, 0x5C, 0x6E, 0x67, 0x2C, 0x4F, 0x53, 0x30, 0x4C, 0x65, 0x39, 0x90, 0x20, 0x30, 0x55, 0x30, 0x8C, 0x30, 0x66, 0x30, 0x44, 0x30, 0x8B, 0x5C, 0x6E, 0x30, 0x4A, 0x30, 0x5D, 0x30, 0x8C, 0x30, 0x4C, 0x30, 0x42, 0x30, 0x8A, 0x30, 0x7E, 0x30, 0x59, 0x30, 0x02 }; + check = new byte?[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, 0x30, 0x02, 0x5C, 0x6E, 0x67, 0x2C, 0x4F, 0x53, 0x30, 0x4C, 0x65, 0x39, 0x90, 0x20, 0x30, 0x55, 0x30, 0x8C, 0x30, 0x66, 0x30, 0x44, 0x30, 0x8B, 0x5C, 0x6E, 0x30, 0x4A, 0x30, 0x5D, 0x30, 0x8C, 0x30, 0x4C, 0x30, 0x42, 0x30, 0x8A, 0x30, 0x7E, 0x30, 0x59, 0x30, 0x02 }; if (fileContent.FirstPosition(check, out position)) return $"PlayStation Anti-modchip (Japanese)" + (includePosition ? $"(Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index f72c1404..3ba011b6 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -12,7 +12,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "HúMETINF" - byte[] check = new byte[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 }; + byte?[] check = new byte?[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 }; if (fileContent.FirstPosition(check, out int position)) { string version = SearchProtectDiscVersion(file, fileContent); @@ -32,7 +32,7 @@ namespace BurnOutSharp.ProtectionType } // "ACE-PCD" - check = new byte[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }; + check = new byte?[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }; if (fileContent.FirstPosition(check, out position)) { string version = SearchProtectDiscVersion(file, fileContent); diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index 6d8cb52d..5735d362 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -7,7 +7,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // (char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 - byte[] check = new byte[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 }; + byte?[] check = new byte?[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return "Ring PROTECH [Check disc for physical ring]" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs index 47e562f7..6d93328b 100644 --- a/BurnOutSharp/ProtectionType/SVKProtector.cs +++ b/BurnOutSharp/ProtectionType/SVKProtector.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "?SVKP" + (char)0x00 + (char)0x00 - byte[] check = new byte[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }; + byte?[] check = new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return "SVK Protector" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index e5dc55b0..9c2554aa 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -13,11 +13,11 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "BoG_ *90.0&!! Yy>" - byte[] check = new byte[] { 0x42, 0x6F, 0x47, 0x5F, 0x20, 0x2A, 0x39, 0x30, 0x2E, 0x30, 0x26, 0x21, 0x21, 0x20, 0x20, 0x59, 0x79, 0x3E }; + byte?[] check = new byte?[] { 0x42, 0x6F, 0x47, 0x5F, 0x20, 0x2A, 0x39, 0x30, 0x2E, 0x30, 0x26, 0x21, 0x21, 0x20, 0x20, 0x59, 0x79, 0x3E }; if (fileContent.FirstPosition(check, out int position)) { // "product activation library" - byte[] check2 = new byte[] { 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x6C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79 }; + byte?[] check2 = new byte?[] { 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x6C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79 }; if (fileContent.FirstPosition(check2, out int position2)) return $"SafeCast {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); else @@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType } // (char)0x00 + (char)0x00 + "BoG_" - check = new byte[] { 0x00, 0x00, 0x42, 0x6F, 0x47, 0x5F }; + check = new byte?[] { 0x00, 0x00, 0x42, 0x6F, 0x47, 0x5F }; if (fileContent.FirstPosition(check, out position)) { string version = SearchSafeDiscVersion(file, fileContent); @@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType } // "stxt774" - check = new byte[] { 0x73, 0x74, 0x78, 0x74, 0x37, 0x37, 0x34 }; + check = new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x37, 0x37, 0x34 }; if (fileContent.FirstPosition(check, out position)) { string version = SearchSafeDiscVersion(file, fileContent); @@ -47,7 +47,7 @@ namespace BurnOutSharp.ProtectionType } // "stxt371" - check = new byte[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }; + check = new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }; if (fileContent.FirstPosition(check, out position)) { string version = SearchSafeDiscVersion(file, fileContent); diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 2805c8af..1cfcbf81 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "SafeLock" - byte[] check = new byte[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }; + byte?[] check = new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }; if (fileContent.FirstPosition(check, out int position)) return "SafeLock" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index 9bba5e4c..e9eebc82 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -12,37 +12,37 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "AddD" + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00) - byte[] check = new byte[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }; + byte?[] check = new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return $"SecuROM {GetV4Version(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); // (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03 - check = new byte[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }; + check = new byte?[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }; if (fileContent.FirstPosition(check, out position)) return $"SecuROM {GetV5Version(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); // ".securom" + (char)0xE0 + (char)0xC0 - check = new byte[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D, 0xE0, 0xC0 }; + check = new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D, 0xE0, 0xC0 }; if (fileContent.FirstPosition(check, out position) && position == 0) return $"SecuROM {GetV7Version(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty); // ".securom" - check = new byte[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }; + check = new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }; if (fileContent.FirstPosition(check, out position)) return $"SecuROM {GetV7Version(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty); // "_and_play.dll" + (char)0x00 + "drm_pagui_doit" - check = new byte[] { 0x5F, 0x61, 0x6E, 0x64, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x64, 0x72, 0x6D, 0x5F, 0x70, 0x61, 0x67, 0x75, 0x69, 0x5F, 0x64, 0x6F, 0x69, 0x74 }; + check = new byte?[] { 0x5F, 0x61, 0x6E, 0x64, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x64, 0x72, 0x6D, 0x5F, 0x70, 0x61, 0x67, 0x75, 0x69, 0x5F, 0x64, 0x6F, 0x69, 0x74 }; if (fileContent.FirstPosition(check, out position)) return $"SecuROM Product Activation {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // ".cms_t" + (char)0x00 - check = new byte[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }; + check = new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "SecuROM 1-3" + (includePosition ? $" (Index {position})" : string.Empty); // ".cms_d" + (char)0x00 - check = new byte[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }; + check = new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "SecuROM 1-3" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index 3acdca31..f80dfbbc 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // BITARTS - byte[] check = new byte[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }; + byte?[] check = new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }; if (fileContent.FirstPosition(check, out int position)) return "SmartE" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 9f34a78a..93af43a6 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -12,12 +12,12 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "D" + (char)0x00 + "V" + (char)0x00 + "M" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y" - byte[] check = new byte[] { 0x44, 0x00, 0x56, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; + byte?[] check = new byte?[] { 0x44, 0x00, 0x56, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; if (fileContent.FirstPosition(check, out int position)) return $"SolidShield {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // "S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00 + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y" - check = new byte[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; + check = new byte?[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; if (fileContent.FirstPosition(check, out position)) { string companyName = string.Empty; @@ -29,7 +29,7 @@ namespace BurnOutSharp.ProtectionType } // "S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00 + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00 + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y" - check = new byte[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; + check = new byte?[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 }; if (fileContent.FirstPosition(check, out position)) { string companyName = string.Empty; @@ -41,7 +41,7 @@ namespace BurnOutSharp.ProtectionType } // (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE - check = new byte[] { }; + check = new byte?[] { }; if (fileContent.FirstPosition(check, out position)) { var id1 = new ArraySegment(fileContent, position + 5, 3); @@ -54,7 +54,7 @@ namespace BurnOutSharp.ProtectionType } // "A" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "v" + (char)0x00 + "a" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00 + "M" + (char)0x00 + "a" + (char)0x00 + "n" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "r" - check = new byte[] { 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72 }; + check = new byte?[] { 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72 }; if (fileContent.FirstPosition(check, out position)) { string companyName = string.Empty; @@ -66,12 +66,12 @@ namespace BurnOutSharp.ProtectionType } // dvm.dll - check = new byte[] { 0x64, 0x76, 0x6D, 0x2E, 0x64, 0x6C, 0x6C }; + check = new byte?[] { 0x64, 0x76, 0x6D, 0x2E, 0x64, 0x6C, 0x6C }; if (fileContent.FirstPosition(check, out position)) return $"SolidShield EXE Wrapper" + (includePosition ? $" (Index {position})" : string.Empty); // (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA - check = new byte[] { 0xAD, 0xDE, 0xFE, 0xCA }; + check = new byte?[] { 0xAD, 0xDE, 0xFE, 0xCA }; if (fileContent.FirstPosition(check, out position)) { var id1 = new ArraySegment(fileContent, position + 4, 3); @@ -87,7 +87,7 @@ namespace BurnOutSharp.ProtectionType && id2.SequenceEqual(new byte[] { 0x00, 0x00, 0x00, 0x00 })) { // "T" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "s" + (char)0x00 + "S" + (char)0x00 + "e" + (char)0x00 + "t" + (char)0x00 + "u" + (char)0x00 + "p" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "0" + (char)0x00 + (char)0x8 + (char)0x00 + (char)0x1 + (char)0x0 + "F" + (char)0x00 + "i" + (char)0x00 + "l" + (char)0x00 + "e" + (char)0x00 + "V" + (char)0x00 + "e" + (char)0x00 + "r" + (char)0x00 + "s" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 - byte[] check2 = new byte[] { 0x54, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x74, 0x75, 0x70, 0x30, 0x08, 0x01, 0x00, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00 }; + byte?[] check2 = new byte?[] { 0x54, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x74, 0x75, 0x70, 0x30, 0x08, 0x01, 0x00, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00 }; if (fileContent.FirstPosition(check2, out int position2)) { position2--; // TODO: Verify this subtract @@ -101,12 +101,12 @@ namespace BurnOutSharp.ProtectionType } // "Solidshield" - check = new byte[] { 0x53, 0x6F, 0x6C, 0x69, 0x64, 0x73, 0x68, 0x69, 0x65, 0x6C, 0x64 }; + check = new byte?[] { 0x53, 0x6F, 0x6C, 0x69, 0x64, 0x73, 0x68, 0x69, 0x65, 0x6C, 0x64 }; if (fileContent.FirstPosition(check, out position)) return $"SolidShield {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); // "B" + (char)0x00 + "I" + (char)0x00 + "N" + (char)0x00 + (char)0x7 + (char)0x00 + "I" + (char)0x00 + "D" + (char)0x00 + "R" + (char)0x00 + "_" + (char)0x00 + "S" + (char)0x00 + "G" + (char)0x00 + "T" + (char)0x0 - check = new byte[] { 0x42, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x07, 0x00, 0x49, 0x00, 0x44, 0x00, 0x52, 0x00, 0x5F, 0x00, 0x53, 0x00, 0x47, 0x00, 0x54, 0x00 }; + check = new byte?[] { 0x42, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x07, 0x00, 0x49, 0x00, 0x44, 0x00, 0x52, 0x00, 0x5F, 0x00, 0x53, 0x00, 0x47, 0x00, 0x54, 0x00 }; if (fileContent.FirstPosition(check, out position)) return "SolidShield" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 85ccaaa8..d8dc79ff 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -11,17 +11,17 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "(" + (char)0x00 + "c" + (char)0x00 + ")" + (char)0x00 + " " + (char)0x00 + "P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00 + "T" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "h" + (char)0x00 + "n" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "o" + (char)0x00 + "g" + (char)0x00 + "y" + (char)0x00 - byte[] check = new byte[] { 0x28, 0x00, 0x63, 0x00, 0x29, 0x00, 0x20, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x54, 0x00, 0x65, 0x00, 0x63, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x79, 0x00 }; + byte?[] check = new byte?[] { 0x28, 0x00, 0x63, 0x00, 0x29, 0x00, 0x20, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x54, 0x00, 0x65, 0x00, 0x63, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x79, 0x00 }; if (fileContent.FirstPosition(check, out int position)) { // "PSA_GetDiscLabel" - // byte[] check2 = new byte[] { 0x50, 0x53, 0x41, 0x5F, 0x47, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x4C, 0x61, 0x62, 0x65, 0x6C }; + // byte?[] check2 = new byte?[] { 0x50, 0x53, 0x41, 0x5F, 0x47, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x4C, 0x61, 0x62, 0x65, 0x6C }; // "(c) Protection Technology" - // byte[] check2 = new byte[] { 0x28, 0x63, 0x29, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79 }; + // byte?[] check2 = new byte?[] { 0x28, 0x63, 0x29, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79 }; // "TradeName" - byte[] check2 = new byte[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 }; + byte?[] check2 = new byte?[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 }; if (fileContent.FirstPosition(check2, out int position2) && position2 != 0) return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)})" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); else @@ -29,17 +29,17 @@ namespace BurnOutSharp.ProtectionType } // "Protection Technology, Ltd." - check = new byte[] { 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79, 0x2C, 0x20, 0x4C, 0x74, 0x64, 0x2E }; + check = new byte?[] { 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79, 0x2C, 0x20, 0x4C, 0x74, 0x64, 0x2E }; if (fileContent.FirstPosition(check, out position)) { // "PSA_GetDiscLabel" - // byte[] check2 = new byte[] { 0x50, 0x53, 0x41, 0x5F, 0x47, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x4C, 0x61, 0x62, 0x65, 0x6C }; + // byte?[] check2 = new byte?[] { 0x50, 0x53, 0x41, 0x5F, 0x47, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x4C, 0x61, 0x62, 0x65, 0x6C }; // "(c) Protection Technology" - // byte[] check2 = new byte[] { 0x28, 0x63, 0x29, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79 }; + // byte?[] check2 = new byte?[] { 0x28, 0x63, 0x29, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x79 }; // "TradeName" - byte[] check2 = new byte[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 }; + byte?[] check2 = new byte?[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 }; if (fileContent.FirstPosition(check2, out int position2) && position2 != 0) return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)})" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); else @@ -47,17 +47,17 @@ namespace BurnOutSharp.ProtectionType } // ".sforce" - check = new byte[] { 0x2E, 0x73, 0x66, 0x6F, 0x72, 0x63, 0x65 }; + check = new byte?[] { 0x2E, 0x73, 0x66, 0x6F, 0x72, 0x63, 0x65 }; if (fileContent.FirstPosition(check, out position)) return "StarForce 3-5" + (includePosition ? $" (Index {position})" : string.Empty); // ".brick" - check = new byte[] { 0x2E, 0x62, 0x72, 0x69, 0x63, 0x6B }; + check = new byte?[] { 0x2E, 0x62, 0x72, 0x69, 0x63, 0x6B }; if (fileContent.FirstPosition(check, out position)) return "StarForce 3-5" + (includePosition ? $" (Index {position})" : string.Empty); // "P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "M" + (char)0x00 + "o" + (char)0x00 + "d" + (char)0x00 + "u" + (char)0x00 + "l" + (char)0x00 + "e" - check = new byte[] { 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x65 }; + check = new byte?[] { 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x65 }; if (fileContent.FirstPosition(check, out position)) return "StarForce 5" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index 8ce61f95..c96d9cb9 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -6,12 +6,12 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "V SUHPISYSDVD" - byte[] check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 }; + byte?[] check = new byte?[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 }; if (fileContent.FirstPosition(check, out int position)) return $"Sysiphus DVD {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); // "V SUHPISYS" - check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53 }; + check = new byte?[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53 }; if (fileContent.FirstPosition(check, out position)) return $"Sysiphus {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index 191db74e..2aafcac6 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -11,17 +11,17 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "protected-tages-runtime.exe" - byte[] check = new byte[] { 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2D, 0x74, 0x61, 0x67, 0x65, 0x73, 0x2D, 0x72, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x65, 0x78, 0x65 }; + byte?[] check = new byte?[] { 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2D, 0x74, 0x61, 0x67, 0x65, 0x73, 0x2D, 0x72, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x65, 0x78, 0x65 }; if (fileContent.FirstPosition(check, out int position)) return $"TAGES {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // "tagesprotection.com" - check = new byte[] { 0x74, 0x61, 0x67, 0x65, 0x73, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6D }; + check = new byte?[] { 0x74, 0x61, 0x67, 0x65, 0x73, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6D }; if (fileContent.FirstPosition(check, out position)) return $"TAGES {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty); // (char)0xE8 + "u" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8 - check = new byte[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }; + check = new byte?[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }; if (fileContent.FirstPosition(check, out position)) { // (char)0xFF + (char)0xFF + "h" diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index b5738f93..cfa8149f 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -6,18 +6,18 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // .ldr - byte[] check = new byte[] { 0x2E, 0x6C, 0x64, 0x72 }; + byte?[] check = new byte?[] { 0x2E, 0x6C, 0x64, 0x72 }; if (fileContent.FirstPosition(check, out int position)) { // .ldt - byte[] check2 = new byte[] { 0x2E, 0x6C, 0x64, 0x74 }; + byte?[] check2 = new byte?[] { 0x2E, 0x6C, 0x64, 0x74 }; if (fileContent.FirstPosition(check2, out int position2)) return "3PLock" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); } // This produced false positives in some DirectX 9.0c installer files // "Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW" - //check = new byte[] { 0x59, 0xC3, 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x30, 0x53, 0x56, 0x57 }; + //check = new byte?[] { 0x59, 0xC3, 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x30, 0x53, 0x56, 0x57 }; //if (fileContent.Contains(check, out position)) // return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs index 151a26ab..30c5398a 100644 --- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs +++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // 3 + (char)0x00 + 1 + 2 + (char)0x00 + 1 + (char)0x00 + S + (char)0x00 + t + (char)0x00 + u + (char)0x00 + d + (char)0x00 + i + (char)0x00 + o + (char)0x00 + s + (char)0x00 + + (char)0x00 + A + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + v + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 - byte[] check = new byte[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 }; + byte?[] check = new byte?[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 }; if (fileContent.FirstPosition(check, out int position)) return "321Studios Online Activation" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs index 6f6148ed..3ea53fec 100644 --- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs +++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs @@ -13,12 +13,12 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "VOB ProtectCD" - byte[] check = new byte[] { 0x56, 0x4F, 0x42, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x43, 0x44 }; + byte?[] check = new byte?[] { 0x56, 0x4F, 0x42, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x43, 0x44 }; if (fileContent.FirstPosition(check, out int position)) return $"VOB ProtectCD/DVD {GetOldVersion(fileContent, --position)}" + (includePosition ? $" (Index {position})" : string.Empty); // TODO: Verify this subtract // "DCP-BOV" + (char)0x00 + (char)0x00 - check = new byte[] { 0x44, 0x43, 0x50, 0x2D, 0x42, 0x4F, 0x56, 0x00, 0x00 }; + check = new byte?[] { 0x44, 0x43, 0x50, 0x2D, 0x42, 0x4F, 0x56, 0x00, 0x00 }; if (fileContent.FirstPosition(check, out position)) { string version = GetVersion(fileContent, --position); // TODO: Verify this subtract @@ -38,7 +38,7 @@ namespace BurnOutSharp.ProtectionType } // ".vob.pcd" - check = new byte[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }; + check = new byte?[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }; if (fileContent.FirstPosition(check, out position)) return "VOB ProtectCD" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index d4039bfc..9b92d2ac 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "WTM76545" - byte[] check = new byte[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }; + byte?[] check = new byte?[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }; if (fileContent.FirstPosition(check, out int position)) return "WTM CD Protect" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index 214b8cc6..10bcc4ed 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -12,17 +12,17 @@ namespace BurnOutSharp.ProtectionType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // XCP.DAT - byte[] check = new byte[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }; + byte?[] check = new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }; if (fileContent.FirstPosition(check, out int position)) return "XCP" + (includePosition ? $" (Index {position})" : string.Empty); // XCPPlugins.dll - check = new byte[] { 0x58, 0x43, 0x50, 0x50, 0x6C, 0x75, 0x67, 0x69, 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }; + check = new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x6C, 0x75, 0x67, 0x69, 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }; if (fileContent.FirstPosition(check, out position)) return "XCP" + (includePosition ? $" (Index {position})" : string.Empty); // XCPPhoenix.dll - check = new byte[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C }; + check = new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C }; if (fileContent.FirstPosition(check, out position)) return "XCP" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs index 2eb3f085..dfda0d8e 100644 --- a/BurnOutSharp/ProtectionType/XtremeProtector.cs +++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs @@ -6,7 +6,7 @@ public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // "XPROT " - byte[] check = new byte[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }; + byte?[] check = new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }; if (fileContent.FirstPosition(check, out int position)) return "Xtreme-Protector" + (includePosition ? $" (Index {position})" : string.Empty); diff --git a/BurnOutSharp/Utilities.cs b/BurnOutSharp/Utilities.cs index 3434194a..05d39dbc 100644 --- a/BurnOutSharp/Utilities.cs +++ b/BurnOutSharp/Utilities.cs @@ -159,7 +159,7 @@ namespace BurnOutSharp /// /// Find the first position of one array in another, if possible /// - public static bool FirstPosition(this byte[] stack, byte[] needle, out int position, int start = 0, int end = -1) + public static bool FirstPosition(this byte[] stack, byte?[] needle, out int position, int start = 0, int end = -1) { (bool found, int foundPosition) = FindPosition(stack, needle, start, end, false); position = foundPosition; @@ -169,7 +169,7 @@ namespace BurnOutSharp /// /// Find the last position of one array in another, if possible /// - public static bool LastPosition(this byte[] stack, byte[] needle, out int position, int start = 0, int end = -1) + public static bool LastPosition(this byte[] stack, byte?[] needle, out int position, int start = 0, int end = -1) { (bool found, int foundPosition) = FindPosition(stack, needle, start, end, true); position = foundPosition; @@ -179,7 +179,7 @@ namespace BurnOutSharp /// /// See if a byte array starts with another /// - public static bool StartsWith(this byte[] stack, byte[] needle) + public static bool StartsWith(this byte[] stack, byte?[] needle) { return stack.FirstPosition(needle, out int _, start: 0, end: 1); } @@ -187,15 +187,15 @@ namespace BurnOutSharp /// /// See if a byte array ends with another /// - public static bool EndsWith(this byte[] stack, byte[] needle) + public static bool EndsWith(this byte[] stack, byte?[] needle) { return stack.FirstPosition(needle, out int _, start: stack.Length - needle.Length); } - + /// /// Find the position of one array in another, if possible /// - private static (bool, int) FindPosition(byte[] stack, byte[] needle, int start, int end, bool reverse) + private static (bool, int) FindPosition(byte[] stack, byte?[] needle, int start, int end, bool reverse) { // If either array is null or empty, we can't do anything if (stack == null || stack.Length == 0 || needle == null || needle.Length == 0) @@ -223,7 +223,7 @@ namespace BurnOutSharp /// /// Get if a stack at a certain index is equal to a needle /// - private static bool EqualAt(this byte[] stack, byte[] needle, int index) + private static bool EqualAt(this byte[] stack, byte?[] needle, int index) { // If we're too close to the end of the stack, return false if (needle.Length >= stack.Length - index) @@ -231,7 +231,10 @@ namespace BurnOutSharp for (int i = 0; i < needle.Length; i++) { - if (stack[i + index] != needle[i]) + // A null value is a wildcard + if (needle[i] == null) + continue; + else if (stack[i + index] != needle[i]) return false; } @@ -240,6 +243,8 @@ namespace BurnOutSharp #endregion + #region Version Finding + /// /// Get the file version as reported by the filesystem /// @@ -264,12 +269,12 @@ namespace BurnOutSharp public static string GetManifestVersion(byte[] fileContent) { // - byte[] manifestEnd = new byte[] { 0x3C, 0x2F, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x3E }; + byte?[] manifestEnd = new byte?[] { 0x3C, 0x2F, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x3E }; if (!fileContent.FirstPosition(manifestEnd, out int manifestEndPosition, start: manifestStartPosition)) return null; @@ -306,5 +311,7 @@ namespace BurnOutSharp return null; } } + + #endregion } }