Skip to main content
4 of 5
added 44 characters in body
RoraΖ
  • 12.5k
  • 4
  • 53
  • 84

Unregistering keyboard hooks by timeout expiration

I'm writing a password manager for Windows which I want to protect against keyloggers. There is a timeout of 5000 ms for keyboard hooks.

The hook procedure should process a message in less time than the data entry specified in the LowLevelHooksTimeout value in the following registry key:

HKEY_CURRENT_USER\Control Panel\Desktop

The value is in milliseconds.

(The default value of that Registry key is 5000)

Assuming a password manager running as administrator, could I suspend all programs, simulate typing a key, wait for 5 seconds and then be sure that all keyboard hooks have been disabled by Windows?

I've not found a way of unregistering all hooks via UnhookWindowsHookEx because it requires a handle that I do not have. This is why I'm resorting to unregistering them by timeout.

Thomas Weller
  • 3.4k
  • 3
  • 26
  • 40