windowskmdffilter-driver

How to properly register a completion routine for an internal device control request for a lower filter disk driver?


I'm currently writing a lower filter disk driver to capture SCSI commands, and to measure the performance of each command. Currently, my driver is capable of capturing the SCSI request, and passing it down to the next driver. However, when I tried to register a completion routine, I get the following status: 0xc0000010(STATUS_INVALID_DEVICE_REQUEST).

Working code without completion routine:

WDF_REQUEST_SEND_OPTIONS_INIT(&options, WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
WdfRequestSend(Request, Target, &options);

Failing code with completion routine:

WdfRequestFormatRequestUsingCurrentType(Request);
WdfRequestSetCompletionRoutine(Request, CompletionRoutine, CompletionContext);
WdfRequestSend(Request, Target, WDF_NO_SEND_OPTIONS);

Any help would be appreciated. Thanks.

NOTES:


Solution

  • As per this discussion on NTDEV, it turns out that if CompletionRoutine is NULL, you must use the WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET option.