MiPrepareSegmentForDeletion

_MI_CONTROL_AREA_WAIT_BLOCK *__stdcall MiPrepareSegmentForDeletion(
        _CONTROL_AREA *ControlArea,
        _MSUBSECTION *MappedSubsection){
  INT64 *v2; 
  KIRQL v5; 
  unsigned __int64 v6; 
  _MI_CONTROL_AREA_WAIT_BLOCK *v7; 
  _MI_CONTROL_AREA_WAIT_BLOCK *v8; 
  v2 = (INT64 *)((char *)ControlArea + 72);
  v5 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)ControlArea + 18);
  v6 = v5;
  MiDrainControlAreaWrites(ControlArea, v5);
  MiRemoveUnusedSegment(ControlArea);
  MiBuildWakeList(ControlArea, 1ui64);
  v8 = v7;
  while( MappedSubsection )
  {
    if( (*((_BYTE *)MappedSubsection + 34) & 8) != 0 )
      MiRemoveUnusedSubsection(MappedSubsection);
    MiIncrementSubsectionViewCount((INT64 *)MappedSubsection, 0);
    MappedSubsection = (_MSUBSECTION *)*((_QWORD *)MappedSubsection + 2);
  }
  ExReleaseSpinLockExclusiveFromDpcLevel(v2);
  __writecr8(v6);
  return v8;
}

Referenced by:

MiSegmentDelete