RemoveHeadList routine

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

Syntax


PLIST_ENTRY RemoveHeadList(
  _Inout_ PLIST_ENTRY ListHead
);

Parameters

ListHead [in, out]

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.

Remarks

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

Target platform

Desktop

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

IRQL

Any level (See Remarks section)

DDI compliance rules

CancelSpinLock, CompleteRequest, DoubleCompletion, IoAllocateFree, IoReuseIrp, IrpProcessingComplete, MarkingInterlockedQueuedIrps, MarkingQueuedIrps, MarkIrpPending, MarkIrpPending2, PendedCompletedRequest, PendedCompletedRequest2, PendedCompletedRequest3, PendedCompletedRequestEx, RemoveLock, RemoveLockCheck, RemoveLockForward, RemoveLockForward2, RemoveLockForwardDeviceControl, RemoveLockForwardDeviceControl2, RemoveLockForwardDeviceControlInternal, RemoveLockForwardDeviceControlInternal2, RemoveLockForwardRead, RemoveLockForwardRead2, RemoveLockForwardWrite, RemoveLockForwardWrite2, RemoveLockMnRemove, RemoveLockMnSurpriseRemove, RemoveLockRelease2, RemoveLockReleaseCleanup, RemoveLockReleaseClose, RemoveLockReleaseCreate, RemoveLockReleaseDeviceControl, RemoveLockReleaseInternalDeviceControl, RemoveLockReleasePnp, RemoveLockReleasePower, RemoveLockReleaseRead, RemoveLockReleaseShutdown, RemoveLockReleaseSystemControl, RemoveLockReleaseWrite, InvalidReqAccessLocal, DoubleExFreePool, Init_NdisAllocateIoWorkItem

See also

ExInterlockedRemoveHeadList
InitializeListHead
IsListEmpty
RemoveTailList
RemoveEntryList

 

 

Send comments about this topic to Microsoft

Show: