From 3f2319093fee39c38d0e04108217702460315131 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 9 Dec 2022 21:54:21 -0800 Subject: [PATCH] Partially convert SolidShield to string finding --- BurnOutSharp/ProtectionType/SolidShield.cs | 41 ++++------------------ 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 0740fda1..0e8b78e1 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -77,22 +77,13 @@ namespace BurnOutSharp.ProtectionType // Search the last two available sections for (int i = (pex.SectionNames.Length >= 2 ? pex.SectionNames.Length - 2 : 0); i < pex.SectionNames.Length; i++) { - var nthSectionRaw = pex.GetSectionData(i); - if (nthSectionRaw != null) + // Get the nth section strings, if they exist + List strs = pex.GetSectionStrings(i); + if (strs != null) { - var matchers = new List - { - // Solidshield - new ContentMatchSet(new byte?[] - { - 0x53, 0x6F, 0x6C, 0x69, 0x64, 0x73, 0x68, 0x69, - 0x65, 0x6C, 0x64 - }, GetVersion, "SolidShield EXE Wrapper"), - }; - - string match = MatchUtil.GetFirstMatch(file, nthSectionRaw, matchers, includeDebug); - if (!string.IsNullOrWhiteSpace(match)) - return match; + string str = strs.FirstOrDefault(s => s.Contains("Solidshield ")); + if (str != null) + return $"SolidShield EXE Wrapper {str.Substring("Solidshield ".Length)}"; } } @@ -163,26 +154,6 @@ namespace BurnOutSharp.ProtectionType return null; } - public static string GetVersion(string file, byte[] fileContent, List positions) - { - int index = positions[0] + 12; // Begin reading after "Solidshield" - char version = (char)fileContent[index]; - index++; - index++; - char subVersion = (char)fileContent[index]; - index++; - index++; - char subSubVersion = (char)fileContent[index]; - index++; - index++; - char subSubSubVersion = (char)fileContent[index]; - - if (!char.IsNumber(version)) - return null; - - return $"{version}.{subVersion}.{subSubVersion}.{subSubSubVersion}"; - } - public static string GetVersionPlusTages(string file, byte[] fileContent, List positions) { int position = positions[0];