From 00bb6254a0d5b0ad61817210b3b744d8d4c7be8e Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sat, 31 Aug 2024 07:35:31 +0200 Subject: [PATCH] Force access violation in debug build to produce a dmp file for debugging (disables watson) --- src/hook.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hook.c b/src/hook.c index c9641f4..2889fdd 100644 --- a/src/hook.c +++ b/src/hook.c @@ -8,6 +8,7 @@ #include "dllmain.h" #include "config.h" #include "utils.h" +#include "patch.h" #include "versionhelpers.h" #ifdef _MSC_VER @@ -655,6 +656,12 @@ void hook_init() DetourUpdateThread(GetCurrentThread()); DetourAttach((PVOID*)&real_SetUnhandledExceptionFilter, (PVOID)fake_SetUnhandledExceptionFilter); DetourTransactionCommit(); + + if (!IsDebuggerPresent()) + { + /* Force access violation to produce a dmp file for debugging (disables watson) */ + PATCH_SET((void*)_invoke_watson, "\xC6\x05\x00\x00\x00\x00\x00"); + } } #endif