mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[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".
This commit is contained in:
parent
bbdb0ab6a8
commit
aa69236646
1 changed files with 11 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue