Partager via


0 and 1 are not just numbers, they’re spaces!

Again, thanks to our intrepid explorer Ilia S. for helping uncover some more traps in the UMDF HID Collection Filter journey.

Two things to keep in mind as you’re creating your driver:

1. UMDF drivers are hosted in a Session 0 based executable on Vista and above -

- and -

2. A lot of Win32 APIs for controlling desktop and user interactions on the desktop are exclusive to user sessions (anything 1 and above) because Session 0 technically doesn’t have a desktop and is intended to be a protected space.

So those of you who are wanting / trying to get HID Collection Filter drivers running in UMDF so you can do some magic on the desktop, you will need to do some of the following:

A Session 0 overview for you with some tips, hints and tricks on how to “exit out” to user desktop sessions.

https://msdn.microsoft.com/en-us/library/bb756986.aspx

But focus more on this portion;

Leverage Windows 7, Windows Vista and Windows Server 2008 capability:

  • Use client or server mechanisms such as remote procedure call (RPC) or named pipes to communicate between services and applications.
  • Use the WTSSendMessage function to create a simple message box on the user’s desktop. This allows the service to give the user a notification and request a simple response.
  • For more complex UI, use the CreateProcessAsUser function to create a process in the user's session.
  • Explicitly choose either the Local\ or Global\ namespace for any named objects, such as events or mapped memory that the service makes available.

And a good tutorial on how to make an application using those patterns (this does require the Platform SDK)

https://msdn.microsoft.com/en-us/library/aa379010(VS.85).aspx

And finally for today, I am still working on getting you some sample code for a UMDF HID Collection Filter driver, but life decided it needed some attention last week so I’m a tad behind on that. :)

And a thank you to one of our developers, Kumar for pointing me to those Session 0 links and tips!

Now playing – Transatlantic The Whirlwind (yes, I do love my prog rock)