https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aa69236646f01a476377e…
commit aa69236646f01a476377ec76ae7b762e061cd300
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Apr 22 00:16:14 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Apr 22 00:58:34 2020 +0200
[TIMEDATE.CPL] In case TimeZone data does not contain a valid StandardName, perform comparisons against the time-zone numerical values instead.
It may happen that the time-zone information in the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
contains an empty StandardName / DaylightName, or is too long for the
standard maximum 32-character length, and therefore is returned empty.
And/or it may happen as well that some of the standard names (value "Std")
present in some of the time zones listed in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
are similarly too long, and therefore are returned as empty strings.
In case this happens, perform comparisons instead with the numerical
values Bias, StandardBias, DaylightBias, StandardDate and DaylightDate
in order to find a match.
It is interesting to note also that in Vista+ there is an additional
REG_SZ value "TimeZoneKeyName" in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
that allows to directly find a match in the time zones list in
"Windows NT\CurrentVersion\Time Zones".
---
dll/cpl/timedate/timezone.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dll/cpl/timedate/timezone.c b/dll/cpl/timedate/timezone.c
index 9dd79e1d01a..cd7361136a9 100644
--- a/dll/cpl/timedate/timezone.c
+++ b/dll/cpl/timedate/timezone.c
@@ -168,10 +168,12 @@ ShowTimeZoneList(HWND hwnd)
{
TIME_ZONE_INFORMATION TimeZoneInfo;
PTIMEZONE_ENTRY Entry;
+ BOOL bDoAdvancedTest;
DWORD dwIndex;
DWORD i;
GetTimeZoneInformation(&TimeZoneInfo);
+ bDoAdvancedTest = (!*TimeZoneInfo.StandardName);
dwIndex = 0;
i = 0;
@@ -183,8 +185,16 @@ ShowTimeZoneList(HWND hwnd)
0,
(LPARAM)Entry->Description);
- if (!wcscmp(Entry->StandardName, TimeZoneInfo.StandardName))
+ if ( (!bDoAdvancedTest && *Entry->StandardName &&
+ wcscmp(Entry->StandardName, TimeZoneInfo.StandardName) == 0) ||
+ ( (Entry->TimezoneInfo.Bias == TimeZoneInfo.Bias) &&
+ (Entry->TimezoneInfo.StandardBias == TimeZoneInfo.StandardBias) &&
+ (Entry->TimezoneInfo.DaylightBias == TimeZoneInfo.DaylightBias) &&
+ (memcmp(&Entry->TimezoneInfo.StandardDate, &TimeZoneInfo.StandardDate, sizeof(SYSTEMTIME)) == 0) &&
+ (memcmp(&Entry->TimezoneInfo.DaylightDate, &TimeZoneInfo.DaylightDate, sizeof(SYSTEMTIME)) == 0) ) )
+ {
dwIndex = i;
+ }
i++;
Entry = Entry->Next;