[PATCH v3 0/1] MR1417: ntdll: Do not set system locales that resolve to custom-unspecified.
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. -- v3: ntdll: Do not set system locales that resolve to custom-unspecified. https://gitlab.winehq.org/wine/wine/-/merge_requests/1417
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/ntdll/locale.c | 14 ++++---------- dlls/ntdll/unix/env.c | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 105de1feec4..73c0c2c5520 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -94,6 +94,7 @@ invalid: void locale_init(void) { + const NLS_LOCALE_LCID_INDEX *entry; USHORT utf8[2] = { 0, CP_UTF8 }; WCHAR locale[LOCALE_NAME_MAX_LENGTH]; LARGE_INTEGER unused; @@ -112,16 +113,9 @@ void locale_init(void) locale_table = (const NLS_LOCALE_HEADER *)((char *)header + header->locales); locale_strings = (const WCHAR *)((char *)locale_table + locale_table->strings_offset); - if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) - { - ansi_cp = oem_cp = CP_UTF8; - } - else - { - const NLS_LOCALE_LCID_INDEX *entry = find_lcid_entry( locale_table, system_lcid ); - ansi_cp = get_locale_data( locale_table, entry->idx )->idefaultansicodepage; - oem_cp = get_locale_data( locale_table, entry->idx )->idefaultcodepage; - } + entry = find_lcid_entry( locale_table, system_lcid ); + ansi_cp = get_locale_data( locale_table, entry->idx )->idefaultansicodepage; + oem_cp = get_locale_data( locale_table, entry->idx )->idefaultcodepage; NtQueryDefaultLocale( TRUE, &user_resource_lcid ); user_resource_neutral_lcid = PRIMARYLANGID( user_resource_lcid ); 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; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1417
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126360 Your paranoid android. === debian11 (32 bit report) === d3d9: stateblock: Timeout visual: Timeout d3dcompiler_43: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout d3dcompiler_46: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout d3dcompiler_47: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout d3drm: d3drm: Timeout vector: Timeout d3dx10_34: d3dx10: Timeout d3dx10_35: d3dx10: Timeout d3dx10_36: d3dx10: Timeout d3dx10_37: d3dx10: Timeout Report validation errors: d3dx10: Timeout === debian11 (build log) === WineRunWineTest.pl:error: The task timed out
Now with locale_init() section removed - utf-8 cp will be set only for recognized unicode locales, or through default activation context. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1417#note_16324
participants (3)
-
Marvin -
Nikolay Sivov -
Nikolay Sivov (@nsivov)