MiGetValidAwePartitionId

UINT64 __fastcall MiGetValidAwePartitionId(INT64 a1){
  unsigned __int64 v1; 
  unsigned __int64 v2; 
  UINT64 v5; 
  v5 = a1;
  v1 = a1;
  if( (a1 & 1) != 0 )
  {
    MiPteInShadowRange((UINT64)&v5);
  }
  else if( qword_140C4DC80 && (a1 & 0x10) == 0 )
  {
    v1 = a1 & ~qword_140C4DC80;
  }
  v2 = *((_QWORD *)MmGetPfnDb() + 6 * ((v1 >> 12) & 0xFFFFFFFFFi64) + 5);
  if( ((v2 >> 50) & 1) != 0 )
    return(v2 >> 39) & 0x3FF;
  else
    return 0;
}

Referenced by:

MiGetPageProtection