From 081eae7ac3074857bf1a0569e5416183b64bc0a0 Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Tue, 12 Dec 2017 23:56:31 +0900 Subject: [PATCH] ntdll/tests: Add tests for time zone names. Test shows internal NT API returns an indirect string, e.g. @tzres.dll,-32, not a localized one in Vista or later. Signed-off-by: Akihiro Sagawa Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/time.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c index b684bc1980d..b12da2bde8b 100644 --- a/dlls/ntdll/tests/time.c +++ b/dlls/ntdll/tests/time.c @@ -27,6 +27,8 @@ static VOID (WINAPI *pRtlTimeToTimeFields)( const LARGE_INTEGER *liTime, PTIME_FIELDS TimeFields) ; static VOID (WINAPI *pRtlTimeFieldsToTime)( PTIME_FIELDS TimeFields, PLARGE_INTEGER Time) ; static NTSTATUS (WINAPI *pNtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency ); +static NTSTATUS (WINAPI *pRtlQueryTimeZoneInformation)( RTL_TIME_ZONE_INFORMATION *); +static NTSTATUS (WINAPI *pRtlQueryDynamicTimeZoneInformation)( RTL_DYNAMIC_TIME_ZONE_INFORMATION *); static const int MonthLengths[2][12] = { @@ -115,15 +117,57 @@ static void test_NtQueryPerformanceCounter(void) ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status); } +static void test_RtlQueryTimeZoneInformation(void) +{ + RTL_DYNAMIC_TIME_ZONE_INFORMATION tzinfo; + NTSTATUS status; + + /* test RtlQueryTimeZoneInformation returns an indirect string, + e.g. @tzres.dll,-32 (Vista or later) */ + if (!pRtlQueryTimeZoneInformation || !pRtlQueryDynamicTimeZoneInformation) + { + win_skip("Time zone name tests requires Vista or later\n"); + return; + } + + memset(&tzinfo, 0, sizeof(tzinfo)); + status = pRtlQueryDynamicTimeZoneInformation(&tzinfo); + ok(status == STATUS_SUCCESS, + "RtlQueryDynamicTimeZoneInformation failed, got %08x\n", status); + todo_wine ok(tzinfo.StandardName[0] == '@', + "standard time zone name isn't an indirect string, got %s\n", + wine_dbgstr_w(tzinfo.StandardName)); + todo_wine ok(tzinfo.DaylightName[0] == '@', + "daylight time zone name isn't an indirect string, got %s\n", + wine_dbgstr_w(tzinfo.DaylightName)); + + memset(&tzinfo, 0, sizeof(tzinfo)); + status = pRtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo); + ok(status == STATUS_SUCCESS, + "RtlQueryTimeZoneInformation failed, got %08x\n", status); + todo_wine ok(tzinfo.StandardName[0] == '@', + "standard time zone name isn't an indirect string, got %s\n", + wine_dbgstr_w(tzinfo.StandardName)); + todo_wine ok(tzinfo.DaylightName[0] == '@', + "daylight time zone name isn't an indirect string, got %s\n", + wine_dbgstr_w(tzinfo.DaylightName)); +} + START_TEST(time) { HMODULE mod = GetModuleHandleA("ntdll.dll"); pRtlTimeToTimeFields = (void *)GetProcAddress(mod,"RtlTimeToTimeFields"); pRtlTimeFieldsToTime = (void *)GetProcAddress(mod,"RtlTimeFieldsToTime"); pNtQueryPerformanceCounter = (void *)GetProcAddress(mod, "NtQueryPerformanceCounter"); + pRtlQueryTimeZoneInformation = + (void *)GetProcAddress(mod, "RtlQueryTimeZoneInformation"); + pRtlQueryDynamicTimeZoneInformation = + (void *)GetProcAddress(mod, "RtlQueryDynamicTimeZoneInformation"); + if (pRtlTimeToTimeFields && pRtlTimeFieldsToTime) test_pRtlTimeToTimeFields(); else win_skip("Required time conversion functions are not available\n"); test_NtQueryPerformanceCounter(); + test_RtlQueryTimeZoneInformation(); }