Skip to content

Commit

Permalink
improve legacy build
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Sep 28, 2024
1 parent 9d43cc3 commit 561f2ba
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)

cfg_load();

#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
g_dbg_exception_handle =
AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)dbg_vectored_exception_handler);
#endif
PVOID(WINAPI * add_handler)(ULONG, PVECTORED_EXCEPTION_HANDLER) =
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "AddVectoredExceptionHandler");

if (add_handler)
{
g_dbg_exception_handle =
add_handler(1, (PVECTORED_EXCEPTION_HANDLER)dbg_vectored_exception_handler);
}

char buf[1024];

Expand Down Expand Up @@ -148,10 +152,11 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
dinput_hook_exit();
hook_exit();

#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
if (g_dbg_exception_handle)
RemoveVectoredExceptionHandler(g_dbg_exception_handle);
#endif
ULONG(WINAPI* remove_handler)(PVOID) =
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "RemoveVectoredExceptionHandler");

if (g_dbg_exception_handle && remove_handler)
remove_handler(g_dbg_exception_handle);

break;
}
Expand Down

0 comments on commit 561f2ba

Please sign in to comment.