The KeInsertByKeyDeviceQueue routine acquires the spin lock for the specified DeviceQueue and queues an entry according to the specified sort-key value if the device queue is set to a busy state.
NTKERNELAPI BOOLEAN KeInsertByKeyDeviceQueue( PKDEVICE_QUEUE DeviceQueue, PKDEVICE_QUEUE_ENTRY DeviceQueueEntry, ULONG SortKey );
Pointer to a control object of the device queue type for which the caller provides the storage.
Pointer to the device queue entry to be inserted into the device queue according to the specific key value.
Specifies the sort-key value that determines the position in the device queue in which to insert the entry.
If the device queue is empty, FALSE is returned, meaning the DeviceQueueEntry is not inserted in the device queue.
The specified device queue spin lock is acquired and the state of the device queue is checked. If the device queue is set to a busy state, the IRP specified by the DeviceQueueEntry is inserted into the device queue according to its sort key value and the device queue spin lock is released.
The new entry is positioned in the device queue after any entries in the queue with sort key values less than or equal to its sort key value and preceding any entries with sort key values that are greater.
If KeInsertByKeyDeviceQueue returns FALSE, the caller must begin processing the IRP. A call to KeInsertDeviceQueue or KeInsertByKeyDeviceQueue when the queue is empty causes the device queue to transition from a not-busy state to a busy state.
This routine is for code that queues an I/O request to a device driver.
|Windows version||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||IrqlDispatch, MarkingQueuedIrps, HwStorPortProhibitedDDIs, IrqlDispatch(storport)|