From 2e6381cfc6c0093ed259312884dfcbddc526cf00 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:45:53 +0100 Subject: [PATCH] Add hook error detection in input hooking --- r5dev/windows/input.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r5dev/windows/input.cpp b/r5dev/windows/input.cpp index 4b7d8ec0..07c1ea88 100644 --- a/r5dev/windows/input.cpp +++ b/r5dev/windows/input.cpp @@ -99,7 +99,12 @@ void Input_Init() DetourAttach(&(LPVOID&)g_oShowCursor, (PBYTE)HShowCursor); /////////////////////////////////////////////////////////////////////////// - DetourTransactionCommit(); + HRESULT hr = DetourTransactionCommit(); + if (hr != NO_ERROR) + { + // Failed to hook into the process, terminate + Error(eDLL_T::COMMON, 0xBAD0C0DE, "Failed to detour process: error code = %08x\n", hr); + } } void Input_Shutdown()