locked
Reading/Writing Reports From An HID Keyboard/Mouse RRS feed

  • Question

  • Hello all.  As part of a bigger cross-platform API family I've been developing for the past 6 years, i'm in the process of developing an HID API module.  Unfortunately, on Windows, I'm unable to open an HID keyboardor mouse device using CreateFile() With GENERIC_READ permissions.  This is due to Windows acquiring an exclusive file lock on the keyboard and mouse devices from what I understand.  On other platforms (Linux, Android, Mac, iOS) supported by my API, i'm able to directly read and write data to these devices using HID reports.  It is crucial for my HID module to be able to read/write reports to/from all HID devices including keyboards and mice.  Is there any possible way for me to accomplish this?  My current dev environment is aWindows 8.1 Desktop, Visual Studio 2013 Ultimate, and C/C++.  Thank you very much for your time and effort.
    Tuesday, April 14, 2015 4:11 PM

Answers

  • the security for keyboards and mice is handled above the keyboard and mouse drivers. you could write a class filter driver that circumvented the security measures that are in place, it would be rather complicated though.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Richmar1 Tuesday, April 14, 2015 8:09 PM
    Tuesday, April 14, 2015 8:03 PM

All replies

  • There is no way on windows to do this for keyboards and mice. they are considered part of TCB and are thus secured devices. 

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Doron Holan [MSFT] Tuesday, April 14, 2015 6:03 PM
    • Unmarked as answer by Richmar1 Tuesday, April 14, 2015 8:09 PM
    Tuesday, April 14, 2015 6:03 PM
  • Thank you for that response.  That is some much needed finalization on my query.  However, when you say that it's not possible,  does that mean that i couldn't get it to work even if i wrote my own generic keyboard/mouse driver?  If it is possible by writing my own generic driver, can you please send me to the appropriate documentation where i can learn how to do this? Thanks very much for your time.

    • Edited by Richmar1 Tuesday, April 14, 2015 7:50 PM
    Tuesday, April 14, 2015 7:47 PM
  • the security for keyboards and mice is handled above the keyboard and mouse drivers. you could write a class filter driver that circumvented the security measures that are in place, it would be rather complicated though.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Richmar1 Tuesday, April 14, 2015 8:09 PM
    Tuesday, April 14, 2015 8:03 PM
  • Thank you for your response.  You have adequately answered my question.  I marked your response as the answer.  If i have any more questions about how to actually create a filter driver, i'll look here on msdn forums and/or create a new thread if needed.  Have a wonderful rest of the day my friend. :)
    Tuesday, April 14, 2015 8:12 PM