InsertHeadList function (wdm.h)

The InsertHeadList routine inserts an entry at the head of a doubly linked list of LIST_ENTRY structures.

Syntax

void InsertHeadList(
  [in, out] PLIST_ENTRY                  ListHead,
  [in, out] __drv_aliasesMem PLIST_ENTRY Entry
);

Parameters

[in, out] ListHead

Pointer to the LIST_ENTRY structure that represents the head of the list.

[in, out] Entry

Pointer to a LIST_ENTRY structure that represents the entry to be inserted into the list.

Return value

None

Remarks

InsertHeadList updates ListHead->Flink to point to Entry. It updates Entry->Flink to point to the old first entry in the list, and sets Entry->Blink to ListHead. The Blink field of the original first entry is also updated to point to Entry.

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

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

Requirements

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 IoAllocateFree(wdm), IoReuseIrp(wdm), MarkingQueuedIrps(wdm), RemoveLockCheck(wdm), RemoveLockForward(wdm), RemoveLockForward2(wdm), RemoveLockForwardDeviceControl(wdm), RemoveLockForwardDeviceControl2(wdm), RemoveLockForwardDeviceControlInternal(wdm), RemoveLockForwardDeviceControlInternal2(wdm), RemoveLockForwardRead(wdm), RemoveLockForwardRead2(wdm), RemoveLockForwardWrite(wdm), RemoveLockForwardWrite2(wdm), RemoveLockRelease2(wdm), RemoveLockReleaseCleanup(wdm), RemoveLockReleaseClose(wdm), RemoveLockReleaseCreate(wdm), RemoveLockReleaseDeviceControl(wdm), RemoveLockReleaseInternalDeviceControl(wdm), RemoveLockReleasePower(wdm), RemoveLockReleaseRead(wdm), RemoveLockReleaseShutdown(wdm), RemoveLockReleaseSystemControl(wdm), RemoveLockReleaseWrite(wdm)

See also

ExInterlockedInsertHeadList

InitializeListHead

InsertTailList

IsListEmpty

RemoveHeadList

RemoveTailList