MiMakeUnusedSegmentDeleteOnClose
INT64 __fastcall MiMakeUnusedSegmentDeleteOnClose(INT64 a1){
INT64 *v1;
KIRQL v3;
_QWORD *v4;
KIRQL v5;
_QWORD *v6;
_CONTROL_AREA *v7;
INT64 *v8;
UINT64 inserted;
INT64 result;
v1 = (INT64 *)(a1 + 1344);
v3 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)(a1 + 1344));
v4 = (_QWORD *)(a1 + 1704);
while( 1 )
{
v5 = v3;
v6 = (_QWORD *)*v4;
if( (_QWORD *)*v4 == v4 )
break;
v7 = (_CONTROL_AREA *)(v6 - 1);
v8 = v6 + 8;
if( (unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel(v8) )
{
MiUnlinkUnusedControlArea((INT64)v7);
ExReleaseSpinLockExclusiveFromDpcLevel(v1);
inserted = MiInsertUnusedSegment(v7);
ExReleaseSpinLockExclusiveFromDpcLevel(v8);
__writecr8(v5);
if( inserted )
MiReturnCrossPartitionSectionCharges((volatile INT64 *)a1, 1i64, inserted);
}
else
{
ExReleaseSpinLockExclusiveFromDpcLevel(v1);
__writecr8(v5);
}
v3 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)v1);
}
ExReleaseSpinLockExclusiveFromDpcLevel(v1);
result = v5;
__writecr8(v5);
return result;
}Referenced by:
MiDrainCrossPartitionUsage