RtlpMuiRegGetInstalledLanguageIndexByLangId

__int64 __fastcall RtlpMuiRegGetInstalledLanguageIndexByLangId(__int64 a1, unsigned __int16 a2, char a3, _WORD *a4){
  unsigned int v4; 
  char v8; 
  __int64 result; 
  unsigned int InstalledLanguageIndexByName; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int16 v15; 
  wchar_t *v16; 
  wchar_t *v17; 
  __int64 v18; 
  _UNICODE_STRING String; 
  v4 = a2;
  v8 = 0;
  String = 0i64;
  result = 3221225524i64;
  InstalledLanguageIndexByName = -1073741772;
  if( !a1 || !a2 )
    return 3221225485i64;
  if( a2 != 4096 )
  {
    v11 = *(_QWORD *)(a1 + 24);
    v12 = 0i64;
    if( !*(_WORD *)(v11 + 6) )
    {
LABEL_15:
      v16 = (wchar_t *)MuiRegAllocArray(v12, 0x55u);
      v17 = v16;
      if( v16 )
      {
        if( a3 )
        {
          String.Buffer = v16;
          *(_DWORD *)&String.Length = 11141120;
          if( RtlLCIDToCultureName(v4, &String) )
            InstalledLanguageIndexByName = RtlpMuiRegGetInstalledLanguageIndexByName(a1, String.Buffer, v18, a4);
        }
        ExFreePoolWithTag(v17, 0);
        if( v8 && InstalledLanguageIndexByName == -1073741772 )
          return 3221225659i64;
      }
      else
      {
        return(unsigned int)-1073741801;
      }
      return InstalledLanguageIndexByName;
    }
    v13 = *(_QWORD *)(v11 + 16);
    while( 1 )
    {
      v14 = 28i64 * (int)v12;
      if( *(_WORD *)(v14 + v13 + 4) == (_WORD)v4 )
      {
        v15 = *(_WORD *)(v14 + v13);
        if( (v15 & 0x1020) == 32 )
        {
          if( a4 )
            *a4 = v12;
          return 0i64;
        }
        if( (v15 & 0x1000) != 0 )
          v8 = 1;
      }
      v12 = (unsigned int)(v12 + 1);
      if( (int)v12 >= *(unsigned __int16 *)(v11 + 6) )
        goto LABEL_15;
    }
  }
  return result;
}

Referenced by:

RtlpMuiRegCreateKernelRegistryInfo
RtlpMuiRegGetInstalledLanguageIndex
RtlpMuiRegValidateInstalled