[Applies to KMDF and UMDF]
The WdfIoQueueStopAndPurge method prevents an I/O queue from delivering new requests and cancels existing unprocessed requests and driver-owned cancellable requests, but the queue receives and stores new requests.
void WdfIoQueueStopAndPurge( WDFQUEUE Queue, PFN_WDF_IO_QUEUE_STATE StopAndPurgeComplete, WDFCONTEXT Context );
A handle to a framework queue object.
A pointer to a driver-supplied EvtIoQueueState callback function. This parameter is optional and can be NULL.
An untyped pointer to driver-supplied context information that the framework passes to the EvtIoQueueState callback function. This parameter is optional and can be NULL.
This method does not return a value.
The WdfIoQueueStopAndPurge method prevents an I/O queue from delivering I/O requests to the driver while allowing new requests to be added to the queue. In addition, it cancels unprocessed requests in the queue and driver-owned cancellable requests (requests that were delivered to the driver that driver has not completed or requeued). If new requests are added while WdfIoQueueStopAndPurge is in progress, these new requests are not delivered until driver calls WdfIoQueueStart.
In contrast, the WdfIoQueueStop method does not cancel unprocessed requests in the queue or driver-owned cancellable requests.
If this method causes the framework to cancel an unprocessed request in a queue, the framework calls the driver's EvtIoCanceledOnQueue callback function for that queue, if the driver has supplied one.
If the driver supplies an <a href="https://docs.microsoft.com/windows-hardware/drivers/ddi/content/wdfio/nc-wdfio-evt_wdf_io_queue_state">EvtIoQueueState</a> callback function, the framework calls it after all requests that were delivered to the driver have been completed or canceled.
The WdfIoQueueStopAndPurge method enables the queue to receive new requests, even if the queue was not receiving new requests before the driver called WdfIoQueueStopAndPurge. For example, a driver might call WdfIoQueueDrain, which causes the framework to stop adding new I/O requests to the queue. The driver's subsequent call of WdfIoQueueStopAndPurge causes the framework to resume adding requests to the queue.
In contrast, WdfIoQueuePurge causes the framework to stop adding I/O requests to the specified queue.
A bug check occurs if the driver supplies an invalid object handle.
The following code example stops and purges a specified I/O queue. After all requests that were delivered to the driver have been completed or canceled, the framework calls a driver's EvtIoQueueStateStopAndPurge function.
WDFCONTEXT stopandpurgeContext; stopandpurgeContext = &myContext; WdfIoQueueStopAndPurge( queue, EvtIoQueueStateStopAndPurge, stopandpurgeContext );
|Minimum KMDF version||1.11|
|Minimum UMDF version||2.0|
|Header||wdfio.h (include Wdf.h)|
|Library||Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)|
|DDI compliance rules||ChangeQueueState, DriverCreate, EvtSurpriseRemoveNoSuspendQueue, NoCancelFromEvtSurpriseRemove|