MiLockProtoPoolPage
_MMPFN *__fastcall MiLockProtoPoolPage(_MMPTE *ProtoPte, UINT8 *PageIrql){
UINT64 *v3;
char *v4;
UINT64 v5;
UINT64 v6;
__int64 v7;
char *v8;
UINT8 CurrentIrql;
UINT64 v10;
UINT64 SpinCount;
UINT64 v13;
UINT64 v14;
v3 = (UINT64 *)((char *)MmGetPteBase() + (((unsigned __int64)ProtoPte >> 9) & 0x7FFFFFFFF8i64));
v4 = (char *)MmGetPfnDb() + 40;
v14 = *v3;
v5 = v14 & 1;
do
{
if( !v5 )
return 0i64;
v6 = v14;
if( (v14 & 0x200) != 0 )
return 0i64;
MiPteInShadowRange((UINT64)&v14);
v7 = (v6 >> 12) & 0xFFFFFFFFFi64;
}
while( (*(_QWORD *)&v4[48 * v7] & 0x4000000000000i64) == 0 );
v8 = (char *)MmGetPfnDb() + 48 * v7;
if( PageIrql )
{
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
LODWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)v8 + 6, 0x3Fui64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( *((__int64 *)v8 + 3) < 0 );
}
}
else
{
LODWORD(v13) = 0;
CurrentIrql = 17;
while( _interlockedbittestandset64((volatile signed __int32 *)v8 + 6, 0x3Fui64) )
{
do
KeYieldProcessorEx(&v13);
while( *((__int64 *)v8 + 3) < 0 );
}
}
v10 = *v3;
v14 = v10;
if( (v10 & 1) == 0 || (v10 & 0x200) != 0 || v7 != ((v10 >> 12) & 0xFFFFFFFFFi64) )
{
_InterlockedAnd64((volatile signed __int64 *)v8 + 3, 0x7FFFFFFFFFFFFFFFui64);
if( CurrentIrql != 17 )
__writecr8(CurrentIrql);
return 0i64;
}
if( !(unsigned int)MiAreChargesNeededToLockPage((INT64)v8) || (unsigned int)MiChargeForLockedPage((INT64)v8, 1) )
++*((_WORD *)v8 + 16);
if( CurrentIrql != 17 )
*PageIrql = CurrentIrql;
MiLockOwnedProtoPage((INT64)v8, CurrentIrql);
return(_MMPFN *)v8;
}Referenced by:
MiAllocateInPageSupport
MiConvertPrivateToProto
MiConvertStandbyToProto
MiDeleteMergedPte
MiDeletePerSessionProtos
MiDeleteSubsectionPages
MiEliminateStaleExtents
MiEnableLargeSubsection
MiGetPageFileSectionForReservation
MiInitializeDynamicPfns
MiInitializeImageProtos
MiInitializeProtoPfn
MiInsertLargeVadMapping
MiLockCode
MiMakeImageReadOnly
MiMigratePfn
MiPfPutPagesInTransition
MiPurgeImageSection
MiReplaceLockedPage
MiResolveProtoCombine
MiSectionCreated
MiSoftFaultMappedView
MiTranslatePageForCopy
MiWalkEntireImage
MiWalkVaRange
MiZeroCfgSystemWideBitmapWorker
MmCheckCachedPageStates
MmCopyToCachedPage