Detecting Keyboard Hooks

2020-02-05 07:07发布

问题:

Is there a way to detect which programs or modules are listening to a keyboard hook? By Sysinternals maybe?

回答1:

This blog post has instructions: http://zairon.wordpress.com/2006/12/06/any-application-defined-hook-procedure-on-my-machine/



回答2:

It largely depends on what level of abstraction are you obtaining your key presses.
For maximum detection you could use hardware directly or go as low as possible (some hooks work at HW driver-level).

For security purposes, you could also use a virtual keyboard - hooks would have to be targeted specifically at your application to simulate key presses.



回答3:

Nope. You would likely have to hook into SetWindowsHookEx() itself in order to detect that.



回答4:

I don't think you can, there's no GetWindowsHook function that would return the hook(s). Also, I'm under the impression that the main keyboard processing routine is hooked through SetWindowsHookEx(), so even if there are no hooks, there's at least one, Windows itself.