Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c5c93d18
Commit
c5c93d18
authored
Oct 18, 2004
by
Rein Klazes
Committed by
Alexandre Julliard
Oct 18, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In RtlQueryTimezoneInformation use information from the registry if it
is available.
parent
715ea985
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
time.c
dlls/ntdll/time.c
+80
-0
No files found.
dlls/ntdll/time.c
View file @
c5c93d18
...
...
@@ -58,6 +58,25 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static
CRITICAL_SECTION
TIME_GetBias_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/* TimeZone registry key values */
static
const
WCHAR
TZInformationKeyW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'Y'
,
'S'
,
'T'
,
'E'
,
'M'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'\\'
,
'T'
,
'i'
,
'm'
,
'e'
,
'z'
,
'o'
,
'n'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
TZStandardStartW
[]
=
{
'S'
,
't'
,
'a'
,
'n'
,
'd'
,
'a'
,
'r'
,
'd'
,
's'
,
't'
,
'a'
,
'r'
,
't'
,
0
};
static
const
WCHAR
TZDaylightStartW
[]
=
{
'D'
,
'a'
,
'y'
,
'l'
,
'i'
,
'g'
,
'h'
,
't'
,
's'
,
't'
,
'a'
,
'r'
,
't'
,
0
};
static
const
WCHAR
TZDaylightBiasW
[]
=
{
'D'
,
'a'
,
'y'
,
'l'
,
'i'
,
'g'
,
'h'
,
't'
,
'B'
,
'i'
,
'a'
,
's'
,
0
};
static
const
WCHAR
TZStandardBiasW
[]
=
{
'S'
,
't'
,
'a'
,
'n'
,
'd'
,
'a'
,
'r'
,
'd'
,
'B'
,
'i'
,
'a'
,
's'
,
0
};
static
const
WCHAR
TZBiasW
[]
=
{
'B'
,
'i'
,
'a'
,
's'
,
0
};
static
const
WCHAR
TZDaylightNameW
[]
=
{
'D'
,
'a'
,
'y'
,
'l'
,
'i'
,
'g'
,
'h'
,
't'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
TZStandardNameW
[]
=
{
'S'
,
't'
,
'a'
,
'n'
,
'd'
,
'a'
,
'r'
,
'd'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
#define SETTIME_MAX_ADJUST 120
...
...
@@ -780,6 +799,62 @@ static const WCHAR* TIME_GetTZAsStr (time_t utc, int bias, int dst)
return
NULL
;
}
/*** TIME_GetTimeZoneInfoFromReg: helper for GetTimeZoneInformation ***/
static
int
TIME_GetTimeZoneInfoFromReg
(
LPTIME_ZONE_INFORMATION
tzinfo
)
{
BYTE
buf
[
90
];
KEY_VALUE_PARTIAL_INFORMATION
*
KpInfo
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buf
;
HKEY
hkey
;
DWORD
size
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
TZInformationKeyW
);
if
(
!
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
{
#define GTZIFR_N( valkey, tofield) \
RtlInitUnicodeString( &nameW, valkey );\
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, KpInfo,\
sizeof(buf), &size )) { \
if( size >= (sizeof((tofield)) + \
offsetof(KEY_VALUE_PARTIAL_INFORMATION,Data))); { \
memcpy(&(tofield), \
KpInfo->Data, sizeof(tofield)); \
} \
}
#define GTZIFR_S( valkey, tofield) \
RtlInitUnicodeString( &nameW, valkey );\
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, KpInfo,\
sizeof(buf), &size )) { \
strncpyW( tofield, (WCHAR*) KpInfo->Data, \
sizeof( tofield) / sizeof(WCHAR) ); \
}
GTZIFR_N
(
TZStandardStartW
,
tzinfo
->
StandardDate
)
GTZIFR_N
(
TZDaylightStartW
,
tzinfo
->
DaylightDate
)
GTZIFR_N
(
TZBiasW
,
tzinfo
->
Bias
)
GTZIFR_N
(
TZStandardBiasW
,
tzinfo
->
StandardBias
)
GTZIFR_N
(
TZDaylightBiasW
,
tzinfo
->
DaylightBias
)
GTZIFR_S
(
TZStandardNameW
,
tzinfo
->
StandardName
)
GTZIFR_S
(
TZDaylightNameW
,
tzinfo
->
DaylightName
)
#undef GTZIFR_N
#undef GTZIFR_S
NtClose
(
hkey
);
return
1
;
}
return
0
;
}
/***********************************************************************
* RtlQueryTimeZoneInformation [NTDLL.@]
*
...
...
@@ -800,14 +875,19 @@ NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo)
memset
(
tzinfo
,
0
,
sizeof
(
TIME_ZONE_INFORMATION
));
if
(
!
TIME_GetTimeZoneInfoFromReg
(
tzinfo
))
{
gmt
=
time
(
NULL
);
bias
=
TIME_GetBias
(
gmt
,
&
daylight
);
tzinfo
->
Bias
=
-
bias
/
60
;
tzinfo
->
StandardBias
=
0
;
tzinfo
->
DaylightBias
=
-
60
;
tzinfo
->
StandardName
[
0
]
=
'\0'
;
tzinfo
->
DaylightName
[
0
]
=
'\0'
;
psTZ
=
TIME_GetTZAsStr
(
gmt
,
(
-
bias
/
60
),
daylight
);
if
(
psTZ
)
strcpyW
(
tzinfo
->
StandardName
,
psTZ
);
}
return
STATUS_SUCCESS
;
}
...
...
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