title: GetUserPreferredUILanguages() never returns more than two languages
body: <p>I'm trying to retrieve the complete list of the user's preferred languages from a C++/Qt application, as configured in the "Region &amp; language" page in the user's preferences:</p>
  
  <p><a href="https://i.stack.imgur.com/HTftr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HTftr.png" alt="Preferred languages"></a></p>
  
  <p>For that, I am trying with the WinAPI function <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winnls/nf-winnls-getuserpreferreduilanguages" rel="noreferrer">GetUserPreferredUILanguages()</a>, on an up-to-date Windows 10 Pro system.</p>
  
  <p>However, the function always only returns the first entry (the main Windows display language), and "en-US". If English is configured as the main language, then only "en-US" is returned. E.g., if I have (German, French, English) configured, ["de-de", "en-US"] is returned, French is omitted. If I add more languages to the list, they are omitted as well.
  I also looked at <a href="https://docs.microsoft.com/en-gb/windows/desktop/Intl/user-interface-language-management" rel="noreferrer">User Interface Language Management</a>, but to no avail. GetSystemPreferredUILanguages() for example only returns "en-US". <a href="https://docs.microsoft.com/en-us/windows/desktop/api/Muiload/nf-muiload-getuilanguagefallbacklist" rel="noreferrer">GetUILanguageFallbackList()</a> returns ["de-de", "de", "en-US", "en"].</p>
  
  <p>The code I use:</p>
  
  <pre><code>// calling GetUserPreferredUILanguages() twice, once to get number of 
  // languages and required buffer size, then to get the actual data
  
  ULONG numberOfLanguages = 0;
  DWORD bufferLength = 0;
  const auto result1 = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME,
                                                   &amp;numberOfLanguages,
                                                   nullptr,
                                                   &amp;bufferLength);
  // result1 is true, numberOfLanguages=2
  
  QVector&lt;wchar_t&gt; languagesBuffer(static_cast&lt;int&gt;(bufferLength));
  const auto result2 = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME,
                                                   &amp;numberOfLanguages,
                                                   languagesBuffer.data(),
                                                   &amp;bufferLength);
  
  // result2 is true, languageBuffer contains "de-de", "en-US"
  </code></pre>
  
  <p>Is this not the right function to use, or am I misunderstanding something about the language configuration in Windows 10? How can I get the complete list of preferred languages? I see <a href="https://docs.microsoft.com/en-us/uwp/api/windows.system.userprofile.globalizationpreferences.languages" rel="noreferrer">UWP API</a> that might do the job, but if possible, I'd like to use C API, as it integrated more easily with the C++ codebase at hand. (unmanaged C++, that is)</p>