Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13513

Detecting Keyboard Hooks

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

Upvotes: 19

Views: 11957

Answers (4)

Jaroslav Jandek
Jaroslav Jandek

Reputation: 9563

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.

Upvotes: 1

Marc Bernier
Marc Bernier

Reputation: 2996

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.

Upvotes: 0

Remy Lebeau
Remy Lebeau

Reputation: 595712

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

Upvotes: 0

Related Questions