37 return TableEmptyTree;
41 CurrentNode =
Table->TableRoot;
57 CurrentNode = ChildNode;
62 *NodeOrParent = CurrentNode;
63 return TableInsertAsLeft;
72 CurrentNode = ChildNode;
77 *NodeOrParent = CurrentNode;
78 return TableInsertAsRight;
87 *NodeOrParent = CurrentNode;
88 return TableFoundNode;
109 Table->NumberGenericTableElements = 0;
110 Table->WhichOrderedElement = 0;
111 Table->OrderedPointer = &
Table->InsertOrderList;
158 if (SearchResult != TableFoundNode)
171 if (NewElement) *NewElement =
FALSE;
181 Table->NumberGenericTableElements++;
184 if (SearchResult == TableEmptyTree)
187 Table->TableRoot = NewNode;
189 else if (SearchResult == TableInsertAsLeft)
208 NewNode = NodeOrParent;
215 if (NewElement) *NewElement = (SearchResult != TableFoundNode);
240 return Table->NumberGenericTableElements;
257 (
PVOID)&NodeOrParent,
278 if ((*SearchResult == TableEmptyTree) || (*SearchResult != TableFoundNode))
302 if (
Result != TableFoundNode)
313 Table->NumberGenericTableElements--;
314 Table->WhichOrderedElement = 0;
315 Table->OrderedPointer = &
Table->InsertOrderList;
339 FoundNode =
Table->TableRoot;
378 FoundNode =
Table->TableRoot;
386 *RestartKey = FoundNode;
392 if (FoundNode) *RestartKey = FoundNode;
424 ULONG OrderedElement, ElementCount;
426 ULONG DeltaUp, DeltaDown;
430 OrderedNode =
Table->OrderedPointer;
431 OrderedElement =
Table->WhichOrderedElement;
432 ElementCount =
Table->NumberGenericTableElements;
438 if (NextI == OrderedElement)
443 ListEntry)->UserData;
447 if (OrderedElement > NextI)
450 if (NextI > (OrderedElement / 2))
453 DeltaDown = OrderedElement - NextI;
457 OrderedNode = OrderedNode->
Blink;
464 OrderedNode = &
Table->InsertOrderList;
468 OrderedNode = OrderedNode->
Flink;
476 DeltaUp = NextI - OrderedElement;
477 DeltaDown = (ElementCount - NextI) + 1;
480 if (DeltaUp <= DeltaDown)
486 OrderedNode = OrderedNode->
Blink;
493 OrderedNode = &
Table->InsertOrderList;
497 OrderedNode = OrderedNode->
Blink;
504 Table->OrderedPointer = OrderedNode;
505 Table->WhichOrderedElement = NextI;
510 ListEntry)->UserData;
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
BOOLEAN NTAPI RtlDeleteElementGenericTable(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
ULONG NTAPI RtlNumberGenericTableElements(IN PRTL_GENERIC_TABLE Table)
struct _TABLE_ENTRY_HEADER * PTABLE_ENTRY_HEADER
PVOID NTAPI RtlInsertElementGenericTableFull(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer, IN ULONG BufferSize, OUT PBOOLEAN NewElement OPTIONAL, IN PVOID NodeOrParent, IN TABLE_SEARCH_RESULT SearchResult)
TABLE_SEARCH_RESULT NTAPI RtlpFindGenericTableNodeOrParent(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer, OUT PRTL_SPLAY_LINKS *NodeOrParent)
PVOID NTAPI RtlEnumerateGenericTableWithoutSplaying(IN PRTL_GENERIC_TABLE Table, IN OUT PVOID *RestartKey)
BOOLEAN NTAPI RtlIsGenericTableEmpty(IN PRTL_GENERIC_TABLE Table)
VOID NTAPI RtlInitializeGenericTable(IN PRTL_GENERIC_TABLE Table, IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine, IN PVOID TableContext)
PVOID NTAPI RtlEnumerateGenericTable(IN PRTL_GENERIC_TABLE Table, IN BOOLEAN Restart)
PVOID NTAPI RtlGetElementGenericTable(IN PRTL_GENERIC_TABLE Table, IN ULONG I)
PVOID NTAPI RtlLookupElementGenericTableFull(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer, OUT PVOID *NodeOrParent, OUT TABLE_SEARCH_RESULT *SearchResult)
struct _TABLE_ENTRY_HEADER TABLE_ENTRY_HEADER
PVOID NTAPI RtlLookupElementGenericTable(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer)
PVOID NTAPI RtlInsertElementGenericTable(IN PRTL_GENERIC_TABLE Table, IN PVOID Buffer, IN ULONG BufferSize, OUT PBOOLEAN NewElement OPTIONAL)
PVOID NTAPI RtlEnumerateGenericTableLikeADirectory(IN PRTL_AVL_TABLE Table, IN PRTL_AVL_MATCH_FUNCTION MatchFunction, IN PVOID MatchData, IN ULONG NextFlag, IN OUT PVOID *RestartKey, IN OUT PULONG DeleteCount, IN OUT PVOID Buffer)
#define _Analysis_assume_
PULONG MinorVersion OPTIONAL
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
#define RtlRightChild(Links)
#define RtlLeftChild(Links)
NTSYSAPI PRTL_SPLAY_LINKS NTAPI RtlSplay(_Inout_ PRTL_SPLAY_LINKS Links)
_In_ PRTL_GENERIC_COMPARE_ROUTINE _In_ PRTL_GENERIC_ALLOCATE_ROUTINE _In_ PRTL_GENERIC_FREE_ROUTINE _In_opt_ PVOID TableContext
_In_ PRTL_GENERIC_COMPARE_ROUTINE _In_ PRTL_GENERIC_ALLOCATE_ROUTINE _In_ PRTL_GENERIC_FREE_ROUTINE FreeRoutine
#define RtlInsertAsRightChild(ParentLinks, ChildLinks)
_In_ PRTL_GENERIC_COMPARE_ROUTINE _In_ PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine
NTSYSAPI PRTL_SPLAY_LINKS NTAPI RtlDelete(_In_ PRTL_SPLAY_LINKS Links)
_In_ PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine
#define RtlInitializeSplayLinks(Links)
#define RtlInsertAsLeftChild(ParentLinks, ChildLinks)
_Must_inspect_result_ NTSYSAPI PRTL_SPLAY_LINKS NTAPI RtlRealSuccessor(_In_ PRTL_SPLAY_LINKS Links)
_IRQL_requires_same_ _In_ PVOID _In_ PVOID MatchData
RTL_GENERIC_FREE_ROUTINE * PRTL_GENERIC_FREE_ROUTINE
RTL_AVL_MATCH_FUNCTION * PRTL_AVL_MATCH_FUNCTION
RTL_GENERIC_COMPARE_ROUTINE * PRTL_GENERIC_COMPARE_ROUTINE
RTL_GENERIC_ALLOCATE_ROUTINE * PRTL_GENERIC_ALLOCATE_ROUTINE
enum _RTL_GENERIC_COMPARE_RESULTS RTL_GENERIC_COMPARE_RESULTS