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@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2017-12-12 23:56:31 +09:00 committed by Alexandre Julliard
parent d54bf06f55
commit 081eae7ac3
1 changed files with 44 additions and 0 deletions

View File

@ -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();
}