This fixes a crash with .NET application running with such locales, for example en-DE. The crash happens early in initialization, due to failure to return preferred UI language, which happens because there is no LCID -> locale name conversion for custom locales. It doesn't affect just preferred language, but also system default language, and other derived values.
-- v2: ntdll: Do not set system locales that resolve to custom-unspecified.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/ntdll/unix/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 062da7600b1..ad5a7c412d6 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -859,7 +859,7 @@ static void init_locale(void) if ((header = read_nls_file( "locale.nls" ))) { locale_table = (const NLS_LOCALE_HEADER *)((char *)header + header->locales); - if ((locale = get_win_locale( locale_table, system_locale ))) + if ((locale = get_win_locale( locale_table, system_locale )) && locale->idefaultlanguage != LOCALE_CUSTOM_UNSPECIFIED) system_lcid = locale->idefaultlanguage; if ((locale = get_win_locale( locale_table, user_locale ))) user_lcid = locale->idefaultlanguage;
On Thu Nov 17 21:07:31 2022 +0000, Nikolay Sivov wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/1417/diffs?diff_id=19227&start_sha=e7eb79d8dfd4200a740c727220a68203a0965a91#45baff72e86d02eaa20d67a51ee9cf83935c5125_864_864)
I just noticed that locale_init() depends on CUSTOM_UNSPECIFIED for system_lcid, this condition won't trigger now.