MiIncrementSubsectionViewCount

INT64 __fastcall MiIncrementSubsectionViewCount(INT64 *P2, CHAR a2){
  INT64 v2; 
  INT64 *v3; 
  unsigned int v4; 
  __int16 v7; 
  ULONG_PTR *v8; 
  INT64 SubsectionHoldingCrossPartitionReferences; 
  int v10; 
  char v11; 
  v2 = *P2;
  v3 = P2;
  v4 = 2;
  if( (a2 & 8) != 0 && !MiControlAreaExemptFromCrossPartitionCharges(*P2) )
  {
    if( (v7 & 0x80u) != 0 )
    {
      v8 = &MiSystemPartition;
    }
    else if( (v7 & 0x100) != 0 )
    {
      v8 = *(ULONG_PTR **)(qword_140C4E388
                         + 8i64
                         * *(unsigned __int16 *)(*(_QWORD *)(*((_QWORD *)KeGetCurrentThread() + 23) + 1368i64) + 430i64));
    }
    else
    {
      v8 = (v7 & 0x10) != 0 ? 0i64 : *(ULONG_PTR **)(qword_140C4E388
                                                   + 8i64
                                                   * *(unsigned __int16 *)(*((_QWORD *)KeGetCurrentThread() + 23)
                                                                         + 1838i64));
    }
    if( v8 != *(ULONG_PTR **)(qword_140C4E388 + 8i64 * (*(_WORD *)(v2 + 60) & 0x3FF)) )
    {
      if( (((v7 & 0x200) == 0) & *(_BYTE *)(v2 + 62)) != 0 )
      {
        ++dword_140C4E398;
        return 0i64;
      }
      SubsectionHoldingCrossPartitionReferences = MiGetSubsectionHoldingCrossPartitionReferences((INT64)v3);
      v10 = *(_DWORD *)(MiGetSubsectionHoldingCrossPartitionReferences(SubsectionHoldingCrossPartitionReferences) + 48) & 0x3FFFFFFF;
      if( v10 != 0x3FFFFFFF )
      {
        if( !v10 && (v11 & 0x20) == 0 )
          return 1i64;
        MiUpdateSubsectionCrossPartitionRefs(v3, (unsigned int)(v10 + 1));
      }
    }
  }
  if( (*(_DWORD *)(v2 + 56) & 0x20) == 0 && *(_QWORD *)(v2 + 64) && (*((_BYTE *)v3 + 34) & 1) == 0 && v3[12]++ == -1 )
    KeBugCheckEx(0x1Au, 0x42000ui64, (ULONG_PTR)v3, 0i64, 0i64);
  return v4;
}

Referenced by:

MiCreatePrototypePtes
MiExtendSection
MiFlushSectionInternal
MiPrepareSegmentForDeletion
MiReferenceActiveSubsection
MiReferenceSubsection
MiRetainSubsection
MiSetSubsectionBase
MmPurgeSection