MiUpdateActiveSubsection
UINT8 __fastcall MiUpdateActiveSubsection(UINT64 GrantedAccess, UINT64 DesiredAccess){
_SUBSECTION *v2;
unsigned int v3;
NTSTATUS FileExtents;
UINT64 v5;
INT64 *v6;
unsigned __int8 v7;
unsigned int v8;
int v9;
__int64 v10;
UINT64 AllocationFlags;
unsigned int v13;
__int64 v14;
v2 = (_SUBSECTION *)GrantedAccess;
v3 = 0;
v14 = *(_QWORD *)GrantedAccess;
LOBYTE(FileExtents) = 0;
v5 = 0i64;
v6 = (INT64 *)(*(_QWORD *)GrantedAccess + 72i64);
v7 = ExAcquireSpinLockExclusive(v6);
do
{
if( !v2->SubsectionBase || (v2->_bf_34 & 0x40000000) == 0 )
goto LABEL_10;
if( MiReferenceSubsection(v2, 0i64) < 2 )
{
ExReleaseSpinLockExclusiveFromDpcLevel(v6);
__writecr8(v7);
return 0;
}
v8 = v2->PtesInSubsection - (v2->_bf_34 & 0x3FFFFFFF);
v13 = v8;
ExReleaseSpinLockExclusiveFromDpcLevel(v6);
__writecr8(v7);
LODWORD(AllocationFlags) = 0;
FileExtents = MiAllocateFileExtents(v2, 0i64, v2->SubsectionBase, v8, AllocationFlags);
v9 = 0;
v7 = ExAcquireSpinLockExclusive(v6);
if( FileExtents >= 0 && v13 != v2->PtesInSubsection - (v2->_bf_34 & 0x3FFFFFFF) )
v9 = 1;
LODWORD(v10) = MiDecrementSubsections(v2, v2, 0i64);
v5 += v10;
if( v9 != 1 )
{
if( FileExtents < 0 )
break;
LABEL_10:
v2 = v2->NextSubsection;
}
}
while( v2 );
ExReleaseSpinLockExclusiveFromDpcLevel(v6);
__writecr8(v7);
if( v5 )
{
LOBYTE(v3) = *(_QWORD *)(v14 + 64) != 0i64;
MiReturnCrossPartitionSectionCharges(
*(_MI_CROSS_PARTITION_CHARGES **)(*(&stru_140C4DB30 + 267) + 8i64 * (*(_WORD *)(v14 + 60) & 0x3FF)),
v3,
v5);
}
return FileExtents;
}Referenced by:
MmExtendSection