none
Virtual Keyboard Device RRS feed

  • Question

  • Hi,

    I want to create a new virtual keyboard to be able to simulate key presses. The SendInput function is not enough for my purpose. I don't want to create a filter driver because, as far as I know, it requires at least one installed keyboard and my solution needs to run also when there are no keyboards (e.g.: tablets, PC with disconnected keyboards, etc.).

    I found some threads related to this subject and basing on them I created a KMDF driver with a implemented queue for IRP_MJ_INTERNAL_DEVICE_CONTROL, where the IOCTL_INTERNAL_KEYBOARD_CONNECT request is received. I'm able to retrieve CONNECT_DATA structure from IRP's buffer. The CONNECT_DATA is a pointer to kbdclass, so now it is possible to invoke KeyboardClassServiceCallback routine, that enables me to simulate key presses to kbdclass class driver.

    Unfortunately I have some problems concerning installation. When trying to install using Device Manager: Action -> Add legacy hardware, an error shows up that this driver is not compatible with system configuration. However I'm able to update existing keyboard driver with this one. Why is that? Should I write a virtual bus driver so that I could add a keyboard using installation procedure described above? I need to create a new virtual device, not update existing one. Could you give me some advise concerning this subject? Why a virtual device driver cannot receive a virtual PDO from bus driver, like in MSVAD sample?

    Another issue is that according to MSDN IOCTL_INTERNAL_KEYBOARD_CONNECT will be sent by kbdclass class driver to all instances of GUID_DEVINTERFACE_KEYBOARD device interface class. Is there also a requirement concerning device class? Could it be any device class or only KEYBOARD class (GUID_DEVCLASS_KEYBOARD)? In case of any device class, is it possible to create for example a virtual audio driver that registers GUID_DEVINTERFACE_KEYBOARD device interface so it inserts key presses to  kbdclass? I also found something about IOCTL_KEYBOARD_INSERT_DATA,  maybe this could be an alternate solution?

    Regards,
    Tomasz



    • Edited by Tomasz N Tuesday, November 27, 2012 3:11 PM
    Tuesday, November 27, 2012 3:07 PM

Answers

  • You want to create a root enumerated device, look at the devcon source for how to do this programmatically, specifically devcon install.

    the easiest route to a virtual keyboard is a hid miniport. That way you get to reuse kbdhid wholesale. Do you need to communicate with a user mode helper app in the driver?


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

    Tuesday, November 27, 2012 4:07 PM

All replies

  • You want to create a root enumerated device, look at the devcon source for how to do this programmatically, specifically devcon install.

    the easiest route to a virtual keyboard is a hid miniport. That way you get to reuse kbdhid wholesale. Do you need to communicate with a user mode helper app in the driver?


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

    Tuesday, November 27, 2012 4:07 PM
  • In case someone needs the same thing, have a look to the VMulti project:

    https://code.google.com/p/vmulti/

    It works very well.


    Simon le Lutin

    Wednesday, July 23, 2014 11:49 PM