mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Workaround for module path limitations of global hooks
https://learn.microsoft.com/en-us/archive/blogs/alejacma/setwindowshookex-fails-with-error-error_mod_not_found
This commit is contained in:
parent
6c7882bb6e
commit
2f52e1028b
@ -235,8 +235,7 @@ namespace
|
|||||||
{
|
{
|
||||||
UnhookWindowsHookEx(g_keyboardHook);
|
UnhookWindowsHookEx(g_keyboardHook);
|
||||||
}
|
}
|
||||||
g_keyboardHook = CALL_ORIG_FUNC(SetWindowsHookExA)(
|
g_keyboardHook = CALL_ORIG_FUNC(SetWindowsHookExA)(WH_KEYBOARD_LL, &lowLevelKeyboardProc, nullptr, 0);
|
||||||
WH_KEYBOARD_LL, &lowLevelKeyboardProc, Dll::g_currentModule, 0);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,8 +249,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_origCursorPos = { MAXLONG, MAXLONG };
|
g_origCursorPos = { MAXLONG, MAXLONG };
|
||||||
g_mouseHook = CALL_ORIG_FUNC(SetWindowsHookExA)(
|
g_mouseHook = CALL_ORIG_FUNC(SetWindowsHookExA)(WH_MOUSE_LL, &lowLevelMouseProc, nullptr, 0);
|
||||||
WH_MOUSE_LL, &lowLevelMouseProc, Dll::g_currentModule, 0);
|
|
||||||
|
|
||||||
INPUT inputs[2] = {};
|
INPUT inputs[2] = {};
|
||||||
inputs[0].mi.dy = 1;
|
inputs[0].mi.dy = 1;
|
||||||
@ -284,7 +282,8 @@ namespace
|
|||||||
// Disable the IgnoreAltTab shim
|
// Disable the IgnoreAltTab shim
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if (WH_MOUSE_LL == idHook &&
|
|
||||||
|
if (WH_MOUSE_LL == idHook &&
|
||||||
(0 == _stricmp(moduleName.c_str(), "dinput") || 0 == _stricmp(moduleName.c_str(), "dinput8")))
|
(0 == _stricmp(moduleName.c_str(), "dinput") || 0 == _stricmp(moduleName.c_str(), "dinput8")))
|
||||||
{
|
{
|
||||||
g_dinputMouseHookData.origHookProc = lpfn;
|
g_dinputMouseHookData.origHookProc = lpfn;
|
||||||
@ -296,6 +295,8 @@ namespace
|
|||||||
lpfn = dinputLowLevelMouseProc;
|
lpfn = dinputLowLevelMouseProc;
|
||||||
Compat::hookIatFunction(hmod, "CallNextHookEx", dinputCallNextHookEx);
|
Compat::hookIatFunction(hmod, "CallNextHookEx", dinputCallNextHookEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hmod = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HHOOK result = origSetWindowsHookEx(idHook, lpfn, hmod, dwThreadId);
|
HHOOK result = origSetWindowsHookEx(idHook, lpfn, hmod, dwThreadId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user