From 05a5ee3210620a53bdd058ba2e858e4c217980d1 Mon Sep 17 00:00:00 2001 From: 34736384 <34736384@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:47:54 -0400 Subject: [PATCH] fix pattern scan --- unlockfps_nc/Utility/ProcessUtils.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unlockfps_nc/Utility/ProcessUtils.cs b/unlockfps_nc/Utility/ProcessUtils.cs index 4f2693f..615eff9 100644 --- a/unlockfps_nc/Utility/ProcessUtils.cs +++ b/unlockfps_nc/Utility/ProcessUtils.cs @@ -72,9 +72,11 @@ public static unsafe IntPtr PatternScan(IntPtr module, string signature) { var tokens = signature.Split(' '); var patternBytes = tokens - .ToList() .Select(x => x == "?" ? (byte)0xFF : Convert.ToByte(x, 16)) .ToArray(); + var maskBytes = tokens + .Select(x => x == "?") + .ToArray(); var dosHeader = Marshal.PtrToStructure(module); var ntHeader = Marshal.PtrToStructure((IntPtr)(module.ToInt64() + dosHeader.e_lfanew)); @@ -90,7 +92,7 @@ public static unsafe IntPtr PatternScan(IntPtr module, string signature) var found = true; for (var j = 0; j < s; j++) { - if (d[j] != scanBytes[i + j] && d[j] != 0xFF) + if (d[j] != scanBytes[i + j] && !maskBytes[j]) { found = false; break;