MiDecrementSubsectionViewCount
NTSTATUS __stdcall MiDecrementSubsectionViewCount(_MSUBSECTION *MappedSubsection){
char v1;
_CONTROL_AREA *ControlArea;
_MSUBSECTION *v3;
NTSTATUS v4;
unsigned __int64 NumberOfMappedViews;
int v7;
__int16 v8;
_EPROCESS *Process;
_MI_PARTITION *v10;
INT64 v11;
__int64 v12;
int v13;
INT64 *v14;
ControlArea = MappedSubsection->Core.ControlArea;
v3 = MappedSubsection;
if( MappedSubsection->Core.ControlArea->FilePointer.Value
&& (ControlArea->u.LongFlags & 0x20) == 0
&& (MappedSubsection->Core.u.SubsectionFlags._bf_2 & 1) == 0
&& !MappedSubsection->NumberOfMappedViews )
{
KeBugCheckEx(0x1Au, (PVOID)0x42001, MappedSubsection, 0i64, 0i64);
}
v4 = 0;
if( (v1 & 4) == 0 && (v1 & 8) != 0 )
{
LOBYTE(v7) = MiControlAreaExemptFromCrossPartitionCharges((INT64)MappedSubsection->Core.ControlArea);
if( !v7 )
{
if( (v8 & 0x10) != 0 )
{
v10 = 0i64;
}
else if( (v8 & 0x80u) != 0 )
{
v10 = &Irp;
}
else
{
Process = KeGetCurrentThread()->ApcState.Process;
v10 = (v8 & 0x100) != 0 ? *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267)
+ 8i64 * *((unsigned __int16 *)Process->Session + 215)) : *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267) + 8i64 * Process->Vm.Instance.PartitionId);
}
if( v10 != *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267) + 8i64 * (ControlArea->u1.Flags._bf_0 & 0x3FF)) )
{
LODWORD(v11) = MiGetSubsectionHoldingCrossPartitionReferences((INT64)v3);
LODWORD(v12) = MiGetSubsectionHoldingCrossPartitionReferences(v11);
v13 = *(_DWORD *)(v12 + 48) & 0x3FFFFFFF;
if( v13 != 0x3FFFFFFF )
{
MiUpdateSubsectionCrossPartitionRefs(v3, v13 - 1);
if( v13 == 1 )
v4 = MiComputeCrossPartitionSectionCharges(v14);
}
}
}
}
if( ControlArea->FilePointer.Value
&& (ControlArea->u.LongFlags & 0x20) == 0
&& (v3->Core.u.SubsectionFlags._bf_2 & 1) == 0 )
{
NumberOfMappedViews = v3->NumberOfMappedViews;
if( !NumberOfMappedViews )
KeBugCheckEx(0x1Au, (PVOID)0x42001, v3, 0i64, 0i64);
v3->NumberOfMappedViews = NumberOfMappedViews - 1;
}
return v4;
}Referenced by:
MiAppendSubsectionChain
MiCreatePrototypePtes
MiDecrementSubsections
MiDeleteCachedSubsection
MiDeleteControlArea
MiDeleteSubsectionPages
MiExtendSection
MiFlushSectionInternal
MiRemoveViewsFromSection
MiReturnCrossPartitionControlAreaCharges
MiUpControlAreaRefs
MmPurgeSection