KeRemoveByKeyDeviceQueue

PKDEVICE_QUEUE_ENTRY
    KeRemoveByKeyDeviceQueue(

        IN PKDEVICE_QUEUE  DeviceQueue,
        IN ULONG  SortKey
        );

KeRemoveByKeyDeviceQueue removes an entry, selected according to a sort-key value, from a given device queue.

Parameters

DeviceQueue
Points to an initialized device queue object for which the caller provides the storage.
SortKey
Specifies the position in the DeviceQueue from which the entry is to be removed.

Return Value

If the given device queue is empty but the device queue object’s state is Busy, KeRemoveByKeyDeviceQueue returns NULL.

Comments

It is an error to call KeRemoveByKeyDeviceQueue when the state of the device queue object is Not-Busy. If the state is Busy and an IRP is queued, this routine dequeues the entry and returns a pointer to the IRP. A call to KeRemoveByKeyDeviceQueue when the state of the device queue object is Busy but no IRPs are queued causes the state transition to Not-Busy.

Callers of KeRemoveByKeyDeviceQueue must be running at IRQL DISPATCH_LEVEL.

See Also

KeInitializeDeviceQueue, KeInsertByKeyDeviceQueue, KeInsertDeviceQueue, KeRemoveDeviceQueue, KeRemoveEntryDeviceQueue