kernel32: Implement GetDynamicTimeZoneInformation().
This commit is contained in:
parent
dde69d617b
commit
2c98d5b90c
|
@ -27,6 +27,7 @@ static BOOL (WINAPI *pTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION,
|
|||
static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
|
||||
static int (WINAPI *pGetCalendarInfoA)(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD);
|
||||
static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD);
|
||||
static DWORD (WINAPI *pGetDynamicTimeZoneInformation)(DYNAMIC_TIME_ZONE_INFORMATION*);
|
||||
|
||||
#define SECSPERMIN 60
|
||||
#define SECSPERDAY 86400
|
||||
|
@ -730,7 +731,34 @@ static void test_GetCalendarInfo(void)
|
|||
ok( ret2, "GetCalendarInfoW failed err %u\n", GetLastError() );
|
||||
ret2 = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
||||
ok( ret == ret2, "got %d, expected %d\n", ret, ret2 );
|
||||
}
|
||||
|
||||
static void test_GetDynamicTimeZoneInformation(void)
|
||||
{
|
||||
DYNAMIC_TIME_ZONE_INFORMATION dyninfo;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
DWORD ret, ret2;
|
||||
|
||||
if (!pGetDynamicTimeZoneInformation)
|
||||
{
|
||||
win_skip("GetDynamicTimeZoneInformation() is not supported.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pGetDynamicTimeZoneInformation(&dyninfo);
|
||||
ret2 = GetTimeZoneInformation(&tzinfo);
|
||||
ok(ret == ret2, "got %d, %d\n", ret, ret2);
|
||||
|
||||
ok(dyninfo.Bias == tzinfo.Bias, "got %d, %d\n", dyninfo.Bias, tzinfo.Bias);
|
||||
ok(!lstrcmpW(dyninfo.StandardName, tzinfo.StandardName), "got std name %s, %s\n",
|
||||
wine_dbgstr_w(dyninfo.StandardName), wine_dbgstr_w(tzinfo.StandardName));
|
||||
ok(!memcmp(&dyninfo.StandardDate, &tzinfo.StandardDate, sizeof(dyninfo.StandardDate)), "got different StandardDate\n");
|
||||
ok(dyninfo.StandardBias == tzinfo.StandardBias, "got %d, %d\n", dyninfo.StandardBias, tzinfo.StandardBias);
|
||||
ok(!lstrcmpW(dyninfo.DaylightName, tzinfo.DaylightName), "got daylight name %s, %s\n",
|
||||
wine_dbgstr_w(dyninfo.DaylightName), wine_dbgstr_w(tzinfo.DaylightName));
|
||||
ok(!memcmp(&dyninfo.DaylightDate, &tzinfo.DaylightDate, sizeof(dyninfo.DaylightDate)), "got different DaylightDate\n");
|
||||
ok(dyninfo.TimeZoneKeyName[0] != 0, "got empty tz keyname\n");
|
||||
trace("Dyn TimeZoneKeyName %s\n", wine_dbgstr_w(dyninfo.TimeZoneKeyName));
|
||||
}
|
||||
|
||||
START_TEST(time)
|
||||
|
@ -740,6 +768,7 @@ START_TEST(time)
|
|||
pSystemTimeToTzSpecificLocalTime = (void *)GetProcAddress( hKernel, "SystemTimeToTzSpecificLocalTime");
|
||||
pGetCalendarInfoA = (void *)GetProcAddress(hKernel, "GetCalendarInfoA");
|
||||
pGetCalendarInfoW = (void *)GetProcAddress(hKernel, "GetCalendarInfoW");
|
||||
pGetDynamicTimeZoneInformation = (void *)GetProcAddress(hKernel, "GetDynamicTimeZoneInformation");
|
||||
|
||||
test_conversions();
|
||||
test_invalid_arg();
|
||||
|
@ -749,4 +778,5 @@ START_TEST(time)
|
|||
test_TzSpecificLocalTimeToSystemTime();
|
||||
test_FileTimeToDosDateTime();
|
||||
test_GetCalendarInfo();
|
||||
test_GetDynamicTimeZoneInformation();
|
||||
}
|
||||
|
|
|
@ -1097,11 +1097,17 @@ BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFIL
|
|||
/***********************************************************************
|
||||
* GetDynamicTimeZoneInformation (KERNEL32.@)
|
||||
*/
|
||||
DWORD WINAPI GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION info)
|
||||
DWORD WINAPI GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo)
|
||||
{
|
||||
FIXME("(%p) stub!\n", info);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
NTSTATUS status;
|
||||
|
||||
status = RtlQueryDynamicTimeZoneInformation( (RTL_DYNAMIC_TIME_ZONE_INFORMATION*)tzinfo );
|
||||
if ( status != STATUS_SUCCESS )
|
||||
{
|
||||
SetLastError( RtlNtStatusToDosError(status) );
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
}
|
||||
return TIME_ZoneID( (TIME_ZONE_INFORMATION*)tzinfo );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -783,6 +783,7 @@
|
|||
# @ stub RtlPushFrame
|
||||
@ stdcall RtlQueryAtomInAtomTable(ptr long ptr ptr ptr ptr)
|
||||
@ stdcall RtlQueryDepthSList(ptr)
|
||||
@ stdcall RtlQueryDynamicTimeZoneInformation(ptr)
|
||||
@ stdcall RtlQueryEnvironmentVariable_U(ptr ptr ptr)
|
||||
@ stdcall RtlQueryHeapInformation(long long ptr long ptr)
|
||||
@ stdcall RtlQueryInformationAcl(ptr ptr long long)
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
||||
|
||||
static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi);
|
||||
static int init_tz_info(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi);
|
||||
|
||||
static RTL_CRITICAL_SECTION TIME_tz_section;
|
||||
static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
|
@ -270,7 +270,7 @@ static LONG TIME_GetBias(void)
|
|||
RtlEnterCriticalSection( &TIME_tz_section );
|
||||
if (utc != last_utc)
|
||||
{
|
||||
RTL_TIME_ZONE_INFORMATION tzi;
|
||||
RTL_DYNAMIC_TIME_ZONE_INFORMATION tzi;
|
||||
int is_dst = init_tz_info( &tzi );
|
||||
|
||||
last_utc = utc;
|
||||
|
@ -553,7 +553,7 @@ static BOOL match_tz_date(const RTL_SYSTEM_TIME *st, const RTL_SYSTEM_TIME *reg_
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL match_tz_info(const RTL_TIME_ZONE_INFORMATION *tzi, const RTL_TIME_ZONE_INFORMATION *reg_tzi)
|
||||
static BOOL match_tz_info(const RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi, const RTL_DYNAMIC_TIME_ZONE_INFORMATION *reg_tzi)
|
||||
{
|
||||
if (tzi->Bias == reg_tzi->Bias &&
|
||||
match_tz_date(&tzi->StandardDate, ®_tzi->StandardDate) &&
|
||||
|
@ -584,7 +584,7 @@ static BOOL reg_query_value(HKEY hkey, LPCWSTR name, DWORD type, void *data, DWO
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void find_reg_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
||||
static void find_reg_tz_info(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi)
|
||||
{
|
||||
static const WCHAR Time_ZonesW[] = { 'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
|
@ -633,7 +633,7 @@ static void find_reg_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
|||
static const WCHAR stdW[] = { 'S','t','d',0 };
|
||||
static const WCHAR dltW[] = { 'D','l','t',0 };
|
||||
static const WCHAR tziW[] = { 'T','Z','I',0 };
|
||||
RTL_TIME_ZONE_INFORMATION reg_tzi;
|
||||
RTL_DYNAMIC_TIME_ZONE_INFORMATION reg_tzi;
|
||||
HANDLE hSubkey, hSubkeyDynamicDST;
|
||||
BOOL is_dynamic = FALSE;
|
||||
|
||||
|
@ -668,6 +668,8 @@ static void find_reg_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
|||
|
||||
get_value(hSubkey, stdW, REG_SZ, reg_tzi.StandardName, sizeof(reg_tzi.StandardName));
|
||||
get_value(hSubkey, dltW, REG_SZ, reg_tzi.DaylightName, sizeof(reg_tzi.DaylightName));
|
||||
memcpy(reg_tzi.TimeZoneKeyName, nameW.Buffer, nameW.Length);
|
||||
reg_tzi.TimeZoneKeyName[nameW.Length/sizeof(WCHAR)] = 0;
|
||||
|
||||
/* Check for Dynamic DST entry first */
|
||||
attrDynamic.RootDirectory = hSubkey;
|
||||
|
@ -748,9 +750,9 @@ static time_t find_dst_change(unsigned long min, unsigned long max, int *is_dst)
|
|||
return min;
|
||||
}
|
||||
|
||||
static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
||||
static int init_tz_info(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi)
|
||||
{
|
||||
static RTL_TIME_ZONE_INFORMATION cached_tzi;
|
||||
static RTL_DYNAMIC_TIME_ZONE_INFORMATION cached_tzi;
|
||||
static int current_year = -1, current_bias = 65535;
|
||||
struct tm *tm;
|
||||
time_t year_start, year_end, tmp, dlt = 0, std = 0;
|
||||
|
@ -874,7 +876,28 @@ static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
|||
* Success: STATUS_SUCCESS.
|
||||
* Failure: An NTSTATUS error code indicating the problem.
|
||||
*/
|
||||
NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION *tzinfo)
|
||||
NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION *ret)
|
||||
{
|
||||
RTL_DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
||||
|
||||
init_tz_info( &tzinfo );
|
||||
memcpy( ret, &tzinfo, sizeof(*ret) );
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RtlQueryDynamicTimeZoneInformation [NTDLL.@]
|
||||
*
|
||||
* Get information about the current timezone.
|
||||
*
|
||||
* PARAMS
|
||||
* tzinfo [O] Destination for the retrieved timezone info.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: STATUS_SUCCESS.
|
||||
* Failure: An NTSTATUS error code indicating the problem.
|
||||
*/
|
||||
NTSTATUS WINAPI RtlQueryDynamicTimeZoneInformation(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzinfo)
|
||||
{
|
||||
init_tz_info( tzinfo );
|
||||
|
||||
|
|
|
@ -115,6 +115,19 @@ typedef struct _RTL_TIME_ZONE_INFORMATION {
|
|||
LONG DaylightBias;
|
||||
} RTL_TIME_ZONE_INFORMATION, *PRTL_TIME_ZONE_INFORMATION;
|
||||
|
||||
typedef struct _RTL_TIME_DYNAMIC_ZONE_INFORMATION
|
||||
{
|
||||
LONG Bias;
|
||||
WCHAR StandardName[32];
|
||||
RTL_SYSTEM_TIME StandardDate;
|
||||
LONG StandardBias;
|
||||
WCHAR DaylightName[32];
|
||||
RTL_SYSTEM_TIME DaylightDate;
|
||||
LONG DaylightBias;
|
||||
WCHAR TimeZoneKeyName[128];
|
||||
BOOLEAN DynamicDaylightTimeDisabled;
|
||||
} RTL_DYNAMIC_TIME_ZONE_INFORMATION, *PRTL_DYNAMIC_TIME_ZONE_INFORMATION;
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
|
@ -2478,6 +2491,7 @@ NTSYSAPI NTSTATUS WINAPI RtlPinAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
|
|||
NTSYSAPI BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
|
||||
NTSYSAPI BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlQueryDynamicTimeZoneInformation(RTL_DYNAMIC_TIME_ZONE_INFORMATION*);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlQueryHeapInformation(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T,PSIZE_T);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
|
||||
|
|
Loading…
Reference in New Issue