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.
If the given device queue is empty but the device queue object�s state is Busy, KeRemoveByKeyDeviceQueue returns NULL.
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.
KeInitializeDeviceQueue, KeInsertByKeyDeviceQueue, KeInsertDeviceQueue, KeRemoveDeviceQueue, KeRemoveEntryDeviceQueue