MiFreePartitionPhysicalPages

VOID __stdcall MiFreePartitionPhysicalPages(_MI_PARTITION *FromPartition){
  _MI_PARTITION *v1; 
  void *NumberOfPhysicalPages; 
  _MI_PARTITION *v3; 
  unsigned int v5; 
  unsigned __int64 *p_NumberOfPagesGoingBad; 
  unsigned __int64 TotalCommitLimit; 

  NumberOfPhysicalPages = (void *)FromPartition->Vp.NumberOfPhysicalPages;
  v3 = v1;
  MiReturnPartitionPagesToParent(FromPartition);
  v5 = 0;
  if( KeNumberNodes )
  {
    p_NumberOfPagesGoingBad = &FromPartition->Core.NodeInformation->NumberOfPagesGoingBad;
    do
    {
      if( *p_NumberOfPagesGoingBad )
        KeBugCheckEx(0x1Au, (PVOID)0x41008, (PVOID)*p_NumberOfPagesGoingBad, 0i64, 0i64);
      p_NumberOfPagesGoingBad += 568;
      ++v5;
    }
    while( v5 < (unsigned __int16)KeNumberNodes );
  }
  if( FromPartition->PageLists.BadPageListHead.Total )
    KeBugCheckEx(
      0x1Au,
      (PVOID)0x41006,
      NumberOfPhysicalPages,
      (PVOID)FromPartition->Vp.NumberOfPhysicalPages,
      (PVOID)FromPartition->Vp.AvailablePages);
  if( FromPartition->Vp.NumberOfPhysicalPages )
    KeBugCheckEx(
      0x1Au,
      (PVOID)0x41005,
      NumberOfPhysicalPages,
      (PVOID)FromPartition->Vp.NumberOfPhysicalPages,
      (PVOID)FromPartition->Vp.AvailablePages);
  if( FromPartition->Vp.AvailablePages )
    KeBugCheckEx(0x1Au, (PVOID)0x41004, NumberOfPhysicalPages, (PVOID)FromPartition->Vp.AvailablePages, 0i64);
  if( (void *)FromPartition->Vp.ResidentAvailablePages != NumberOfPhysicalPages
    || FromPartition->Vp.ResidentAvailablePages != FromPartition->Vp.TotalCommitLimit )
  {
    KeBugCheckEx(
      0x1Au,
      (PVOID)0x41003,
      NumberOfPhysicalPages,
      (PVOID)FromPartition->Vp.ResidentAvailablePages,
      (PVOID)FromPartition->Vp.TotalCommitLimit);
  }
  MiReturnResident((INT64)v3, FromPartition->Vp.ResidentAvailablePages);
  TotalCommitLimit = FromPartition->Vp.TotalCommitLimit;
  if( v3 == &Irp )
  {
    MiReturnCommit(v3, TotalCommitLimit);
    _InterlockedExchangeAdd64((_QWORD *)&stru_140C4DB30 + 569, -(__int64)TotalCommitLimit);
  }
  else
  {
    MiIncreaseCommitLimits(v3, TotalCommitLimit, TotalCommitLimit, 0i64, 0i64);
  }
}

Referenced by:

MiDeletePartitionResources