INNER CODE UNIT · C++
GetAsyncKeyState_detour
Chaoses-Ib/IbInputSimulator · Simulator/source/dllmain.cpp:44
static SHORT WINAPI GetAsyncKeyState_detour(int vKey) {
if (!hook)
return GetAsyncKeyState_real(vKey);
if constexpr (debug)
DebugOStream() << L"GetAsyncKeyState: " << vKey << ", " << main::send->get_key_state(vKey) << std::endl;
return main::send->get_key_state(vKey);
}
public:
static inline bool hook;
SendInputHook() {
hook = false;
IbDetourAttach(&GetAsyncKeyState_real, GetAsyncKeyState_detour);
IbDetourAttach(&SendInput_real, SendInput_detour);
}