Hello to all. I’ve started a thread with this same topic before, but a new problem arose from the offered solution in that thread. Here’s the link to the thread by the way: http://www.osronline.com/showthread.cfm?link=264351
To summarize, I’m trying to look for a way so that an HID input report does not go back to the OS; instead, I want my filter to be the last driver that the report bubbles back up to before it goes back down again. Doron Holan’s suggestion was to call ForwardRequestCompletionRoutine again from the CompletionRoutine, and that works well, except for when my filter driver is being unloaded, since it causes an infinite loop. Here’s the relevant code snippet right now:
VOID
ReadForwardRequestWithCompletionRoutine(
IN WDFREQUEST Request,
IN WDFIOTARGET Target
)
…
{
…
//
// The following funciton essentially copies the content of
// current stack location of the underlying IRP to the next one.
//
WdfRequestFormatRequestUsingCurrentType(Request);
// MJP: register ReadRequestCompletionRoutine as the read request
// completion routine
WdfRequestSetCompletionRoutine(Request,
ReadRequestCompletionRoutine,
WDF_NO_CONTEXT);
ret = WdfRequestSend(Request,
Target,
WDF_NO_SEND_OPTIONS);
if (ret == FALSE) {
status = WdfRequestGetStatus(Request);
KdPrint((“EcoPenTouchDriver: WdfRequestSend failed: 0x%x\n”, status));
WdfRequestComplete(Request, status);
}
return;
}
VOID
ReadRequestCompletionRoutine(
IN WDFREQUEST Request,
IN WDFIOTARGET Target,
PWDF_REQUEST_COMPLETION_PARAMS CompletionParams,
IN WDFCONTEXT Context
)
{
… after printing X, Y coordinates and other data …
// MJP: don’t complete OS’ request in order to not cancel touch when pen is close to screen
// MJP: send request back down insead (per Doron Holan’s advice)
// MJP: comment this out to NOT complete report back to OS
ReadForwardRequestWithCompletionRoutine(Request, WdfDeviceGetIoTarget(device));
ExitAndFree:
// MJP: uncomment this to complete report back to OS
//WdfRequestComplete(Request, CompletionParams->IoStatus.Status);
return;
}
Any ideas on how to fix this code to avoid the infinite loop upon driver unload?
Thanks!