Alexandre Julliard : kernelbase: Reimplement EnumDynamicTimeZoneInformation() using GetTimeZoneInformationForYear().
Alexandre Julliard
julliard at winehq.org
Thu Dec 12 16:29:41 CST 2019
Module: wine
Branch: master
Commit: 356d0fcc5b171cea536b351772da7429d7b7c5a7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=356d0fcc5b171cea536b351772da7429d7b7c5a7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Dec 12 14:55:34 2019 +0100
kernelbase: Reimplement EnumDynamicTimeZoneInformation() using GetTimeZoneInformationForYear().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/locale.c | 26 +++++++++++++++++++
dlls/kernelbase/registry.c | 63 ----------------------------------------------
2 files changed, 26 insertions(+), 63 deletions(-)
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 444affa6a3..fba15555d2 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -2952,6 +2952,32 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumDateFormatsExEx( DATEFMT_ENUMPROCEXEX proc, co
}
+
+/******************************************************************************
+ * EnumDynamicTimeZoneInformation (kernelbase.@)
+ */
+DWORD WINAPI DECLSPEC_HOTPATCH EnumDynamicTimeZoneInformation( DWORD index,
+ DYNAMIC_TIME_ZONE_INFORMATION *info )
+{
+ DYNAMIC_TIME_ZONE_INFORMATION tz;
+ LSTATUS ret;
+ DWORD size;
+
+ if (!info) return ERROR_INVALID_PARAMETER;
+
+ size = ARRAY_SIZE(tz.TimeZoneKeyName);
+ ret = RegEnumKeyExW( tz_key, index, tz.TimeZoneKeyName, &size, NULL, NULL, NULL, NULL );
+ if (ret) return ret;
+
+ tz.DynamicDaylightTimeDisabled = TRUE;
+ if (!GetTimeZoneInformationForYear( 0, &tz, (TIME_ZONE_INFORMATION *)info )) return GetLastError();
+
+ lstrcpyW( info->TimeZoneKeyName, tz.TimeZoneKeyName );
+ info->DynamicDaylightTimeDisabled = FALSE;
+ return 0;
+}
+
+
/******************************************************************************
* EnumLanguageGroupLocalesW (kernelbase.@)
*/
diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c
index 0961cb0850..e482d11cb2 100644
--- a/dlls/kernelbase/registry.c
+++ b/dlls/kernelbase/registry.c
@@ -3045,69 +3045,6 @@ LSTATUS WINAPI RegLoadAppKeyW(const WCHAR *file, HKEY *result, REGSAM sam, DWORD
return ERROR_SUCCESS;
}
-/******************************************************************************
- * EnumDynamicTimeZoneInformation (kernelbase.@)
- */
-DWORD WINAPI EnumDynamicTimeZoneInformation(const DWORD index,
- DYNAMIC_TIME_ZONE_INFORMATION *dtzi)
-{
- static const WCHAR mui_stdW[] = { 'M','U','I','_','S','t','d',0 };
- static const WCHAR mui_dltW[] = { 'M','U','I','_','D','l','t',0 };
- WCHAR keyname[ARRAY_SIZE(dtzi->TimeZoneKeyName)];
- HKEY time_zones_key, sub_key;
- LSTATUS ret;
- DWORD size;
- struct tz_reg_data
- {
- LONG bias;
- LONG std_bias;
- LONG dlt_bias;
- SYSTEMTIME std_date;
- SYSTEMTIME dlt_date;
- } tz_data;
-
- if (!dtzi)
- return ERROR_INVALID_PARAMETER;
-
- ret = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
- "Software\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", 0,
- KEY_ENUMERATE_SUB_KEYS|KEY_QUERY_VALUE, &time_zones_key );
- if (ret) return ret;
-
- sub_key = NULL;
- size = ARRAY_SIZE(keyname);
- ret = RegEnumKeyExW( time_zones_key, index, keyname, &size, NULL, NULL, NULL, NULL );
- if (ret) goto cleanup;
-
- ret = RegOpenKeyExW( time_zones_key, keyname, 0, KEY_QUERY_VALUE, &sub_key );
- if (ret) goto cleanup;
-
- size = sizeof(dtzi->StandardName);
- ret = RegLoadMUIStringW( sub_key, mui_stdW, dtzi->StandardName, size, NULL, 0, system_dir );
- if (ret) goto cleanup;
-
- size = sizeof(dtzi->DaylightName);
- ret = RegLoadMUIStringW( sub_key, mui_dltW, dtzi->DaylightName, size, NULL, 0, system_dir );
- if (ret) goto cleanup;
-
- size = sizeof(tz_data);
- ret = RegQueryValueExA( sub_key, "TZI", NULL, NULL, (BYTE*)&tz_data, &size );
- if (ret) goto cleanup;
-
- dtzi->Bias = tz_data.bias;
- dtzi->StandardBias = tz_data.std_bias;
- dtzi->DaylightBias = tz_data.dlt_bias;
- memcpy( &dtzi->StandardDate, &tz_data.std_date, sizeof(tz_data.std_date) );
- memcpy( &dtzi->DaylightDate, &tz_data.dlt_date, sizeof(tz_data.dlt_date) );
- lstrcpyW( dtzi->TimeZoneKeyName, keyname );
- dtzi->DynamicDaylightTimeDisabled = FALSE;
-
-cleanup:
- if (sub_key) RegCloseKey( sub_key );
- RegCloseKey( time_zones_key );
- return ret;
-}
-
struct USKEY
{
More information about the wine-cvs
mailing list