Akihiro Sagawa : ntdll/tests: Add tests for time zone names.

Alexandre Julliard julliard at winehq.org
Tue Dec 12 16:30:10 CST 2017


Module: wine
Branch: master
Commit: 081eae7ac3074857bf1a0569e5416183b64bc0a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=081eae7ac3074857bf1a0569e5416183b64bc0a0

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue Dec 12 23:56:31 2017 +0900

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 <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 b684bc1..b12da2b 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();
 }




More information about the wine-cvs mailing list