MiPfnReferenceCountIsZero

VOID __fastcall MiPfnReferenceCountIsZero(_MMPFN *Pfn1, UINT64 PageFrameIndex, UINT8 *a3){
  __int64 v4; 
  __int64 v5; 
  char v6; 
  if( (*((_QWORD *)Pfn1 + 3) & 0x3FFFFFFFFFFFFFFFi64) != 0 )
    KeBugCheckEx(0x4Eu, 7ui64, PageFrameIndex, *((_QWORD *)Pfn1 + 3) & 0x3FFFFFFFFFFFFFFFi64, 0i64);
  if( (*((_QWORD *)Pfn1 + 3) & 0x4000000000000000i64) != 0 )
  {
    v6 = *((_BYTE *)Pfn1 + 35);
    if( (v6 & 0x10) != 0 )
      *((_BYTE *)Pfn1 + 35) = v6 & 0xEF;
    MiReleasePageFileSpace(
      *(_MI_PARTITION **)(qword_140C4E388 + 8 * ((*((_QWORD *)Pfn1 + 5) >> 39) & 0x3FFi64)),
      *((_QWORD *)Pfn1 + 2),
      1i64);
    MiInsertPageInFreeOrZeroedList(PageFrameIndex, 2ui64);
  }
  else
  {
    v4 = *((_QWORD *)Pfn1 + 2);
    v5 = -9i64;
    if( (v4 & 0x400) != 0 )
      v5 = -2049i64;
    *((_QWORD *)Pfn1 + 2) = v4 & v5;
    if( (*((_BYTE *)Pfn1 + 34) & 0x10) != 0 )
      MiInsertPageInList(Pfn1, 8ui64);
    else
      MiInsertPageInList(Pfn1, 4ui64);
  }
}

Referenced by:

MiConvertStandbyToProto
MiCopyDataPageToImagePage
MiInsertProtectedStandbyPage
MiMakePageAvoidRead
MiMirrorPerformBrownWrites
MiNoPagesLastChance
MiPurgeBadFileOnlyPages
MiRemoveLockedPageChargeAndDecRef
MiResolveProtoPteFault
MiResolveTransitionFault
MiSwapHardFaultPage
MiUnlockImageSection
MiUnlockProtoPoolPage
MiWalkEntireImage
MiWriteCompletePfn
MmCheckCachedPageStates
MmUnlockPages