ViTargetTrackContiguousMemory

VOID __fastcall ViTargetTrackContiguousMemory(VOID *CallerAddress, VOID *p, UINT64 NumberOfBytes){
  _QWORD *PoolWithTag; 
  _QWORD *v7; 
  int v8; 
  CHAR *v9; 
  __int64 v10; 
  UINT64 v11; 
  __int64 v12; 
  _QWORD *v13; 
  __int128 v14; 
  v14 = 0i64;
  if( (unsigned int)ViTargetUpdateTreeAllowed() )
  {
    PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x28ui64, 0x61436656ui64);
    v7 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[2] = p;
      PoolWithTag[3] = NumberOfBytes;
      v8 = 0;
      PoolWithTag[4] = CallerAddress;
      VfAvlInitializeLockContext((INT64)&v14, 0i64);
      v9 = VfAvlLookupTreeNode(&ViTargetDriversAvl, (INT64)&v14, (UINT64)CallerAddress, 1i64);
      if( v9 )
      {
        v10 = *((_QWORD *)v9 + 7);
        if( v10 )
        {
          qword_140C1CEF0 += NumberOfBytes;
          v11 = NumberOfBytes + *(_QWORD *)(v10 + 240);
          *(_QWORD *)(v10 + 240) = v11;
          if( *(_QWORD *)(v10 + 248) < v11 )
            *(_QWORD *)(v10 + 248) = v11;
          v12 = v10 + 256;
          v13 = *(_QWORD **)(v12 + 8);
          if( *v13 != v12 )
            __fastfail(3u);
          *v7 = v12;
          v8 = 1;
          v7[1] = v13;
          *v13 = v7;
          *(_QWORD *)(v12 + 8) = v7;
        }
      }
      VfAvlCleanupLockContext((INT64)&v14);
      if( !v8 )
        VfUtilFreePoolCheckIRQL(v7);
    }
  }
}

Referenced by:

VerifierMmAllocateContiguousMemory
VerifierMmAllocateContiguousMemorySpecifyCache
VerifierMmAllocateContiguousMemorySpecifyCacheNode
VerifierMmAllocateContiguousNodeMemory
VerifierMmAllocateNonCachedMemory