RtlpLoadInstallLanguageFallback

NTSTATUS __stdcall RtlpLoadInstallLanguageFallback(_MUIREGISTRYINFO *RegInfo, UINT16 *BaseLangId, UINT16 *ParentOfBase){
  UINT8 *v5; 
  UINT8 *v6; 
  UINT64 v7; 
  int v8; 
  wchar_t v10; 
  const wchar_t *v11; 
  wchar_t *v12; 
  wchar_t i; 
  UINT64 *KeyValueLength; 
  INT64 v15; 
  UINT64 v16; 
  VOID *ChildHandle; 
  _UNICODE_STRING DestinationString; 
  UINT64 Lcid; 
  UINT64 KeyValueType; 

  ChildHandle = 0i64;
  LODWORD(Lcid) = 0;
  v5 = 0i64;
  DestinationString = 0i64;
  if( RegInfo && BaseLangId && ParentOfBase )
  {
    v6 = MuiRegAllocArray((INT64)RegInfo, 0xACui64);
    v5 = v6;
    if( v6 )
    {
      memset(v6, 0i64, 0x158u);
      *BaseLangId = 0;
      LODWORD(KeyValueType) = 0;
      *ParentOfBase = 0;
      RtlInitUnicodeString(
        &DestinationString,
        L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\NLS\\Language");
      v8 = LdrpOpenKey(&DestinationString, 0i64, v7, &ChildHandle, (INT64)KeyValueLength, v15, v16, (INT64)ChildHandle);
      if( v8 >= 0 )
      {
        RtlInitUnicodeString(&DestinationString, L"InstallLanguageFallback");
        LODWORD(v16) = 8;
        v8 = LdrpQueryValueKey(ChildHandle, &DestinationString, &KeyValueType, v5, &v16);
        if( v8 >= 0 )
        {
          if( (_DWORD)KeyValueType != 1 )
            goto LABEL_15;
          v10 = *(_WORD *)v5;
          v11 = (const wchar_t *)v5;
          while( v10 )
          {
            v12 = (wchar_t *)(v11 + 1);
            if( v10 == 44 )
            {
              *v11++ = 0;
              for( i = *v12; i && i == 32; i = *v11 )
                ++v11;
              break;
            }
            v10 = *v12;
            ++v11;
          }
          RtlInitUnicodeString(&DestinationString, (PCWSTR)v5);
          if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          {
            *BaseLangId = Lcid;
            if( *v11 )
            {
              RtlInitUnicodeString(&DestinationString, v11);
              if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
              {
                *ParentOfBase = Lcid;
              }
              else
              {
                v8 = -1073741823;
                *BaseLangId = 0;
              }
            }
          }
          else
          {
LABEL_15:
            v8 = -1073741823;
          }
        }
      }
    }
    else
    {
      v8 = -1073741801;
    }
  }
  else
  {
    v8 = -1073741811;
  }
  if( ChildHandle )
    ZwClose((_HANDLE)ChildHandle);
  if( v5 )
    ExFreePoolWithTag(v5, 0);
  return v8;
}

Referenced by:

RtlpMuiRegLoadInstalled
RtlpMuiRegPopulateBaseLanguages