mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
hook _invoke_watson
This commit is contained in:
parent
00bb6254a0
commit
1bdc2dc2b2
@ -28,6 +28,13 @@ void dbg_dump_dds_blt_fast_flags(DWORD flags);
|
|||||||
void dbg_dump_dds_lock_flags(DWORD flags);
|
void dbg_dump_dds_lock_flags(DWORD flags);
|
||||||
char* dbg_mes_to_str(int id);
|
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 double g_dbg_frame_time;
|
||||||
extern DWORD g_dbg_frame_count;
|
extern DWORD g_dbg_frame_count;
|
||||||
extern LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;
|
extern LPTOP_LEVEL_EXCEPTION_FILTER g_dbg_exception_filter;
|
||||||
|
22
src/debug.c
22
src/debug.c
@ -88,6 +88,28 @@ LONG WINAPI dbg_exception_handler(EXCEPTION_POINTERS* exception)
|
|||||||
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
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
|
#endif
|
||||||
|
|
||||||
void dbg_init()
|
void dbg_init()
|
||||||
|
@ -659,8 +659,7 @@ void hook_init()
|
|||||||
|
|
||||||
if (!IsDebuggerPresent())
|
if (!IsDebuggerPresent())
|
||||||
{
|
{
|
||||||
/* Force access violation to produce a dmp file for debugging (disables watson) */
|
patch_ljmp((void*)_invoke_watson, (void*)dbg_invoke_watson);
|
||||||
PATCH_SET((void*)_invoke_watson, "\xC6\x05\x00\x00\x00\x00\x00");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user