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
afad5636
Commit
afad5636
authored
Dec 07, 2018
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Dec 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Resolve an MUI time zone name.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
434bc1ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
11 deletions
+43
-11
time.c
dlls/kernel32/time.c
+43
-11
No files found.
dlls/kernel32/time.c
View file @
afad5636
...
@@ -59,6 +59,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(time);
...
@@ -59,6 +59,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(time);
#define FILETIME2LL( pft, ll) \
#define FILETIME2LL( pft, ll) \
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
static
const
WCHAR
mui_stdW
[]
=
{
'M'
,
'U'
,
'I'
,
'_'
,
'S'
,
't'
,
'd'
,
0
};
static
const
WCHAR
mui_dltW
[]
=
{
'M'
,
'U'
,
'I'
,
'_'
,
'D'
,
'l'
,
't'
,
0
};
static
const
int
MonthLengths
[
2
][
12
]
=
static
const
int
MonthLengths
[
2
][
12
]
=
{
{
...
@@ -367,6 +369,24 @@ static BOOL reg_query_value(HKEY hkey, LPCWSTR name, DWORD type, void *data, DWO
...
@@ -367,6 +369,24 @@ static BOOL reg_query_value(HKEY hkey, LPCWSTR name, DWORD type, void *data, DWO
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
reg_load_mui_string
(
HKEY
hkey
,
LPCWSTR
value
,
LPWSTR
buffer
,
DWORD
size
)
{
static
const
WCHAR
advapi32W
[]
=
{
'a'
,
'd'
,
'v'
,
'a'
,
'p'
,
'i'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
DWORD
(
WINAPI
*
pRegLoadMUIStringW
)(
HKEY
,
LPCWSTR
,
LPWSTR
,
DWORD
,
DWORD
*
,
DWORD
,
LPCWSTR
);
HMODULE
hDll
;
BOOL
ret
=
FALSE
;
hDll
=
LoadLibraryExW
(
advapi32W
,
NULL
,
LOAD_LIBRARY_SEARCH_SYSTEM32
);
if
(
hDll
)
{
pRegLoadMUIStringW
=
(
void
*
)
GetProcAddress
(
hDll
,
"RegLoadMUIStringW"
);
if
(
pRegLoadMUIStringW
&&
!
pRegLoadMUIStringW
(
hkey
,
value
,
buffer
,
size
,
NULL
,
0
,
NULL
))
ret
=
TRUE
;
FreeLibrary
(
hDll
);
}
return
ret
;
}
/***********************************************************************
/***********************************************************************
* TIME_GetSpecificTimeZoneInfo
* TIME_GetSpecificTimeZoneInfo
*
*
...
@@ -406,8 +426,15 @@ static BOOL TIME_GetSpecificTimeZoneInfo( const WCHAR *key_name, WORD year,
...
@@ -406,8 +426,15 @@ static BOOL TIME_GetSpecificTimeZoneInfo( const WCHAR *key_name, WORD year,
if
(
!
TIME_GetSpecificTimeZoneKey
(
key_name
,
&
time_zone_key
))
if
(
!
TIME_GetSpecificTimeZoneKey
(
key_name
,
&
time_zone_key
))
return
FALSE
;
return
FALSE
;
if
(
!
reg_query_value
(
time_zone_key
,
stdW
,
REG_SZ
,
tzinfo
->
StandardName
,
sizeof
(
tzinfo
->
StandardName
))
||
if
(
!
reg_load_mui_string
(
time_zone_key
,
mui_stdW
,
tzinfo
->
StandardName
,
sizeof
(
tzinfo
->
StandardName
)
)
&&
!
reg_query_value
(
time_zone_key
,
dltW
,
REG_SZ
,
tzinfo
->
DaylightName
,
sizeof
(
tzinfo
->
DaylightName
)))
!
reg_query_value
(
time_zone_key
,
stdW
,
REG_SZ
,
tzinfo
->
StandardName
,
sizeof
(
tzinfo
->
StandardName
)
))
{
NtClose
(
time_zone_key
);
return
FALSE
;
}
if
(
!
reg_load_mui_string
(
time_zone_key
,
mui_dltW
,
tzinfo
->
DaylightName
,
sizeof
(
tzinfo
->
DaylightName
)
)
&&
!
reg_query_value
(
time_zone_key
,
dltW
,
REG_SZ
,
tzinfo
->
DaylightName
,
sizeof
(
tzinfo
->
DaylightName
)
))
{
{
NtClose
(
time_zone_key
);
NtClose
(
time_zone_key
);
return
FALSE
;
return
FALSE
;
...
@@ -577,17 +604,14 @@ BOOL WINAPI SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmen
...
@@ -577,17 +604,14 @@ BOOL WINAPI SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmen
* TIME_ZONE_ID_STANDARD Current time is standard time
* TIME_ZONE_ID_STANDARD Current time is standard time
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
*/
*/
DWORD
WINAPI
GetTimeZoneInformation
(
LPTIME_ZONE_INFORMATION
tzinfo
)
DWORD
WINAPI
GetTimeZoneInformation
(
LPTIME_ZONE_INFORMATION
ret
)
{
{
NTSTATUS
status
;
DYNAMIC_TIME_ZONE_INFORMATION
tzinfo
;
DWORD
time_zone_id
;
status
=
RtlQueryTimeZoneInformation
(
(
RTL_TIME_ZONE_INFORMATION
*
)
tzinfo
);
time_zone_id
=
GetDynamicTimeZoneInformation
(
&
tzinfo
);
if
(
status
!=
STATUS_SUCCESS
)
memcpy
(
ret
,
&
tzinfo
,
sizeof
(
*
ret
)
);
{
return
time_zone_id
;
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
TIME_ZONE_ID_INVALID
;
}
return
TIME_ZoneID
(
tzinfo
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1437,6 +1461,7 @@ BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFIL
...
@@ -1437,6 +1461,7 @@ BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFIL
DWORD
WINAPI
GetDynamicTimeZoneInformation
(
DYNAMIC_TIME_ZONE_INFORMATION
*
tzinfo
)
DWORD
WINAPI
GetDynamicTimeZoneInformation
(
DYNAMIC_TIME_ZONE_INFORMATION
*
tzinfo
)
{
{
NTSTATUS
status
;
NTSTATUS
status
;
HANDLE
time_zone_key
;
status
=
RtlQueryDynamicTimeZoneInformation
(
(
RTL_DYNAMIC_TIME_ZONE_INFORMATION
*
)
tzinfo
);
status
=
RtlQueryDynamicTimeZoneInformation
(
(
RTL_DYNAMIC_TIME_ZONE_INFORMATION
*
)
tzinfo
);
if
(
status
!=
STATUS_SUCCESS
)
if
(
status
!=
STATUS_SUCCESS
)
...
@@ -1444,6 +1469,13 @@ DWORD WINAPI GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo
...
@@ -1444,6 +1469,13 @@ DWORD WINAPI GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
TIME_ZONE_ID_INVALID
;
return
TIME_ZONE_ID_INVALID
;
}
}
if
(
!
TIME_GetSpecificTimeZoneKey
(
tzinfo
->
TimeZoneKeyName
,
&
time_zone_key
))
return
TIME_ZONE_ID_INVALID
;
reg_load_mui_string
(
time_zone_key
,
mui_stdW
,
tzinfo
->
StandardName
,
sizeof
(
tzinfo
->
StandardName
)
);
reg_load_mui_string
(
time_zone_key
,
mui_dltW
,
tzinfo
->
DaylightName
,
sizeof
(
tzinfo
->
DaylightName
)
);
NtClose
(
time_zone_key
);
return
TIME_ZoneID
(
(
TIME_ZONE_INFORMATION
*
)
tzinfo
);
return
TIME_ZoneID
(
(
TIME_ZONE_INFORMATION
*
)
tzinfo
);
}
}
...
...
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