MiGetChannelInformation

VOID __fastcall MiGetChannelInformation(_MI_PARTITION *Partition, UINT64 NodeNumber, INT64 a3, _QWORD *a4){
  _ETHREAD *CurrentThread; 
  unsigned int v5; 
  __int64 v8; 
  unsigned int v9; 
  unsigned int v10; 
  INT64 v11; 
  _QWORD *v12; 
  unsigned int v13; 
  unsigned __int8 *v14; 
  UINT64 ZeroCount; 
  unsigned int v16; 
  UINT64 FreeCount; 
  UINT64 StandbyCount; 
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v5 = NodeNumber;
  ZeroCount = 0i64;
  FreeCount = 0i64;
  StandbyCount = 0i64;
  v8 = *((_QWORD *)Partition + 2) + 4544i64 * (unsigned int)NodeNumber;
  *a4 = 40i64 * (unsigned int)MmNumberOfChannels;
  MiLockDynamicMemoryExclusive((__int64)Partition, (__int64)CurrentThread);
  --*((_WORD *)CurrentThread + 243);
  ExAcquirePushLockSharedEx(v8 + 4296, 0i64);
  v9 = MmNumberOfChannels;
  v10 = 0;
  v16 = MmNumberOfChannels;
  if( MmNumberOfChannels )
  {
    v11 = a3 + 4;
    v12 = (_QWORD *)(v8 + 4144);
    do
    {
      *(_DWORD *)(v11 - 4) = v10;
      if( (*(_DWORD *)(v8 + 4280) & 1) != 0 )
      {
        v13 = 0;
        v14 = (unsigned __int8 *)(v8 + 4313);
        while( *v14 != v10 )
        {
          ++v13;
          ++v14;
          if( v13 >= v9 )
            goto LABEL_5;
        }
        *(_DWORD *)v11 = v13;
      }
      else
      {
        *(_DWORD *)v11 = -1;
      }
LABEL_5:
      *(_QWORD *)(v11 + 4) = *v12;
      MiGetNodeChannelPageCounts(Partition, v5, v10++, &ZeroCount, &FreeCount, &StandbyCount);
      v9 = v16;
      ++v12;
      *(_QWORD *)(v11 + 12) = ZeroCount;
      *(_QWORD *)(v11 + 20) = FreeCount;
      *(_QWORD *)(v11 + 28) = StandbyCount;
      v11 += 40i64;
    }
    while( v10 < v9 );
  }
  if( _InterlockedCompareExchange64((volatile signed __int64 *)(v8 + 4296), 0i64, 17i64) != 17 )
    ExfReleasePushLockShared((INT64 *)(v8 + 4296));
  KeAbPostRelease((PVOID)(v8 + 4296));
  KiLeaveGuardedRegionUnsafe((__int64)CurrentThread);
  MiUnlockDynamicMemoryExclusive(Partition, CurrentThread);
}

Referenced by:

MmGetChannelInformation
MmManagePartitionMemoryInformation