I've set up a completion routine for a bulk endpoint continuous reader
using KMDF which reads data into a buffer.
If my buffer is about to overflow, I want to stop the reader until the
buffer is emptied by my application.
I'm at DISPATCH_LEVEL inside the completion routine, so I call
WdfIoTargetStop() with argument WdfIoTargetLeaveSentIoPending.
According to the docs, this is the only way it's acceptable to call
WdfIoTargetStop at IRQL <= DISPATCH_LEVEL.
However, this still blue screens for me. When I look at the stack
backtrace, it looks like WDF is still trying to wait for some sort of
cleanup, which causes the blue screen.
You can also see from the trace that I passed 0x00000003 to
WdfIoTargetStop() which is the enumerated value for
leave-sent-IO-pending. Any ideas?
8047166c f38d1aef 8365e748 8364e690 00000000
Wdf01000!FxUsbPipeContinuousReader::CancelRepeaters+0x31
8047167c f38ca634 8364e690 00000000 00000000
Wdf01000!FxUsbPipe::WaitForSentIoToComplete+0x109
80471694 f38c613d 00000003 83b940d0 8364e690
Wdf01000!FxIoTarget::Stop+0x41
804716b0 f396d61a 8365e800 7c9b1968 00000003
Wdf01000!imp_WdfIoTargetStop+0xba
804716c4 f39713d2 7c9b1968 00000003 54434163
xxx!WdfIoTargetStop+0x1a [...kmdf10\inc\wdfiotarget.h @ 375]
80471700 f38d2272 7c9b1968 7c9c3ff0 00000003
xxx!xxxEvtBulkInCompletion+0xe2 [c:\xxx\readwrit.c @ 326]
80471730 f38f270d 7c97a1c8 7c9b1968 83653b14
Wdf01000!FxUsbPipeContinuousReader::_FxUsbPipeRequestComplete+0x3e
80471758 f38cb1dc ae08bff8 8364e690 00000000
Wdf01000!FxRequestBase::CompleteSubmitted+0x89
80471774 f38cb296 01685e30 ae08bf00 804717cc
Wdf01000!FxIoTarget::RequestCompletionRoutine+0x195
80471784 80528ee6 00000000 ae08bf00 83685e30
Wdf01000!FxIoTarget::_RequestCompletionRoutine+0x35
804717cc f742e8ae ae08bf00 83679568 85e39028
nt!IovSpecialIrpCompleteRequest+0x18c
80471820 f742e5a1 46616d64 43707269 00000000
USBPORT!USBPORT_CompleteTransfer+0x306
80471850 f742fdcd 546e6f02 80464224 83651708
USBPORT!USBPORT_DoneTransfer+0x135
8047187c f74324c8 85e39028 80464224 85e391f0
USBPORT!USBPORT_FlushDoneTransferList+0x15f
804718ac f74401a1 85e39028 80464224 85e39028
USBPORT!USBPORT_DpcWorker+0x2d2
804718f4 f7440309 85e39028 00000001 8046d6f0
USBPORT!USBPORT_IsrDpcWorker+0x36f
80471910 804644c7 85e39608 6b755044 00000000
USBPORT!USBPORT_IsrDpc+0x15b
80471924 80464462 0000000e 00000000 00000000
nt!KiRetireDpcList+0x30
ffdff800 85e3962c 00000001 80471928 0006e721
nt!KiIdleLoop+0x26
WARNING: Frame IP not in any known module. Following frames may be
wrong.
ffdff804 00000000 80471928 0006e721 0006e718 0x85e3962c