Skip to content

Commit

Permalink
(temporary) Remove the exception handler, which can crash during non-…
Browse files Browse the repository at this point in the history
…fatal exceptions
  • Loading branch information
cademtz committed Apr 26, 2024
1 parent d1901c4 commit 7de6cdc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Base/Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define CRASHLOG_NAME "xsdk-crashlog.txt"

LONG NTAPI MyVectoredHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
static PVOID my_vectored_handler = nullptr;
//static PVOID my_vectored_handler = nullptr;
//

static std::filesystem::path module_dir;
Expand All @@ -40,7 +40,7 @@ void Base::OnDetach()
SymCleanup(GetCurrentProcess());
// TODO: Make interfaces and other memory use smart pointers, which will self-destruct automatically.
Interfaces::DestroyInterfaces();
RemoveVectoredExceptionHandler(my_vectored_handler);
//RemoveVectoredExceptionHandler(my_vectored_handler);
}

DWORD WINAPI Base::HookThread(LPVOID Args)
Expand Down Expand Up @@ -79,7 +79,7 @@ DWORD WINAPI Base::HookThread(LPVOID Args)
//SetUnhandledExceptionFilter(UnhandledFilter);

// This works, because we add a new "first" handler after all others have been set up.
my_vectored_handler = AddVectoredExceptionHandler(TRUE, MyVectoredHandler);
//my_vectored_handler = AddVectoredExceptionHandler(TRUE, MyVectoredHandler);

Netvars::GetNetvars();
CBaseHook::HookAll();
Expand Down Expand Up @@ -267,6 +267,9 @@ static const char* ExceptionDescribe(uint32_t code) {
}

static LONG NTAPI MyVectoredHandler(struct _EXCEPTION_POINTERS* info) {
// FIXME(Cade): The code in here can absolutely cause crashes, even during non-fatal exceptions.
// So ironically, this causes more crashes.
// It should be rewritten to avoid using any C/C++ runtime libraries.
std::stringstream trace;
const char* desc;
uint32_t code;
Expand Down

0 comments on commit 7de6cdc

Please sign in to comment.