From f53d487b0db189d47d56da5a524dc5e57890f682 Mon Sep 17 00:00:00 2001 From: Diavolo Date: Tue, 27 Dec 2022 10:40:54 +0100 Subject: [PATCH] [Exception]: Fix --- src/Components/Modules/Exception.cpp | 15 +++++++++++++-- src/Components/Modules/Exception.hpp | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 5fbfb89a..f02c307b 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -116,7 +116,7 @@ namespace Components PathRemoveExtensionA(exeFileName); // Generate filename - char filenameFriendlyTime[MAX_PATH]; + char filenameFriendlyTime[MAX_PATH]{}; __time64_t time; tm ltime; _time64(&time); @@ -166,11 +166,22 @@ namespace Components } } + LPTOP_LEVEL_EXCEPTION_FILTER WINAPI Exception::SetUnhandledExceptionFilter_Stub(LPTOP_LEVEL_EXCEPTION_FILTER) + { + SetFilterHook.uninstall(); + LPTOP_LEVEL_EXCEPTION_FILTER result = ::SetUnhandledExceptionFilter(&ExceptionFilter); + SetFilterHook.install(); + return result; + } + Exception::Exception() { SetMiniDumpType(Flags::HasFlag("bigminidumps"), Flags::HasFlag("reallybigminidumps")); - SetUnhandledExceptionFilter(&ExceptionFilter); + SetFilterHook.initialize(::SetUnhandledExceptionFilter, SetUnhandledExceptionFilter_Stub, HOOK_JUMP); + SetFilterHook.install(); + + ::SetUnhandledExceptionFilter(&ExceptionFilter); Utils::Hook(0x4B241F, LongJmp_Internal_Stub, HOOK_CALL).install()->quick(); Utils::Hook(0x61DB44, LongJmp_Internal_Stub, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Exception.hpp b/src/Components/Modules/Exception.hpp index 20a5d0b7..40b5e820 100644 --- a/src/Components/Modules/Exception.hpp +++ b/src/Components/Modules/Exception.hpp @@ -19,6 +19,8 @@ namespace Components static void CopyMessageToClipboard(const std::string& error); + static LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter_Stub(LPTOP_LEVEL_EXCEPTION_FILTER); + static int MiniDumpType; static Utils::Hook SetFilterHook; };