/// <summary> /// Finds a game process with a known engine.dll. /// </summary> Process GetGameProcess(out IntPtr curMapPtr, out IntPtr curTimePtr, out IntPtr signOnStatePtr) { string[] procs = GameProcesses.Select(x => x.ToLower().Replace(".exe", String.Empty)).ToArray(); Process p = Process.GetProcesses().FirstOrDefault(x => procs.Contains(x.ProcessName.ToLower())); if (p != null && !p.HasExited && !IsVACProtectedProcess(p)) { ProcessModuleEx engine = GetProcessModules(p).FirstOrDefault(x => x.ModuleName.ToLower() == "engine.dll"); if (engine != null) { var scanner = new SignatureScanner(p, engine.BaseAddress, engine.ModuleMemorySize); curMapPtr = scanner.Scan(_curMapTarget); curTimePtr = scanner.Scan(_curTimeTarget); signOnStatePtr = scanner.Scan(_signOnStateTarget1); if (signOnStatePtr == IntPtr.Zero) { signOnStatePtr = scanner.Scan(_signOnStateTarget2); } if (curMapPtr != IntPtr.Zero && curTimePtr != IntPtr.Zero && signOnStatePtr != IntPtr.Zero) { return(p); } } Debug.WriteLine("Invalid process or unknown engine.dll"); } curMapPtr = curTimePtr = signOnStatePtr = IntPtr.Zero; return(null); }
/// <summary> /// Finds a game process with a known engine.dll. /// </summary> Process GetGameProcess(out IntPtr curMapPtr, out IntPtr curTimePtr, out IntPtr signOnStatePtr) { string[] procs = GameProcesses.Select(x => x.ToLower().Replace(".exe", String.Empty)).ToArray(); Process p = Process.GetProcesses().FirstOrDefault(x => procs.Contains(x.ProcessName.ToLower())); if (p != null && !p.HasExited && !IsVACProtectedProcess(p)) { ProcessModuleEx engine = GetProcessModules(p).FirstOrDefault(x => x.ModuleName.ToLower() == "engine.dll"); if (engine != null) { var scanner = new SignatureScanner(p, engine.BaseAddress, engine.ModuleMemorySize); curMapPtr = scanner.Scan(_curMapTarget); curTimePtr = scanner.Scan(_curTimeTarget); signOnStatePtr = scanner.Scan(_signOnStateTarget1); if (signOnStatePtr == IntPtr.Zero) signOnStatePtr = scanner.Scan(_signOnStateTarget2); if (curMapPtr != IntPtr.Zero && curTimePtr != IntPtr.Zero && signOnStatePtr != IntPtr.Zero) return p; } Debug.WriteLine("Invalid process or unknown engine.dll"); } curMapPtr = curTimePtr = signOnStatePtr = IntPtr.Zero; return null; }