Hi all,
I’m writing a filter driver that sits on top of the HID stack. Right now I have been able to perform filtering in the form of processing data upon completion. Basically HID clients (user mode) open the device, the filter passes the IRP request to the lower drivers setting a completion routine. When the lower driver completes the request, the filter driver gets a chance to change the content of the request from within its completion routine.
This has been working fine so far.
I’d like to add a new level of complexity by allowing the HID filter to mask out some reports according to some rule. My question is, how would I do that? Using my current scheme it seems to me that there’s no way of doing it since the IRP coming from the IO manager has been already completed be the lower drivers. Is there any way of reverting this by resubmitting the same IRP back in the stack?
Another thing I’d want to be able to do is injecting fake reports where there aren’t really any. In this case, my filter driver should be the one to complete the READ IRP coming down from the user mode client.
So, I figured that I may need to write something like a pump that creates read IRPs and upon completion puts them in a queue or something. Then when a read IRP comes from the client the filter would complete the request using the data in the queue OR leave it pending (and complete it in the completion routine of the HID filter created read IRP).
Now my problem: the windows HID driver allows multiple clients and keeps a buffer for each one of them. If the HID filter decouples the user mode clients generated IRPs from the ones that actually get into the windows HID driver, it should basically do the buffering job too. In order to be really transparent it should then reimplement all the IOCTLs supported by the windows HID driver (like the ones that control the buffer size) and whatnot. It seems a pretty complicated job and really prone to issues.
Is it really the only way to go? Is there a simpler solution to this problem?
Thank you in advance for any help you will provide,
Stra