MiComputeImagePteIndex

INT64 __fastcall MiComputeImagePteIndex(INT64 a1, UINT64 a2){
  __int64 v2; 
  unsigned __int64 v3; 
  __int64 v4; 
  __int64 v5; 
  __int64 v6; 
  __int64 SubsectionDriverProtos; 
  __int64 *SharedProtos; 
  __int64 v9; 
  unsigned __int64 v11; 
  v2 = *(_QWORD *)(a1 + 16);
  v3 = *(_QWORD *)(a1 + 8) | 0x8000000000000000ui64;
  LODWORD(v4) = 0;
  if( qword_140C4DC80 && (v2 & 0x10) == 0 )
    v2 &= ~qword_140C4DC80;
  v5 = v2 >> 16;
  v6 = *(_QWORD *)v5;
  if( (*(_BYTE *)(v5 + 34) & 2) != 0 && (*(_DWORD *)(v6 + 56) & 0x4000000) != 0 )
  {
    SharedProtos = MiGetSharedProtos(*(_QWORD *)v5, a2, v5);
  }
  else
  {
    SubsectionDriverProtos = MiGetSubsectionDriverProtos((_QWORD *)v5);
    SharedProtos = (__int64 *)SubsectionDriverProtos;
    if( SubsectionDriverProtos )
    {
      v11 = *(_QWORD *)(SubsectionDriverProtos + 72);
      if( v3 < v11 || v3 >= v11 + 8i64 * *(unsigned int *)(v5 + 44) )
        SharedProtos = 0i64;
    }
  }
  if( SharedProtos )
  {
    v9 = SharedProtos[9];
    v4 = (__int64)(*(_QWORD *)(v5 + 8) - *(_QWORD *)(v6 + 136)) >> 3;
  }
  else
  {
    v9 = *(_QWORD *)(v6 + 136);
  }
  return(unsigned int)v4 + (unsigned int)((__int64)(v3 - v9) >> 3);
}

Referenced by:

MiReferenceInPageFile