https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bbdb0ab6a8a576fb9da0f5...
commit bbdb0ab6a8a576fb9da0f57908d9e725c4925849 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sun Apr 19 18:50:00 2020 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Wed Apr 22 00:58:32 2020 +0200
[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. --- sdk/lib/tzlib/tzlib.c | 52 +++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-)
diff --git a/sdk/lib/tzlib/tzlib.c b/sdk/lib/tzlib/tzlib.c index 93c33a3fb3a..1dc0cbe7f76 100644 --- a/sdk/lib/tzlib/tzlib.c +++ b/sdk/lib/tzlib/tzlib.c @@ -152,6 +152,30 @@ QueryTimeZoneData( LONG lError; 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) { lError = RegQueryValueExW(hZoneKey, @@ -161,7 +185,7 @@ QueryTimeZoneData( (LPBYTE)Description, DescriptionSize); if (lError != ERROR_SUCCESS) - return lError; + *Description = 0; }
if (StandardName && StandardNameSize && *StandardNameSize > 0) @@ -173,7 +197,7 @@ QueryTimeZoneData( (LPBYTE)StandardName, StandardNameSize); if (lError != ERROR_SUCCESS) - return lError; + *StandardName = 0; }
if (DaylightName && DaylightNameSize && *DaylightNameSize > 0) @@ -185,30 +209,10 @@ QueryTimeZoneData( (LPBYTE)DaylightName, DaylightNameSize); if (lError != ERROR_SUCCESS) - return lError; - } - - if (Index) - { - dwValueSize = sizeof(*Index); - lError = RegQueryValueExW(hZoneKey, - L"Index", - NULL, - NULL, - (LPBYTE)Index, - &dwValueSize); - if (lError != ERROR_SUCCESS) - return lError; + *DaylightName = 0; }
- dwValueSize = sizeof(*TimeZoneInfo); - lError = RegQueryValueExW(hZoneKey, - L"TZI", - NULL, - NULL, - (LPBYTE)TimeZoneInfo, - &dwValueSize); - return lError; + return ERROR_SUCCESS; }
//