mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[TIMEDATE] Fix the way the current time-zone is found in the list. (#5649)
fies regression CORE-18666 'Wrong timezone saved/displayed'
which was introduced by 0.4.14-dev-1522-g aa69236646
This commit is contained in:
parent
2b14056600
commit
d9cd760173
1 changed files with 40 additions and 25 deletions
|
@ -168,36 +168,51 @@ ShowTimeZoneList(HWND hwnd)
|
||||||
{
|
{
|
||||||
TIME_ZONE_INFORMATION TimeZoneInfo;
|
TIME_ZONE_INFORMATION TimeZoneInfo;
|
||||||
PTIMEZONE_ENTRY Entry;
|
PTIMEZONE_ENTRY Entry;
|
||||||
BOOL bDoAdvancedTest;
|
DWORD dwCount;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex = 0;
|
||||||
DWORD i;
|
BOOL bFound = FALSE;
|
||||||
|
|
||||||
GetTimeZoneInformation(&TimeZoneInfo);
|
if (GetTimeZoneInformation(&TimeZoneInfo) == TIME_ZONE_ID_INVALID)
|
||||||
bDoAdvancedTest = (!*TimeZoneInfo.StandardName);
|
|
||||||
|
|
||||||
dwIndex = 0;
|
|
||||||
i = 0;
|
|
||||||
Entry = TimeZoneListHead;
|
|
||||||
while (Entry != NULL)
|
|
||||||
{
|
{
|
||||||
SendMessageW(hwnd,
|
/* Failed to retrieve current time-zone info, reset it */
|
||||||
CB_ADDSTRING,
|
ZeroMemory(&TimeZoneInfo, sizeof(TimeZoneInfo));
|
||||||
0,
|
}
|
||||||
(LPARAM)Entry->Description);
|
|
||||||
|
|
||||||
if ( (!bDoAdvancedTest && *Entry->StandardName &&
|
for (Entry = TimeZoneListHead; Entry != NULL; Entry = Entry->Next)
|
||||||
wcscmp(Entry->StandardName, TimeZoneInfo.StandardName) == 0) ||
|
{
|
||||||
( (Entry->TimezoneInfo.Bias == TimeZoneInfo.Bias) &&
|
dwCount = SendMessageW(hwnd,
|
||||||
(Entry->TimezoneInfo.StandardBias == TimeZoneInfo.StandardBias) &&
|
CB_ADDSTRING,
|
||||||
(Entry->TimezoneInfo.DaylightBias == TimeZoneInfo.DaylightBias) &&
|
0,
|
||||||
(memcmp(&Entry->TimezoneInfo.StandardDate, &TimeZoneInfo.StandardDate, sizeof(SYSTEMTIME)) == 0) &&
|
(LPARAM)Entry->Description);
|
||||||
(memcmp(&Entry->TimezoneInfo.DaylightDate, &TimeZoneInfo.DaylightDate, sizeof(SYSTEMTIME)) == 0) ) )
|
if (dwCount == CB_ERR || dwCount == CB_ERRSPACE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* If the time-zone was found in the list, skip the tests */
|
||||||
|
if (bFound)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (*TimeZoneInfo.StandardName && *Entry->StandardName)
|
||||||
{
|
{
|
||||||
dwIndex = i;
|
/* Compare by name */
|
||||||
|
if (wcscmp(Entry->StandardName, TimeZoneInfo.StandardName) == 0)
|
||||||
|
{
|
||||||
|
dwIndex = dwCount;
|
||||||
|
bFound = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Compare by date and bias */
|
||||||
|
if ((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 = dwCount;
|
||||||
|
bFound = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
|
||||||
Entry = Entry->Next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(hwnd,
|
SendMessageW(hwnd,
|
||||||
|
|
Loading…
Reference in a new issue