From 375668e1222375462314a26e70f25cbf411b6204 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 24 Mar 2020 12:39:28 +0100 Subject: [PATCH] kernelbase: Open registry keys before looking for sort table. Signed-off-by: Alexandre Julliard --- dlls/kernelbase/locale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 623cb01280b..53e4e42da3a 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -658,7 +658,7 @@ static const struct sortguid *get_language_sort( const WCHAR *locale ) const struct sortguid *ret; UNICODE_STRING str; GUID guid; - HKEY key; + HKEY key = 0; DWORD size, type; if (locale == LOCALE_NAME_USER_DEFAULT) @@ -734,8 +734,6 @@ void init_locale(void) RtlInitNlsTables( ansi_ptr, oem_ptr, sort.casemap, &nls_info ); RtlResetRtlTranslations( &nls_info ); - current_locale_sort = get_language_sort( LOCALE_NAME_USER_DEFAULT ); - RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\Nls", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &nls_key, NULL ); RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", @@ -743,6 +741,8 @@ void init_locale(void) RegCreateKeyExW( HKEY_CURRENT_USER, L"Control Panel\\International", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &intl_key, NULL ); + current_locale_sort = get_language_sort( LOCALE_NAME_USER_DEFAULT ); + if (GetDynamicTimeZoneInformation( &timezone ) != TIME_ZONE_ID_INVALID && !RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\TimeZoneInformation", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))