HookLib on Git Hub

For anyone that follows me for the technical stuff I do, I thought I’d mention I’ve put up a mouse and keyboard hook library on GitHub. It allows a developer to build an app that subscribes to global mouse and keyboard events, process them, optionally cancel them, or potentially record them (Disclaimer: I take no responsibility for the use, misuse, legal or otherwise of this code.)

For those of you interested, the project is publicly available here: http://github.com/codelogic/HookLib

-Paul

2 thoughts on “HookLib on Git Hub

  1. Hi there! I’ve enjoyed reading through your blog posts. Since you appear to be a much smarter developer than I’ll be in the near future, maybe you can help me figure something out. Maybe one of those “RECESS” days.

    I wrote a similar hook library as yours and I’ve been trying to figure out (in csharp) how to get a list of all the hooks, figure out which one’s are a keyboard hook, and if an app setting indicates that the hook is undesirable to then unhook it from the list. Basically, an anti-keylogger, now that I’ve got the keylogger.

    There’s a linked list in Windows made up of all the hooks that are “subscribed”. When Windows receives a message it processes the message through the hooks down the list. I think there’s a win API call to get the list and I was thinking I could “try”/cast each list object as a keyboard struct and look at the keycode or character. If it looks “right” then it is a keyboard hook. Since the struct has a pointer to the hook, it can be used to unhook it. What do you think?

    • Hmmm, I think it might be possible to do, do you have some sample code you’ve already been working with? Something else you might want to consider is that there are also legitimate use cases for something like this (QuickRun comes to mind, it’s an app that allows you to quickly run preconfigured scripts or programs via a global shortcut and then one or two letters, to build something like this you need to have a ‘windows global’ applications shortcut). Finding them shouldn’t be too difficult, its determining what the code that’s hooked into that event is doing that’s the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *