We have been trying to hook both "GetKeyState" and "GetAsyncKeyState" via the "HookApi" function and we are experiencing some weird behavior.
The hook order is : 1.GetKeyState, 2.GetAsyncKeyState , The first hook is placed fine but the second one (GetAsync..) is placed only to be immediately removed because of the "double hook" detection in the following code:
(I have confirmed that this is the case by simply debugging it and stepping into it)
The machine is Win 10 X64 bit.
Both of this API's reside in the same module. (Which is USER32.dll)
If we only hook one of them then it works fine, but the combination of both leads to the undesired behavior (The second API is hooked only to be unhooked)
Any suggestions? are we missing something?
Thanks & good day.
Hooking rules can be located here: http://help.madshi.net/HookingRules.htm6. Each API hook needs its own callback function and its own "NextHook" variable. Don't try to save code by using callback functions and/or NextHook variables twice.