MiProcessDeleteOnClose
VOID __stdcall MiProcessDeleteOnClose(_MI_PARTITION *Partition, UINT64 Exiting){
_LIST_ENTRY *p_DeleteOnCloseList;
_MI_PARTITION_SEGMENTS *p_Segments;
int v4;
unsigned int v5;
unsigned __int64 v7;
_LIST_ENTRY *Flink;
_CONTROL_AREA *p_Blink;
INT64 *v10;
_BYTE *v11;
UINT64 v12;
UINT64 v13;
INT16 v14;
int v15;
unsigned int DeleteOnCloseCount;
_FILE_OBJECT *AcquiredFileObject;
_MI_CONTROL_AREA_WAIT_BLOCK *Gate;
AcquiredFileObject = 0i64;
p_DeleteOnCloseList = &Partition->Segments.DeleteOnCloseList;
Gate = 0i64;
p_Segments = &Partition->Segments;
v4 = 0;
v5 = -1;
while( 1 )
{
v7 = (unsigned __int8)ExAcquireSpinLockExclusive((INT64 *)&p_Segments->SegmentListLock);
Flink = p_DeleteOnCloseList->Flink;
if( p_DeleteOnCloseList->Flink == p_DeleteOnCloseList )
break;
if( (++v4 & 0x3F) == 0 && Partition->Segments.DeleteOnCloseCount >= v5 )
{
if( Flink != p_DeleteOnCloseList )
{
Partition->Segments.DeleteOnCloseTimerActive = 1;
KiSetTimerEx(&Partition->Segments.DeleteOnCloseTimer, Mi10Milliseconds, 0i64, 0, 0i64);
goto LABEL_20;
}
break;
}
p_Blink = (_CONTROL_AREA *)&Flink[-1].Blink;
DeleteOnCloseCount = Partition->Segments.DeleteOnCloseCount;
v10 = (INT64 *)&Flink[4];
if( !(unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel(v10) )
{
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&p_Segments->SegmentListLock);
__writecr8(v7);
goto LABEL_2;
}
MiUnlinkUnusedControlArea((INT64)p_Blink);
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&p_Segments->SegmentListLock);
if( (p_Blink->u.LongFlags & 0x20) != 0 )
{
LOBYTE(v11) = v7;
MiDestroySection(p_Blink, (INT16)v11, 0i64);
goto LABEL_2;
}
if( p_Blink->ModifiedWriteCount )
{
MiInsertUnusedSegment(p_Blink);
v13 = v12;
ExReleaseSpinLockExclusiveFromDpcLevel(v10);
__writecr8(v7);
if( v13 )
MiReturnCrossPartitionSectionCharges((_MI_CROSS_PARTITION_CHARGES *)Partition, 1i64, v13);
LABEL_2:
v5 = DeleteOnCloseCount;
}
else
{
AcquiredFileObject = 0i64;
LOBYTE(v11) = v7;
MiFlushControlArea(p_Blink, v11, &Gate, &AcquiredFileObject);
if( v15 == 1 )
{
LOBYTE(v14) = v7;
MiDestroySection(p_Blink, v14, AcquiredFileObject);
}
v5 = DeleteOnCloseCount;
if( Gate )
MiReleaseControlAreaWaiters(Gate);
}
}
Partition->Segments.DeleteOnCloseTimerActive = 0;
LABEL_20:
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&p_Segments->SegmentListLock);
__writecr8(v7);
}Referenced by:
MiDereferenceSegmentThread