9

I'd like to create a virtual HID device (emulate it with a driver).

It must be visible to clients that implement standard HID detection:

  • Call HidD_GetHidGuid() – Get the HID device class GUID
  • Call SetupDiGetClassDevs() – Get a handle to a set of devices which implement the HID interface
  • Call SetupDiEnumDeviceInterfaces() – For each device in the returned set of devices, obtain the interface information for all exposed HID interfaces.
  • Call SetupDiGetDeviceInterfaceDetail() – For each interface obtained in the previous call, get the detailed information block for that interface. This detailed information includes the string that can be passed to CreateFile() to open a handle to the device
  • Call SetupDiDestroyDeviceInfoList() – Free up the device information set that was obtained in the call to SetupDiGetClassDevs().

The device should also support reading, so CreateFile / ReadFile would return data supplied by me from the driver.

I don't really know where to begin, as I don't have a lot of exp. in kernel dev. :(

jsmith
  • 367
  • 1
  • 4
  • 12

3 Answers3

8

Some people have had luck with the vmulti project as a base http://code.google.com/p/vmulti/

djp
  • 636
  • 3
  • 13
2

You sholud write a driver, then use DevCon (Device Console Tool) with install option.


cmdInstall:

A variation of cmdUpdate to install a driver when there is no associated hardware. It creates a new root-enumerated device instance and associates it with a made up hardware ID specified on the command line (which should correspond to a hardware ID in the INF). This cannot be done on a remote machine or in the context of Wow64.


http://code.msdn.microsoft.com/windowshardware/DevCon-Sample-4e95d71c

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544780%28v=vs.85%29.aspx

Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
  • In that case, wont it be possible just to start a new instance of the default hid driver and then using something like libusb or usb4java to interact with the driver? – Jp Silver Aug 22 '23 at 16:25
0

see the vhidmini ddk sample driver. It was in the version 1830 DDK but is not in the latest version. alternatively the hidfake sample in Oney's book.

See http://www.microsoft.com/mspress/books/sampchap/6262.aspx