So as I was crafting some UMDF HID driver code for your consumption, and I was working with one of you (and you know who you are *g*) during some of that time frame, we sort of discovered everything already exists between my earlier blog posts and some of the WDK samples.  So rather than reinvent the wheel and the internal combustion engine, let’s just dump all that information in a blog post.

First up, I touched upon secure HID stacks and how to get your UMDF HID Collection Filter driver working in them and a little on how to use impersonation.  And in retrospect, the 30 second and little technical extension in that post are really all that was / is required for getting a basic driver up and running.  Make a note that not all HID stacks require secure connection, so you kind of have to do some debugging or digging around to determine those requirements for your own driver.  Sorry. :) 

The second part was to alleviate the issues with Windows session spaces in order to access some Win32 desktop APIs.  As one of the driving forces to craft a HID Collection filter in UMDF is to have access to those APIs, that session work around is vital.

The last part is proper implementation required for a secure HID stack is using IImpersonateCallback::OnImpersonate method and its invocation from the IWDFIoRequest::Impersonate method.  Turns out one of the existing samples available in the WDK has a really good implementation; src\usb\osrusbfx2\umdf\fx2_driver\impersonation\

Put all that together and you can easily craft a HID collection filter driver for the majority of HID devices. Remember though, UMDF cannot be used to filter keyboard and mouse collections.  But you can go crazy writing drivers for a load of other HID devices.

As always, feel free to ask me questions if you run in to any road blocks.

Now Playing – Rush Show Don’t Tell