From 5799d7492e5da8cd631bb0c6b86d119bfd255e73 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sat, 9 Nov 2019 16:33:18 -0600 Subject: [PATCH] CriticalSection now removes its message hook handler on exit --- IPA.Loader/Utilities/CriticalSection.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/IPA.Loader/Utilities/CriticalSection.cs b/IPA.Loader/Utilities/CriticalSection.cs index d27bcce0..1a3835be 100644 --- a/IPA.Loader/Utilities/CriticalSection.cs +++ b/IPA.Loader/Utilities/CriticalSection.cs @@ -18,9 +18,18 @@ namespace IPA.Utilities { Logger.log.Debug("Configuring exit handlers"); + AppDomain.CurrentDomain.ProcessExit -= Reset; + AppDomain.CurrentDomain.ProcessExit += Reset; + ResetExitHandlers(); } + private static void Reset(object sender, EventArgs e) + { + Win32.SetConsoleCtrlHandler(registeredHandler, false); + WinHttp.SetPeekMessageHook(null); + } + #region Execute section private static readonly Win32.ConsoleCtrlDelegate registeredHandler = HandleExit;