MiRemoveUnusedSegments
VOID __stdcall MiRemoveUnusedSegments(_MI_PARTITION *Partition){
unsigned __int64 v1;
unsigned int v2;
unsigned __int64 v3;
unsigned __int64 v5;
int v6;
ULONG_PTR v7;
unsigned __int64 v8;
unsigned __int64 v9;
unsigned __int64 v10;
_BYTE *v11;
UINT64 v12;
int v13;
v2 = 0;
v3 = v1;
if( v1 )
{
if( v1 >= qword_140C527E8 )
v5 = 0i64;
else
v5 = qword_140C527E8 - v1;
v6 = 0;
}
else
{
v6 = 32;
v5 = 0i64;
}
v7 = 1000i64 * *((_QWORD *)Partition + 866) / qword_140C525D0;
if( v7 )
{
v8 = *((_QWORD *)Partition + 212);
v9 = v8;
if( v7 * (qword_140C4C6D8 / 0x3E8ui64) <= v8 )
v9 = v7 * (qword_140C4C6D8 / 0x3E8ui64);
if( v9 )
{
v10 = v8 - v9;
if( v10 < 0x100000 )
v10 = 0x100000i64;
while( 1 )
{
if( v3 )
{
if( qword_140C527E8 <= v5 )
return;
}
else
{
if( !v6 || qword_140C527E8 < 9 * (qword_140C52868 / 0xAui64) )
return;
--v6;
}
if( !MiShouldTrimUnusedSegments() || *((_QWORD *)Partition + 212) <= v10 )
return;
if( (++v2 & 0x3F) == 0 )
{
MiProcessDereferenceList(Partition);
if( v2 >= 0x80 )
CcUnmapInactiveViews(0i64, v12, 0i64);
KeDelayExecutionThread(0, 0, (PLARGE_INTEGER)&MiShortTime);
}
if( *((_MI_PARTITION **)Partition + 213) == (_MI_PARTITION *)((char *)Partition + 1704) )
{
if( *((_MI_PARTITION **)Partition + 215) == (_MI_PARTITION *)((char *)Partition + 1720) )
{
if( *((_DWORD *)Partition + 27) )
return;
CcUnmapInactiveViews(0i64, (UINT64)v11, 0i64);
if( !v13 )
return;
}
else
{
MiDeleteCachedSubsection(Partition);
}
}
else
{
MiDeleteCachedSegment(Partition, v11);
}
}
}
}
}Referenced by:
MiDereferenceSegmentThread
MiProcessDereferenceList