RtlpMuiRegConfigMatchesInstalled

char __fastcall RtlpMuiRegConfigMatchesInstalled(
        __int64 a1,
        unsigned __int8 a2,
        __int16 a3,
        char a4,
        unsigned __int16 a5,
        __int64 *a6,
        unsigned __int16 *a7){
  __int64 v7; 
  unsigned int v8; 
  __int64 v9; 
  wchar_t *v11; 
  bool v12; 
  char v13; 
  unsigned __int16 *v14; 
  __int64 v15; 
  unsigned __int16 v16; 
  __int64 v17; 
  __int64 *v18; 
  __int64 v19; 
  const WCHAR *v20; 
  wchar_t *v21; 
  __int64 v22; 
  const wchar_t *v23; 
  __int64 v24; 
  struct _UNICODE_STRING DestinationString; 
  __int16 v27; 
  UINT64 Lcid; 
  v7 = 0i64;
  v8 = a2;
  v9 = a3;
  LODWORD(Lcid) = 0;
  v27 = 0;
  v11 = 0i64;
  DestinationString = 0i64;
  if( a2 == a4 )
  {
    v12 = a3 == (__int16)a5;
LABEL_3:
    v13 = v12;
    goto LABEL_22;
  }
  if( !a2 || !a4 )
    goto LABEL_47;
  v14 = a7;
  if( a7 )
    *a7 = -1;
  if( a2 == 2 )
  {
    if( a1 )
    {
      if( a3 >= 0 )
      {
        v15 = *(_QWORD *)(a1 + 24);
        if( a3 < (int)*(unsigned __int16 *)(v15 + 6) )
        {
          v7 = *(_QWORD *)(v15 + 16) + 28i64 * a3;
          v13 = RtlpMuiRegLangInfoMatchesSpec(a1, v7, a4, a5);
          goto LABEL_22;
        }
      }
    }
    goto LABEL_47;
  }
  if( a4 != 2 )
  {
    v13 = 1;
    if( a2 == 1 )
    {
      if( a4 == 3 )
      {
        v19 = *(_QWORD *)(a1 + 32);
        if( v19 && (a5 & 0x8000u) == 0 && (__int16)a5 < (int)*(unsigned __int16 *)(v19 + 6) )
          v20 = (const WCHAR *)(*(_QWORD *)(v19 + 24) + 2i64 * *(__int16 *)(*(_QWORD *)(v19 + 16) + 2i64 * (__int16)a5));
        else
          v20 = 0i64;
        if( v20 )
        {
          RtlInitUnicodeString(&DestinationString, v20, v19);
          if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          {
            v12 = (_WORD)v9 == (unsigned __int16)Lcid;
            goto LABEL_3;
          }
        }
      }
    }
    else if( a2 == 3 && a4 == 1 )
    {
      v21 = (wchar_t *)MuiRegAllocArray(a1, 0x55u);
      v11 = v21;
      if( v21 )
      {
        DestinationString.Buffer = v21;
        *(_DWORD *)&DestinationString.Length = 11141120;
        if( RtlLCIDToCultureName((unsigned int)(__int16)a5, &DestinationString) )
        {
          v22 = *(_QWORD *)(a1 + 32);
          if( v22 && (v9 & 0x8000u) == 0i64 && (int)v9 < *(unsigned __int16 *)(v22 + 6) )
            v23 = (const wchar_t *)(*(_QWORD *)(v22 + 24) + 2i64 * *(__int16 *)(*(_QWORD *)(v22 + 16) + 2 * v9));
          else
            v23 = 0i64;
          if( v23 && !wcsicmp(DestinationString.Buffer, v23) )
            goto LABEL_48;
        }
      }
    }
LABEL_47:
    v13 = 0;
LABEL_48:
    if( v11 )
      ExFreePoolWithTag(v11, 0);
    v11 = 0i64;
    v7 = 0i64;
    goto LABEL_22;
  }
  if( !a1 )
    goto LABEL_47;
  v16 = a5;
  if( (a5 & 0x8000u) != 0 )
    goto LABEL_47;
  v17 = *(_QWORD *)(a1 + 24);
  if( (__int16)a5 >= (int)*(unsigned __int16 *)(v17 + 6) )
    goto LABEL_47;
  v11 = (wchar_t *)(*(_QWORD *)(v17 + 16) + 28i64 * (__int16)a5);
  v13 = RtlpMuiRegLangInfoMatchesSpec(a1, (__int64)v11, v8, a3);
  if( v13 && v11 && v14 )
    *v14 = v16;
  v7 = 0i64;
LABEL_22:
  v18 = a6;
  if( a6 )
  {
    if( v13 )
    {
      if( v11 )
      {
        *a6 = (__int64)v11;
      }
      else if( v7 )
      {
        *a6 = v7;
      }
      else
      {
        *a6 = 0i64;
        if( (int)RtlpMuiRegGetInstalledLanguageIndex(a1, v8, v9, &v27) >= 0 && v27 >= 0 )
        {
          v24 = *(_QWORD *)(a1 + 24);
          if( v27 < (int)*(unsigned __int16 *)(v24 + 6) )
            *v18 = *(_QWORD *)(v24 + 16) + 28i64 * v27;
        }
      }
    }
    else
    {
      *a6 = 0i64;
    }
  }
  return v13;
}

Referenced by:

RtlpMuiRegValidateConfigNode