ViLookasideAdd

VOID __stdcall ViLookasideAdd(_GENERAL_LOOKASIDE *Lookaside){
  _VF_AVL_TREE_NODE *v2; 
  VOID *v3; 
  UINT64 v4; 
  _VF_AVL_LOCK_CONTEXT Context[4]; 

  *(_OWORD *)Context = 0i64;
  if( ViLookasideInitialized )
  {
    v2 = VfAvlReserveNode(&ViLookasideAvl, Lookaside, 0i64);
    if( v2 )
    {
      v3 = 0i64;
      VfAvlInitializeLockContext(Context, Exclusive);
      if( VfAvlLookupTreeNode(&ViLookasideAvl, Context, Lookaside, 0i64) )
      {
        if( !ViLookasideAllocationFailures && !ViLookasideAlreadyLoadedDrivers && (MmVerifierData & 0x800) != 0 )
          VerifierBugCheckIfAppropriate(0xC4ui64, 0xCAu, (ULONG_PTR)Lookaside, 0, 0, v4);
        v3 = VfAvlDeleteTreeNode(&ViLookasideAvl, Context, Lookaside, 0i64);
      }
      VfAvlInsertReservedTreeNode(&ViLookasideAvl, Context, v2);
      VfAvlCleanupLockContext(Context);
      if( v3 )
      {
        if( ViLookasideAvl.u1.NodeSize == 1 )
          ExFreeToNPagedLookasideList(&ViAvlNodeLookaside, v3);
        else
          VfUtilFreePoolCheckIRQL(v3);
      }
    }
    else
    {
      _InterlockedExchange(&ViLookasideAllocationFailures, 1);
    }
  }
}

Referenced by:

VerifierExInitializeLookasideListEx
ViLookasideTrackList