From 4630e8966754a4265645ee65aa13a6426bcba53f Mon Sep 17 00:00:00 2001 From: quaK <38787176+Joelrau@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:46:30 +0200 Subject: [PATCH] Update exception.cpp --- src/client/component/exception.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/component/exception.cpp b/src/client/component/exception.cpp index 483aca37..e293403f 100644 --- a/src/client/component/exception.cpp +++ b/src/client/component/exception.cpp @@ -136,25 +136,27 @@ namespace exception return EXCEPTION_CONTINUE_EXECUTION; } - LPTOP_LEVEL_EXCEPTION_FILTER WINAPI set_unhandled_exception_filter_stub(LPTOP_LEVEL_EXCEPTION_FILTER) + void WINAPI set_unhandled_exception_filter_stub(LPTOP_LEVEL_EXCEPTION_FILTER) { // Don't register anything here... - return &exception_filter; } } class component final : public component_interface { public: - void post_load() override + component() { SetUnhandledExceptionFilter(exception_filter); - utils::hook::jump(SetUnhandledExceptionFilter, set_unhandled_exception_filter_stub, true); } - void post_unpack() override + void post_load() override { + const utils::nt::library ntdll("ntdll.dll"); + auto* set_filter = ntdll.get_proc("RtlSetUnhandledExceptionFilter"); + set_filter(exception_filter); + utils::hook::jump(set_filter, set_unhandled_exception_filter_stub); } }; }