mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
glib/gtimezone.c: Use RegLoadMUIStringW() to query Std/Dlt strings
The existing method of using RegQueryValueExW() to query the Std/Dlt strings can only retrive the localized versions of those strings, so that means they will vary by the language version of Windows. Instead, use RegQueryValueExW() only as a fallback when RegLoadMUIStringW() fails, as RegLoadMUIStringW() can query for the Std and Dlt strings in whatever language we need by setting the locale stuff programatically on the fly.
This commit is contained in:
parent
c868123c0a
commit
2e5d3aa911
@ -729,8 +729,12 @@ rules_from_windows_time_zone (const gchar *identifier,
|
||||
DWORD size;
|
||||
guint rules_num = 0;
|
||||
RegTZI regtzi, regtzi_prev;
|
||||
WCHAR winsyspath[MAX_PATH];
|
||||
gunichar2 *subkey_w, *subkey_dynamic_w;
|
||||
|
||||
if (GetSystemDirectoryW (winsyspath, MAX_PATH) == 0)
|
||||
return 0;
|
||||
|
||||
g_assert (out_identifier != NULL);
|
||||
g_assert (rules != NULL);
|
||||
|
||||
@ -758,18 +762,33 @@ rules_from_windows_time_zone (const gchar *identifier,
|
||||
|
||||
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, subkey_w, 0,
|
||||
KEY_QUERY_VALUE, &key) != ERROR_SUCCESS)
|
||||
return 0;
|
||||
goto utf16_conv_failed;
|
||||
|
||||
size = sizeof tzi.StandardName;
|
||||
if (RegQueryValueExW (key, L"Std", NULL, NULL,
|
||||
(LPBYTE)&(tzi.StandardName), &size) != ERROR_SUCCESS)
|
||||
goto registry_failed;
|
||||
|
||||
/* use RegLoadMUIStringW() to query MUI_Std from the registry if possible, otherwise
|
||||
fallback to querying Std */
|
||||
if (RegLoadMUIStringW (key, L"MUI_Std", tzi.StandardName,
|
||||
size, &size, 0, winsyspath) != ERROR_SUCCESS)
|
||||
{
|
||||
size = sizeof tzi.StandardName;
|
||||
if (RegQueryValueExW (key, L"Std", NULL, NULL,
|
||||
(LPBYTE)&(tzi.StandardName), &size) != ERROR_SUCCESS)
|
||||
goto registry_failed;
|
||||
}
|
||||
|
||||
size = sizeof tzi.DaylightName;
|
||||
|
||||
if (RegQueryValueExW (key, L"Dlt", NULL, NULL,
|
||||
(LPBYTE)&(tzi.DaylightName), &size) != ERROR_SUCCESS)
|
||||
goto registry_failed;
|
||||
/* use RegLoadMUIStringW() to query MUI_Dlt from the registry if possible, otherwise
|
||||
fallback to querying Dlt */
|
||||
if (RegLoadMUIStringW (key, L"MUI_Dlt", tzi.DaylightName,
|
||||
size, &size, 0, winsyspath) != ERROR_SUCCESS)
|
||||
{
|
||||
size = sizeof tzi.DaylightName;
|
||||
if (RegQueryValueExW (key, L"Dlt", NULL, NULL,
|
||||
(LPBYTE)&(tzi.DaylightName), &size) != ERROR_SUCCESS)
|
||||
goto registry_failed;
|
||||
}
|
||||
|
||||
RegCloseKey (key);
|
||||
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, subkey_dynamic_w, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user