MiMapExParametersInitialize

INT64 __fastcall MiMapExParametersInitialize(INT64 a1, _QWORD *a2, INT64 a3){
  _CONTROL_AREA *v5; 
  UINT64 *v6; 
  __int64 v7; 
  unsigned int v8; 
  _CONTROL_AREA *v9; 
  UINT64 v10; 
  UINT64 UserReservationHighestAddress; 
  unsigned __int64 v12; 
  int v13; 
  unsigned int v14; 
  v5 = MiSectionControlArea((_SECTION *)a2[4]);
  v8 = 0;
  v9 = v5;
  if( v6[2] )
    return(unsigned int)-1073741811;
  if( (*(_DWORD *)(v7 + 40) & 0x4000) != 0 )
  {
    if( *v6 || v6[1] )
      return(unsigned int)-1073741811;
    *(_DWORD *)(v7 + 60) |= 0x4000000u;
    *(_DWORD *)(v7 + 72) |= 2u;
    *(_QWORD *)(v7 + 16) = 4096i64;
  }
  v10 = *v6;
  if( ((*(_QWORD *)(v7 + 16) - 1i64) & *v6) != 0 || *a2 && (v10 || v6[1] || v6[2]) )
    return(unsigned int)-1073741811;
  UserReservationHighestAddress = v6[1];
  if( UserReservationHighestAddress )
  {
    if( UserReservationHighestAddress <= 0x7FFFFFFEFFFFi64 && (((_WORD)UserReservationHighestAddress + 1) & 0xFFF) == 0 )
      goto LABEL_7;
    return(unsigned int)-1073741811;
  }
  UserReservationHighestAddress = MiGetUserReservationHighestAddress(a2[5], 0i64);
  *(_QWORD *)(a3 + 8) = UserReservationHighestAddress;
LABEL_7:
  if( v10 >= UserReservationHighestAddress )
    return(unsigned int)-1073741811;
  v12 = a2[1];
  if( v12 )
  {
    if( UserReservationHighestAddress - v10 + 1 < v12 )
      return(unsigned int)-1073741811;
  }
  v13 = *(_DWORD *)(v7 + 40);
  if( (v13 & 0x7F) != 0 )
    return(unsigned int)-1073741811;
  if( *(_DWORD *)(v7 + 52) != v8 )
    return(unsigned int)-1073741811;
  v14 = *(_DWORD *)(a3 + 32);
  if( v14 > (unsigned __int16)KeNumberNodes || (v13 & 0x40000000) != 0 && (*((_DWORD *)v9 + 14) & 0x420) != 0 )
    return(unsigned int)-1073741811;
  if( (v13 & 0x20000000) != 0 && (*((_DWORD *)v9 + 14) & 0x20) != 0 && (*(_DWORD *)(v7 + 72) & 1) != 0 )
    return(unsigned int)-1073741811;
  if( (*(_BYTE *)(a3 + 56) & 0x20) != 0 )
  {
    *(_DWORD *)(v7 + 60) |= 2u;
    v14 = *(_DWORD *)(a3 + 32);
  }
  *(_DWORD *)(v7 + 52) = v14;
  *(_QWORD *)v7 = *(_QWORD *)a3;
  *(_QWORD *)(v7 + 8) = *(_QWORD *)(a3 + 8);
  *(_DWORD *)(v7 + 40) = v13 & 0xFFFFBFFF;
  return v8;
}

Referenced by:

MiMapViewOfSectionExCommon