Windows Driver Kit: Kernel-Mode Driver Architecture
RemoveHeadList
The RemoveHeadList routine removes an entry from the beginning of a doubly linked list of LIST_ENTRY structures.
PLIST_ENTRY
RemoveHeadList(
IN PLIST_ENTRY ListHead
);
Parameters
- 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.
Comments
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.
Requirements
IRQL: Any level (See Comments section)
Headers: Declared in Wdm.h. Include Wdm.h, Ntddk.h, or Ntifs.h.
See Also
ExInterlockedRemoveHeadList, InitializeListHead, IsListEmpty, RemoveTailList, RemoveEntryList