Creating and removing HID reports in a completion routine

I am writing a hidusb lower filter to modify the reports a device
returns, and I can currently intercept, modify, and complete a report
from the device, but I have two cases I am unsure of how to handle.

In one case, after checking the report in the completion routine, the
driver needs to return an additional report (or reports). I believe the
proper way to do this is to complete the request with the devices report
and add the new driver generated report(s) to a queue.

This queue should then be processed in the EvtIoInternalDeviceControl
function when it receives an IOCTL_INTERNAL_USB_SUBMIT_URB of type
URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER instead of passing this request
down the stack with the usual completion routine attached.

Does this sound correct?

If so, then what I am stuck on is what to put in the transfer buffer to
return when processing the queue. What structure should it contain? It
does not appear that the HID report should start at the first byte of
this buffer.

In the other case, after checking the report in the completion routine I
need to discard it. To do this, should I fail the request, or can I pass
it back down the stack again?


Omni Flux