Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2c98d5b9
Commit
2c98d5b9
authored
May 08, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement GetDynamicTimeZoneInformation().
parent
dde69d61
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
12 deletions
+86
-12
time.c
dlls/kernel32/tests/time.c
+30
-0
time.c
dlls/kernel32/time.c
+10
-4
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
time.c
dlls/ntdll/time.c
+31
-8
winternl.h
include/winternl.h
+14
-0
No files found.
dlls/kernel32/tests/time.c
View file @
2c98d5b9
...
...
@@ -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
();
}
dlls/kernel32/time.c
View file @
2c98d5b9
...
...
@@ -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
*
tz
info
)
{
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
);
}
/***********************************************************************
...
...
dlls/ntdll/ntdll.spec
View file @
2c98d5b9
...
...
@@ -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)
...
...
dlls/ntdll/time.c
View file @
2c98d5b9
...
...
@@ -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
,
&
reg_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
);
...
...
include/winternl.h
View file @
2c98d5b9
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment