public static extern bool GetThreadContext(IntPtr hThread, ref CONTEXT lpContext);
public async Task Tick(string DllPath) { threadi(DllPath); if (ExecutableName == "iw5mp.exe") { while (p.hProcess == IntPtr.Zero) ; //wait process create. await Task.Delay(3000); var pi = Win32Apis.OpenProcess(0x40 | 0x20 | 8, true, (int)p.dwProcessId); if (!string.IsNullOrWhiteSpace(MPClantag)) { UIntPtr clantagptr; Win32Apis.WriteProcessMemory(pi, new IntPtr(0x1328d54), new byte[8], 8, out clantagptr); if (clantagptr != (UIntPtr)0) { Win32Apis.WriteProcessMemory(pi, new IntPtr(0x1328d54), Encoding.ASCII.GetBytes(MPClantag), (uint)MPClantag.Length, out clantagptr); } } if (!string.IsNullOrWhiteSpace(MPTitle)) { UIntPtr titleptr; Win32Apis.WriteProcessMemory(pi, new IntPtr(0x1328d35), new byte[25], 25, out titleptr); if (titleptr != (UIntPtr)0) { UIntPtr titleptr2; Win32Apis.WriteProcessMemory(pi, new IntPtr(0x1328d34), new byte[] { 0xff }, 1, out titleptr2); Win32Apis.WriteProcessMemory(pi, new IntPtr(0x1328d35), Encoding.ASCII.GetBytes(MPTitle), (uint)MPTitle.Length, out titleptr); } } Win32Apis.CloseHandle(pi); } while (true) { var context = new CONTEXT(); try { if (!Win32Apis.GetThreadContext(thread, ref context)) { mutex.Close(); return; } await Task.Delay(5000); } catch (Exception e) { try { mutex.Close(); } finally { throw e; } } } }