mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[TZLIB] QueryTimeZoneData(): Don't fail if the optional values "Display", "Std", "Dlt" are missing (or too long to be captured). However fail if the timezone information is missing.
This commit is contained in:
parent
7c3e96a26a
commit
bbdb0ab6a8
1 changed files with 28 additions and 24 deletions
|
@ -152,6 +152,30 @@ QueryTimeZoneData(
|
||||||
LONG lError;
|
LONG lError;
|
||||||
DWORD dwValueSize;
|
DWORD dwValueSize;
|
||||||
|
|
||||||
|
if (Index)
|
||||||
|
{
|
||||||
|
dwValueSize = sizeof(*Index);
|
||||||
|
lError = RegQueryValueExW(hZoneKey,
|
||||||
|
L"Index",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(LPBYTE)Index,
|
||||||
|
&dwValueSize);
|
||||||
|
if (lError != ERROR_SUCCESS)
|
||||||
|
*Index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The time zone information structure is mandatory for a valid time zone */
|
||||||
|
dwValueSize = sizeof(*TimeZoneInfo);
|
||||||
|
lError = RegQueryValueExW(hZoneKey,
|
||||||
|
L"TZI",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(LPBYTE)TimeZoneInfo,
|
||||||
|
&dwValueSize);
|
||||||
|
if (lError != ERROR_SUCCESS)
|
||||||
|
return lError;
|
||||||
|
|
||||||
if (Description && DescriptionSize && *DescriptionSize > 0)
|
if (Description && DescriptionSize && *DescriptionSize > 0)
|
||||||
{
|
{
|
||||||
lError = RegQueryValueExW(hZoneKey,
|
lError = RegQueryValueExW(hZoneKey,
|
||||||
|
@ -161,7 +185,7 @@ QueryTimeZoneData(
|
||||||
(LPBYTE)Description,
|
(LPBYTE)Description,
|
||||||
DescriptionSize);
|
DescriptionSize);
|
||||||
if (lError != ERROR_SUCCESS)
|
if (lError != ERROR_SUCCESS)
|
||||||
return lError;
|
*Description = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StandardName && StandardNameSize && *StandardNameSize > 0)
|
if (StandardName && StandardNameSize && *StandardNameSize > 0)
|
||||||
|
@ -173,7 +197,7 @@ QueryTimeZoneData(
|
||||||
(LPBYTE)StandardName,
|
(LPBYTE)StandardName,
|
||||||
StandardNameSize);
|
StandardNameSize);
|
||||||
if (lError != ERROR_SUCCESS)
|
if (lError != ERROR_SUCCESS)
|
||||||
return lError;
|
*StandardName = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DaylightName && DaylightNameSize && *DaylightNameSize > 0)
|
if (DaylightName && DaylightNameSize && *DaylightNameSize > 0)
|
||||||
|
@ -185,30 +209,10 @@ QueryTimeZoneData(
|
||||||
(LPBYTE)DaylightName,
|
(LPBYTE)DaylightName,
|
||||||
DaylightNameSize);
|
DaylightNameSize);
|
||||||
if (lError != ERROR_SUCCESS)
|
if (lError != ERROR_SUCCESS)
|
||||||
return lError;
|
*DaylightName = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index)
|
return ERROR_SUCCESS;
|
||||||
{
|
|
||||||
dwValueSize = sizeof(*Index);
|
|
||||||
lError = RegQueryValueExW(hZoneKey,
|
|
||||||
L"Index",
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(LPBYTE)Index,
|
|
||||||
&dwValueSize);
|
|
||||||
if (lError != ERROR_SUCCESS)
|
|
||||||
return lError;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwValueSize = sizeof(*TimeZoneInfo);
|
|
||||||
lError = RegQueryValueExW(hZoneKey,
|
|
||||||
L"TZI",
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(LPBYTE)TimeZoneInfo,
|
|
||||||
&dwValueSize);
|
|
||||||
return lError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue