1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

hook _invoke_watson

This commit is contained in:
FunkyFr3sh 2024-08-31 08:09:51 +02:00
parent 00bb6254a0
commit 1bdc2dc2b2
3 changed files with 30 additions and 2 deletions

View File

@ -28,6 +28,13 @@ void dbg_dump_dds_blt_fast_flags(DWORD flags);
void dbg_dump_dds_lock_flags(DWORD flags);
char* dbg_mes_to_str(int id);
__declspec(noreturn) void __cdecl dbg_invoke_watson(
_In_opt_z_ wchar_t const*,
_In_opt_z_ wchar_t const*,
_In_opt_z_ wchar_t const*,
_In_ unsigned int,
_In_ uintptr_t);
extern double g_dbg_frame_time;
extern DWORD g_dbg_frame_count;
extern LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;

View File

@ -88,6 +88,28 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
return EXCEPTION_EXECUTE_HANDLER;
}
__declspec(noreturn) void __cdecl dbg_invoke_watson(
wchar_t const* const expression,
wchar_t const* const function_name,
wchar_t const* const file_name,
unsigned int const line_number,
uintptr_t const reserved
)
{
UNREFERENCED_PARAMETER(expression);
UNREFERENCED_PARAMETER(function_name);
UNREFERENCED_PARAMETER(file_name);
UNREFERENCED_PARAMETER(line_number);
UNREFERENCED_PARAMETER(reserved);
TRACE("%s [%p]\n", __FUNCTION__, _ReturnAddress());
/* Force access violation to produce a dmp file for debugging */
*(int*)0 = 0;
TerminateProcess(GetCurrentProcess(), STATUS_INVALID_CRUNTIME_PARAMETER);
}
#endif
void dbg_init()

View File

@ -659,8 +659,7 @@ void hook_init()
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");
patch_ljmp((void*)_invoke_watson, (void*)dbg_invoke_watson);
}
}
#endif