MiSetDeleteOnClose

VOID __stdcall MiSetDeleteOnClose(_CONTROL_AREA *ControlArea, UINT64 FailAllIo){
  int v3; 
  UINT64 v4; 
  unsigned __int64 v5; 
  union {unsigned int LongFlags;_MMSECTION_FLAGS Flags;} v6; 
  UINT64 v7; 

  v3 = FailAllIo;
  v4 = 0i64;
  v5 = (unsigned __int8)ExAcquireSpinLockExclusive((INT64 *)&ControlArea->ControlAreaLock);
  v6.LongFlags = (unsigned int)ControlArea->u;
  if( (v6.LongFlags & 0x40000) == 0 )
  {
    if( (v6.LongFlags & 0x8000000) != 0 )
    {
      MiRemoveUnusedSegment(ControlArea);
      ControlArea->u.LongFlags |= 0x40000u;
      MiInsertUnusedSegment(ControlArea);
      v4 = v7;
    }
    else
    {
      ControlArea->u.LongFlags = v6.LongFlags | 0x40000;
    }
  }
  if( v3 == 1 )
    ControlArea->u.LongFlags |= 0x10u;
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&ControlArea->ControlAreaLock);
  __writecr8(v5);
  if( v4 )
    MiReturnCrossPartitionSectionCharges(
      *(_MI_CROSS_PARTITION_CHARGES **)(*(&stru_140C4DB30 + 267) + 8i64 * (ControlArea->u1.Flags._bf_0 & 0x3FF)),
      1i64,
      v4);
}

Referenced by:

MiRelocateImage
MiWriteComplete