I am new to driver development and have been looking for a driver sample that utilizes the Virtual HID Framework (VHF).
I came across the HID Injector sample, which appears to be what I have been looking for. It has the ability to receive HID input reports from an application and relay those reports to the operation system.
What is lacking is the ability to receive an output report from the operation system and relay it back to an application.
Here is what I have done so far to add this functionality.
- I added a callback (EvtVhfAsyncOperationWriteReport) to the VHF configuration for write report reception.
This seems to be working fine. I am using a keyboard (with LED capabilities) simulator as my HID descriptor. Whenever I press the CAPS LOCK on my keyboard, I see my callback being triggered and my KdPrint statements showing the expected output report in WinDbg.
- I added a callback (EvtIoRead) to the default queue configuration to handle read requests. This callback is triggered each time an application attempts a read from the device. I also verified this to be working in WinDbg.
So, how do I relay the report that I receive in the EvtVhfAsyncOperationWriteReport callback to the EvtIoRead request callback?
I was thinking of using a manual queue. Whenever the EvtVhfAsyncOperationWriteReport is triggered, it will take the received HID Transfer Packet convert it to a WDFREQUEST and write that request to the manual queue.
Likewise, whenever the EvtIoRead is triggered, it would read the queued request from the manual queue, extract the report information and then populate the WDFREQUEST and it received with the read request and pass it back to the calling application.
Is that a reasonable approach?
Any help provided is greatly appreciated.