ViTargetTrackContiguousMemory

VOID __stdcall ViTargetTrackContiguousMemory(VOID *CallerAddress, VOID *p, UINT64 NumberOfBytes){
  VOID **PoolWithTag; 
  VOID **v7; 
  int v8; 
  _VF_AVL_TREE_NODE *v9; 
  unsigned __int64 RangeSize; 
  UINT64 v11; 
  VOID **v12; 
  VOID ***v13; 
  _VF_AVL_LOCK_CONTEXT Context[6]; 

  *(_OWORD *)Context = 0i64;
  if( (unsigned int)ViTargetUpdateTreeAllowed() )
  {
    PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x28ui64, 1631807062i64);
    v7 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[2] = p;
      PoolWithTag[3] = (VOID *)NumberOfBytes;
      v8 = 0;
      PoolWithTag[4] = CallerAddress;
      VfAvlInitializeLockContext(Context, Exclusive);
      v9 = VfAvlLookupTreeNode(&ViTargetDriversAvl, Context, CallerAddress, 1ui64);
      if( v9 )
      {
        RangeSize = v9[3].RangeSize;
        if( RangeSize )
        {
          qword_140C1CEF0 += NumberOfBytes;
          v11 = NumberOfBytes + *(_QWORD *)(RangeSize + 240);
          *(_QWORD *)(RangeSize + 240) = v11;
          if( *(_QWORD *)(RangeSize + 248) < v11 )
            *(_QWORD *)(RangeSize + 248) = v11;
          v12 = (VOID **)(RangeSize + 256);
          v13 = (VOID ***)v12[1];
          if( *v13 != v12 )
            __fastfail(3u);
          *v7 = v12;
          v8 = 1;
          v7[1] = v13;
          *v13 = v7;
          v12[1] = v7;
        }
      }
      VfAvlCleanupLockContext(Context);
      if( !v8 )
        VfUtilFreePoolCheckIRQL(v7);
    }
  }
}

Referenced by:

VerifierMmAllocateContiguousMemory
VerifierMmAllocateContiguousMemorySpecifyCache
VerifierMmAllocateContiguousMemorySpecifyCacheNode
VerifierMmAllocateContiguousNodeMemory
VerifierMmAllocateNonCachedMemory