RemoveHeadList function (wdm.h)

The RemoveHeadList routine removes an entry from the beginning of a doubly linked list of LIST_ENTRY structures.


PLIST_ENTRY RemoveHeadList(
  [in, out] PLIST_ENTRY ListHead


[in, out] ListHead

Pointer to the LIST_ENTRY structure that serves as the list header.

Return value

RemoveHeadList returns a pointer to the entry removed from the list. If the list is empty, RemoveHeadList returns ListHead.


RemoveHeadList removes the first entry from the list by setting ListHead->Flink to point to the second entry in the list. The routine sets the Blink member of the second entry to ListHead. In the event the list is empty, this is effectively a no-op.

For information about using this routine when implementing a doubly linked list, see Singly and Doubly Linked Lists.

Callers of RemoveHeadList can be running at any IRQL. If RemoveHeadList is called at IRQL >= DISPATCH_LEVEL, the storage for ListHead and the list entries must be resident.


Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Desktop
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h, Wudfwdm.h)
IRQL Any level (See Remarks section)
DDI compliance rules CancelSpinLock(wdm), CompleteRequest(wdm), DoubleCompletion(wdm), DoubleExFreePool(storport), Init_NdisAllocateIoWorkItem(ndis), InvalidReqAccessLocal(kmdf), IoAllocateFree(wdm), IoReuseIrp(wdm), IrpProcessingComplete(wdm), MarkingInterlockedQueuedIrps(wdm), MarkingQueuedIrps(wdm), MarkIrpPending(wdm), MarkIrpPending2(wdm), PendedCompletedRequest(wdm), PendedCompletedRequest2(wdm), PendedCompletedRequest3(wdm), PendedCompletedRequestEx(wdm), RemoveLock(wdm), RemoveLockCheck(wdm), RemoveLockForward(wdm), RemoveLockForward2(wdm), RemoveLockForwardDeviceControl(wdm), RemoveLockForwardDeviceControl2(wdm), RemoveLockForwardDeviceControlInternal(wdm), RemoveLockForwardDeviceControlInternal2(wdm), RemoveLockForwardRead(wdm), RemoveLockForwardRead2(wdm), RemoveLockForwardWrite(wdm), RemoveLockForwardWrite2(wdm), RemoveLockMnRemove(wdm), RemoveLockMnSurpriseRemove(wdm), RemoveLockRelease2(wdm), RemoveLockReleaseCleanup(wdm), RemoveLockReleaseClose(wdm), RemoveLockReleaseCreate(wdm), RemoveLockReleaseDeviceControl(wdm), RemoveLockReleaseInternalDeviceControl(wdm), RemoveLockReleasePnp(wdm), RemoveLockReleasePower(wdm), RemoveLockReleaseRead(wdm), RemoveLockReleaseShutdown(wdm), RemoveLockReleaseSystemControl(wdm), RemoveLockReleaseWrite(wdm)

See also