Add hook error detection in system hooking

This commit is contained in:
Kawe Mazidjatari 2023-01-30 22:09:15 +01:00
parent 0a319971dd
commit e783309d76

View File

@ -97,7 +97,12 @@ void WinSys_Attach()
//DetourAttach(&(LPVOID&)VPeekMessageW, (PBYTE)HPeekMessage);
///////////////////////////////////////////////////////////////////////////
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);
}
#endif // DEDICATED
}