RtlpMuiRegGetInstalledLanguageIndexByLangId

NTSTATUS __stdcall RtlpMuiRegGetInstalledLanguageIndexByLangId(
        _MUIREGISTRYINFO *RegInfo,
        UINT16 LangId,
        UINT8 TryByName,
        INT16 *ResultIndexRtrn){
  unsigned int v4; 
  char v8; 
  NTSTATUS result; 
  NTSTATUS InstalledLanguageIndexByName; 
  __int64 v11; 
  INT64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int16 v15; 
  wchar_t *v16; 
  wchar_t *v17; 
  UINT8 v18; 
  _UNICODE_STRING String[3]; 

  v4 = LangId;
  v8 = 0;
  String[0] = 0i64;
  result = -1073741772;
  InstalledLanguageIndexByName = -1073741772;
  if( !RegInfo || !LangId )
    return -1073741811;
  if( LangId != 4096 )
  {
    v11 = *((_QWORD *)RegInfo + 3);
    v12 = 0i64;
    if( !*(_WORD *)(v11 + 6) )
    {
LABEL_15:
      v16 = (wchar_t *)MuiRegAllocArray(v12, 0x55ui64);
      v17 = v16;
      if( !v16 )
        return -1073741801;
      if( TryByName )
      {
        String[0].Buffer = v16;
        *(_DWORD *)&String[0].Length = 11141120;
        if( RtlLCIDToCultureName(v4, (INT64)String) )
          InstalledLanguageIndexByName = RtlpMuiRegGetInstalledLanguageIndexByName(
                                           RegInfo,
                                           String[0].Buffer,
                                           v18,
                                           ResultIndexRtrn);
      }
      ExFreePoolWithTag(v17, 0);
      if( v8 && InstalledLanguageIndexByName == -1073741772 )
        return -1073741637;
      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( ResultIndexRtrn )
            *ResultIndexRtrn = v12;
          return 0;
        }
        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