RtlLookupElementGenericTableFullAvl

NTSTATUS __stdcall RtlLookupElementGenericTableFullAvl(
        RTL_AVL_TABLE *Table,
        PVOID Buffer,
        PVOID *NodeOrParent,
        TABLE_SEARCH_RESULT *SearchResult){
  _RTL_BALANCED_LINKS *i; 
  _RTL_GENERIC_COMPARE_RESULTS v9; 
  __int64 v10; 
  if( Table->NumberGenericTableElements )
  {
    for( i = Table->BalancedRoot.RightChild; ; i = i->RightChild )
    {
      while( 1 )
      {
        v9 = Table->CompareRoutine(Table, Buffer, &i[1]);
        if( v9 )
          break;
        if( !i->LeftChild )
        {
          *NodeOrParent = i;
          *SearchResult = TableInsertAsLeft;
          goto LABEL_10;
        }
        i = i->LeftChild;
      }
      if( v9 != GenericGreaterThan )
        break;
      if( !i->RightChild )
      {
        *NodeOrParent = i;
        *SearchResult = TableInsertAsRight;
        goto LABEL_10;
      }
    }
    *NodeOrParent = i;
    *SearchResult = TableFoundNode;
    return(int)*NodeOrParent + 32;
  }
  else
  {
    *SearchResult = TableEmptyTree;
LABEL_10:
    LODWORD(v10) = 0;
  }
  return v10;
}

Referenced by:

PiDmAddCacheReferenceForObject
PiPnpRtlObjectEventCreate
VfAvlLookupTreeNode