MiPrepareSegmentForDeletion

_MI_CONTROL_AREA_WAIT_BLOCK *__stdcall MiPrepareSegmentForDeletion(
        _CONTROL_AREA *ControlArea,
        ULONG_PTR MappedSubsection){
  INT64 *p_ControlAreaLock; 
  __int64 v4; 
  UINT8 v5; 
  unsigned __int64 v6; 
  _MI_CONTROL_AREA_WAIT_BLOCK *v7; 

  p_ControlAreaLock = (INT64 *)&ControlArea->ControlAreaLock;
  v4 = *(_QWORD *)&MappedSubsection;
  v5 = ExAcquireSpinLockExclusive((INT64 *)&ControlArea->ControlAreaLock);
  v6 = v5;
  MiDrainControlAreaWrites(ControlArea, v5);
  MiRemoveUnusedSegment(ControlArea);
  v7 = MiBuildWakeList(ControlArea, 1ui64);
  while( v4 )
  {
    if( (*(_BYTE *)(v4 + 34) & 8) != 0 )
      MiRemoveUnusedSubsection((_MSUBSECTION *)v4);
    MiIncrementSubsectionViewCount((_MSUBSECTION *)v4, 0i64);
    v4 = *(_QWORD *)(v4 + 16);
  }
  ExReleaseSpinLockExclusiveFromDpcLevel(p_ControlAreaLock);
  __writecr8(v6);
  return v7;
}

Referenced by:

MiSegmentDelete