MmQueryMemoryListInformation

NTSTATUS __stdcall MmQueryMemoryListInformation(
        VOID *SystemInformation,
        UINT64 SystemInformationLength,
        UINT64 *Length){
  unsigned int v3; 
  int v6; 
  _MI_PARTITION *v7; 
  unsigned __int64 NumberOfPhysicalPages; 
  unsigned __int64 v9; 
  unsigned __int64 TotalPagesForPagingFile; 
  unsigned __int64 v11; 
  unsigned __int64 v12; 
  unsigned __int64 v13; 
  unsigned __int64 v14; 
  unsigned __int64 v15; 
  unsigned __int64 v16; 
  unsigned __int64 v17; 
  unsigned __int64 v18; 
  unsigned __int64 v19; 
  unsigned __int64 v20; 
  unsigned __int64 v21; 
  unsigned __int64 v22; 
  unsigned __int64 v23; 
  unsigned __int64 v24; 
  unsigned __int64 v25; 
  unsigned __int64 v26; 
  unsigned __int64 v27; 
  unsigned __int64 v28; 
  unsigned __int64 v29; 
  unsigned __int64 v30; 
  char v32; 
  _MI_PARTITION *v33; 
  unsigned __int64 Total; 
  unsigned __int64 v35; 
  unsigned __int64 v36; 
  unsigned __int64 v37; 
  _BYTE v38[112]; 
  __int128 v39; 
  __int128 v40; 
  __int128 v41; 
  __int128 v42; 
  _DWORD *v43; 

  v3 = (unsigned int)Length;
  memset(v38, 0i64, 0x68u);
  *((_QWORD *)&v42 + 1) = 0i64;
  *v43 = 0;
  if( v3 < 0xB0 )
  {
    *v43 = 176;
    return -1073741820;
  }
  v6 = 0;
  v32 = 0;
  if( SystemInformation )
  {
    if( SystemInformation == (VOID *)-1i64 )
    {
      v7 = *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267)
                             + 8i64 * KeGetCurrentThread()->ApcState.Process->Vm.Instance.PartitionId);
    }
    else
    {
      v7 = *(_MI_PARTITION **)SystemInformation;
      v6 = 1;
    }
  }
  else
  {
    v7 = &Irp;
  }
  v33 = v7;
  if( v7->Core.Signature != 305535296 )
    goto LABEL_57;
  if( v6 != 1 )
    goto LABEL_7;
  if( v7->Core.PartitionObject != SystemInformation )
LABEL_57:
    KeBugCheckEx(0x1Au, (PVOID)0x41001, SystemInformation, v7, 0i64);
  if( !PsReferencePartitionSafe((INT64)SystemInformation) )
    return -1073740640;
  v32 = 1;
LABEL_7:
  NumberOfPhysicalPages = v7->Vp.NumberOfPhysicalPages;
  Total = v7->PageLists.ZeroedPageListHead.Total;
  *(_QWORD *)v38 = Total;
  v35 = v7->PageLists.FreePageListHead.Total;
  *(_QWORD *)&v38[8] = v35;
  v9 = v7->Vp.ModifiedPageListHead.Total;
  *(_QWORD *)&v38[16] = v9;
  v36 = v7->Vp.ModifiedNoWritePageListHead.Total;
  *(_QWORD *)&v38[24] = v36;
  v37 = v7->PageLists.BadPageListHead.Total;
  *(_QWORD *)&v38[32] = v37;
  TotalPagesForPagingFile = v7->Vp.TotalPagesForPagingFile;
  v11 = v7->PageLists.StandbyPageListByPriority[0].Total;
  *(_QWORD *)&v38[40] = v11;
  *(_QWORD *)&v38[104] = v7->PageLists.StandbyRepurposedByPriority[0];
  v12 = v7->PageLists.StandbyPageListByPriority[1].Total;
  *(_QWORD *)&v38[48] = v12;
  *(_QWORD *)&v39 = v7->PageLists.StandbyRepurposedByPriority[1];
  v13 = v7->PageLists.StandbyPageListByPriority[2].Total;
  *(_QWORD *)&v38[56] = v13;
  *((_QWORD *)&v39 + 1) = v7->PageLists.StandbyRepurposedByPriority[2];
  v14 = v7->PageLists.StandbyPageListByPriority[3].Total;
  *(_QWORD *)&v38[64] = v14;
  *(_QWORD *)&v40 = v7->PageLists.StandbyRepurposedByPriority[3];
  v15 = v7->PageLists.StandbyPageListByPriority[4].Total;
  *(_QWORD *)&v38[72] = v15;
  *((_QWORD *)&v40 + 1) = v7->PageLists.StandbyRepurposedByPriority[4];
  v16 = v7->PageLists.StandbyPageListByPriority[5].Total;
  *(_QWORD *)&v38[80] = v16;
  *(_QWORD *)&v41 = v7->PageLists.StandbyRepurposedByPriority[5];
  v17 = v7->PageLists.StandbyPageListByPriority[6].Total;
  *(_QWORD *)&v38[88] = v17;
  *((_QWORD *)&v41 + 1) = v7->PageLists.StandbyRepurposedByPriority[6];
  v18 = v7->PageLists.StandbyPageListByPriority[7].Total;
  *(_QWORD *)&v38[96] = v18;
  *(_QWORD *)&v42 = v33->PageLists.StandbyRepurposedByPriority[7];
  if( Total > NumberOfPhysicalPages )
  {
    *(_QWORD *)v38 = NumberOfPhysicalPages;
    v19 = 0i64;
  }
  else
  {
    v19 = NumberOfPhysicalPages - Total;
  }
  if( v35 > v19 )
  {
    *(_QWORD *)&v38[8] = v19;
    v20 = 0i64;
  }
  else
  {
    v20 = v19 - v35;
  }
  if( v9 > v20 )
  {
    v9 = v20;
    *(_QWORD *)&v38[16] = v20;
    v21 = 0i64;
  }
  else
  {
    v21 = v20 - v9;
  }
  if( v36 > v21 )
  {
    *(_QWORD *)&v38[24] = v21;
    v22 = 0i64;
  }
  else
  {
    v22 = v21 - v36;
  }
  if( v37 > v22 )
  {
    *(_QWORD *)&v38[32] = v22;
    v23 = 0i64;
  }
  else
  {
    v23 = v22 - v37;
  }
  if( TotalPagesForPagingFile >= v9 )
    TotalPagesForPagingFile = v9;
  *((_QWORD *)&v42 + 1) = TotalPagesForPagingFile;
  if( v11 > v23 )
  {
    *(_QWORD *)&v38[40] = v23;
    v24 = 0i64;
  }
  else
  {
    v24 = v23 - v11;
  }
  if( v12 > v24 )
  {
    *(_QWORD *)&v38[48] = v24;
    v25 = 0i64;
  }
  else
  {
    v25 = v24 - v12;
  }
  if( v13 > v25 )
  {
    *(_QWORD *)&v38[56] = v25;
    v26 = 0i64;
  }
  else
  {
    v26 = v25 - v13;
  }
  if( v14 > v26 )
  {
    *(_QWORD *)&v38[64] = v26;
    v27 = 0i64;
  }
  else
  {
    v27 = v26 - v14;
  }
  if( v15 > v27 )
  {
    *(_QWORD *)&v38[72] = v27;
    v28 = 0i64;
  }
  else
  {
    v28 = v27 - v15;
  }
  if( v16 > v28 )
  {
    *(_QWORD *)&v38[80] = v28;
    v29 = 0i64;
  }
  else
  {
    v29 = v28 - v16;
  }
  if( v17 > v29 )
  {
    *(_QWORD *)&v38[88] = v29;
    v30 = 0i64;
  }
  else
  {
    v30 = v29 - v17;
  }
  if( v18 > v30 )
    *(_QWORD *)&v38[96] = v30;
  *(_OWORD *)SystemInformationLength = *(_OWORD *)v38;
  *(_OWORD *)(SystemInformationLength + 16) = *(_OWORD *)&v38[16];
  *(_OWORD *)(SystemInformationLength + 32) = *(_OWORD *)&v38[32];
  *(_OWORD *)(SystemInformationLength + 48) = *(_OWORD *)&v38[48];
  *(_OWORD *)(SystemInformationLength + 64) = *(_OWORD *)&v38[64];
  *(_OWORD *)(SystemInformationLength + 80) = *(_OWORD *)&v38[80];
  *(_OWORD *)(SystemInformationLength + 96) = *(_OWORD *)&v38[96];
  *(_OWORD *)(SystemInformationLength + 112) = v39;
  *(_OWORD *)(SystemInformationLength + 128) = v40;
  *(_OWORD *)(SystemInformationLength + 144) = v41;
  *(_OWORD *)(SystemInformationLength + 160) = v42;
  *v43 = 176;
  if( v32 )
    PsDereferencePartition((INT64)v33->Core.PartitionObject);
  return 0;
}

Referenced by:

EtwpLogMemInfo
ExpQuerySystemInformation
PfSnCheckActionsNeeded
PfpMemoryListQuery
PfpPfnPrioRequest
PfpPrefetchDirectoryStream
PfpPrefetchFilesTrickle
PfpPrefetchPrivatePages
PfpUpdateRepurposedByPrefetch
PfpVolumePrefetchMetadata