MiClearPfnImageVerified

UINT8 __fastcall MiClearPfnImageVerified(UINT64 a1, CHAR dl0){
  UINT8 result; 
  UINT8 v5; 
  int PagePrivilege; 
  __int64 v7; 
  int v8; 
  __int16 v9; 
  __int128 a2; 
  a2 = 0i64;
  result = (*(_QWORD *)(a1 + 40) >> 60) & 7;
  if( result == 3 )
  {
    if( (dl0 & 4) != 0 )
      v5 = 17;
    else
      v5 = MiLockPageInline(a1);
    if( (dl0 & 8) != 0 )
    {
      PagePrivilege = MiGetPagePrivilege(a1, 1, (unsigned __int64 *)&a2);
      if( PagePrivilege )
      {
        v7 = (__int64)(a1 - (_QWORD)MmGetPfnDb()) / 48;
        if( (PagePrivilege & 0x20) != 0 )
          LOWORD(v8) = 512;
        else
          v8 = (dl0 & 0x10) != 0 ? 32 : 16;
        v9 = v8 | 0x80;
        if( (dl0 & 0x40) == 0 )
          v9 = v8;
        if( KeSetPagePrivilege(v7, &a2, v9) < 0 )
          KeBugCheckEx(0x1Au, 0x5150Bui64, v7, 0i64, 0i64);
      }
    }
    result = -1;
    *(_QWORD *)(a1 + 40) &= 0x8FFFFFFFFFFFFFFFui64;
    if( v5 != 17 )
    {
      _InterlockedAnd64((volatile signed __int64 *)(a1 + 24), 0x7FFFFFFFFFFFFFFFui64);
      result = v5;
      __writecr8(v5);
    }
  }
  return result;
}

Referenced by:

MiCopyPage
MiDeleteClusterPage
MiDeleteClusterSection
MiDeletePerSessionProtos
MiFlushSectionInternal
MiGatherMappedPages
MiInsertPageInFreeOrZeroedList
MiInsertPageInList
MiProbeLeafPteAccess
MiReadyLargePageToFree
MiReferencePageForModifiedWrite
MiRestoreTransitionPte
MmChangeImageProtection