c++windowswinapiwindows-mui

Getting Language of Windows Startup Messages


I'm currently trying to get my head around MUI, and getting some issues with GetSystemDefaultUILanguage - it's not returning the language I'd expect:

Welcome screen and new user accounts settings dialog

Users can set the language used for Windows startup messages in the "Welcome screen and new user accounts settings" dialog - which claims to copy language settings to system accounts. I'd expect therefore to be able to get the language used by startup messages using GetSystemDefaultUILanguage - but it seems to only ever come back with the language used to originally install the OS. How can I get the startup messages language?


Solution

  • It appears that GetSystemDefaultUILanguage returns the language that the OS was originally installed with. In 2K8 R2 at least (and probably other post-Vista OSes) users can modify the language used for boot up messages - but this is unfortunately not reflected through GetSystemDefaultUILanguage.

    It can however be looked up via the registry. The following value stores a textual description (e.g. en-US) of the language:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\Settings\PreferredUILanguages
    

    This value only appears to be set on machines with multiple languages installed (and possibly only when a user has changed the Welcome Screen language).

    So, to get the current Welcome Screen language, the flow appears to be:

    This wouldn't be such a pain if we weren't trying to display things in a different language at boot time! Normally you can just use GetUserDefaultUILanguage.