public static extern bool GetThreadContext(IntPtr hThread, ref CONTEXT lpContext);
/// <summary> /// The dispatcher timer_ tick. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void DispatcherTimer_Tick(object sender, EventArgs e) { if (this.initialized == false) { this.initialized = true; var t = new Thread(this.threadi); t.Start(); this.dispatcherTimer.Interval = new TimeSpan(0, 0, 5); return; } var context = new CONTEXT(); try { if (this.ExecutableName == "iw5mp_server.exe") { this.mutex.Close(); this.canclose = true; this.Close(); } if (!Win32Apis.GetThreadContext(this.thread, ref context)) { this.mutex.Close(); this.canclose = true; this.Close(); } } catch (Exception) { try { this.mutex.Close(); this.canclose = true; this.Close(); } catch (Exception) { this.canclose = true; this.Close(); } } }