#ifndef _NTRTL_H
FORCEINLINE
VOID
NTAPI_INLINE
InsertTailList(
_Inout_ PLIST_ENTRY ListHead,
_Inout_ __drv_aliasesMem PLIST_ENTRY Entry
)
{
PLIST_ENTRY PrevEntry;
PrevEntry = ListHead->Blink;
#if !defined(NO_LIST_ENTRY_CHECKS)
if (PrevEntry->Flink != ListHead)
{
RtlFatalListEntryError((PVOID)PrevEntry, (PVOID)ListHead, (PVOID)PrevEntry->Flink);
}
#endif
Entry->Flink = ListHead;
Entry->Blink = PrevEntry;
PrevEntry->Flink = Entry;
ListHead->Blink = Entry;
}
View code on GitHub
// wdm.h
VOID InsertTailList(
[in, out] PLIST_ENTRY ListHead,
[in, out] __drv_aliasesMem PLIST_ENTRY Entry
);
View the official Windows Driver Kit DDI reference
This function is documented in Windows Driver Kit.
The InsertTailList routine inserts an entry at the tail of a doubly linked list of LIST_ENTRY structures.
ListHead
[in, out]Pointer to the LIST_ENTRY structure that represents the head of the list.
Entry
[in, out]Pointer to a LIST_ENTRY structure that represents the entry to be inserted in the list.
InsertTailList updates ListHead->Blink to point to Entry. It updates Entry->Blink to point to the old last entry in the list, and sets Entry->Flink to ListHead. The Flink of the previous last entry is updated to point to Entry as well.
For information about using this routine when implementing a doubly linked list, see Singly and Doubly Linked Lists.
Callers of InsertTailList can be running at any IRQL. If InsertTailList is called at IRQL >= DISPATCH_LEVEL, the storage for ListHead and the list entries must be resident.