2000-09-29 22:48:04 +02:00
|
|
|
/*
|
2002-12-13 21:30:06 +01:00
|
|
|
* Win32 kernel time functions
|
2000-09-29 22:48:04 +02:00
|
|
|
*
|
|
|
|
* Copyright 1995 Martin von Loewis and Cameron Heide
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2000-09-29 22:48:04 +02:00
|
|
|
*/
|
|
|
|
|
2002-03-11 06:08:38 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
#include <string.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2004-03-10 00:51:02 +01:00
|
|
|
#include <stdarg.h>
|
2000-11-01 04:11:12 +01:00
|
|
|
#include <stdlib.h>
|
2004-03-10 00:51:02 +01:00
|
|
|
#include <time.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
2002-08-26 23:53:24 +02:00
|
|
|
#ifdef HAVE_SYS_TIMES_H
|
|
|
|
# include <sys/times.h>
|
|
|
|
#endif
|
2005-08-22 11:33:37 +02:00
|
|
|
#ifdef HAVE_SYS_LIMITS_H
|
|
|
|
#include <sys/limits.h>
|
|
|
|
#elif defined(HAVE_MACHINE_LIMITS_H)
|
2005-05-18 20:20:23 +02:00
|
|
|
#include <machine/limits.h>
|
|
|
|
#endif
|
2003-01-07 21:36:20 +01:00
|
|
|
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2015-03-12 10:39:31 +01:00
|
|
|
#define NONAMELESSUNION
|
2004-03-10 00:51:02 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
2003-12-01 23:47:28 +01:00
|
|
|
#include "kernel_private.h"
|
2001-04-09 20:45:49 +02:00
|
|
|
#include "wine/unicode.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2000-09-29 22:48:04 +02:00
|
|
|
|
2004-02-26 06:29:55 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(time);
|
2000-09-29 22:48:04 +02:00
|
|
|
|
2002-06-13 23:44:15 +02:00
|
|
|
#define CALINFO_MAX_YEAR 2029
|
2000-09-29 22:48:04 +02:00
|
|
|
|
2004-09-10 21:35:06 +02:00
|
|
|
#define LL2FILETIME( ll, pft )\
|
|
|
|
(pft)->dwLowDateTime = (UINT)(ll); \
|
|
|
|
(pft)->dwHighDateTime = (UINT)((ll) >> 32);
|
|
|
|
#define FILETIME2LL( pft, ll) \
|
|
|
|
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
|
2001-04-09 20:45:49 +02:00
|
|
|
|
2018-12-06 16:33:26 +01:00
|
|
|
static const WCHAR mui_stdW[] = { 'M','U','I','_','S','t','d',0 };
|
|
|
|
static const WCHAR mui_dltW[] = { 'M','U','I','_','D','l','t',0 };
|
2004-10-29 23:27:18 +02:00
|
|
|
|
|
|
|
static const int MonthLengths[2][12] =
|
|
|
|
{
|
|
|
|
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
|
|
|
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
|
|
|
};
|
|
|
|
|
2013-10-24 00:40:22 +02:00
|
|
|
static inline BOOL IsLeapYear(int Year)
|
2004-10-29 23:27:18 +02:00
|
|
|
{
|
2013-10-24 00:40:22 +02:00
|
|
|
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0);
|
2004-10-29 23:27:18 +02:00
|
|
|
}
|
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
/***********************************************************************
|
2004-10-27 23:19:22 +02:00
|
|
|
* TIME_DayLightCompareDate
|
2002-12-19 05:12:42 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* Compares two dates without looking at the year.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* date [in] The local time to compare.
|
2008-03-17 21:51:39 +01:00
|
|
|
* compareDate [in] The daylight savings begin or end date.
|
2002-12-19 05:12:42 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* -1 if date < compareDate
|
|
|
|
* 0 if date == compareDate
|
|
|
|
* 1 if date > compareDate
|
2004-12-20 20:27:06 +01:00
|
|
|
* -2 if an error occurs
|
2002-12-19 05:12:42 +01:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
|
|
|
|
const SYSTEMTIME *compareDate )
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
2004-09-10 21:35:06 +02:00
|
|
|
int limit_day, dayinsecs;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
|
|
|
if (date->wMonth < compareDate->wMonth)
|
|
|
|
return -1; /* We are in a month before the date limit. */
|
|
|
|
|
|
|
|
if (date->wMonth > compareDate->wMonth)
|
|
|
|
return 1; /* We are in a month after the date limit. */
|
|
|
|
|
2007-08-09 06:44:50 +02:00
|
|
|
/* if year is 0 then date is in day-of-week format, otherwise
|
|
|
|
* it's absolute date.
|
|
|
|
*/
|
|
|
|
if (compareDate->wYear == 0)
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
2004-10-29 23:27:18 +02:00
|
|
|
WORD First;
|
|
|
|
/* compareDate->wDay is interpreted as number of the week in the month
|
|
|
|
* 5 means: the last week in the month */
|
|
|
|
int weekofmonth = compareDate->wDay;
|
|
|
|
/* calculate the day of the first DayOfWeek in the month */
|
|
|
|
First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay
|
|
|
|
) % 7 + 1;
|
|
|
|
limit_day = First + 7 * (weekofmonth - 1);
|
|
|
|
/* check needed for the 5th weekday of the month */
|
|
|
|
if(limit_day > MonthLengths[date->wMonth==2 && IsLeapYear(date->wYear)]
|
|
|
|
[date->wMonth - 1])
|
|
|
|
limit_day -= 7;
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
limit_day = compareDate->wDay;
|
|
|
|
}
|
|
|
|
|
2004-09-10 21:35:06 +02:00
|
|
|
/* convert to seconds */
|
|
|
|
limit_day = ((limit_day * 24 + compareDate->wHour) * 60 +
|
|
|
|
compareDate->wMinute ) * 60;
|
|
|
|
dayinsecs = ((date->wDay * 24 + date->wHour) * 60 +
|
|
|
|
date->wMinute ) * 60 + date->wSecond;
|
|
|
|
/* and compare */
|
|
|
|
return dayinsecs < limit_day ? -1 :
|
|
|
|
dayinsecs > limit_day ? 1 :
|
|
|
|
0; /* date is equal to the date limit. */
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2004-10-27 23:19:22 +02:00
|
|
|
* TIME_CompTimeZoneID
|
2002-12-19 05:12:42 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* Computes the local time bias for a given time and time zone.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pTZinfo [in] The time zone data.
|
|
|
|
* lpFileTime [in] The system or local time.
|
|
|
|
* islocal [in] it is local time.
|
2002-12-19 05:12:42 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* RETURNS
|
2004-10-27 23:19:22 +02:00
|
|
|
* TIME_ZONE_ID_INVALID An error occurred
|
|
|
|
* TIME_ZONE_ID_UNKNOWN There are no transition time known
|
|
|
|
* TIME_ZONE_ID_STANDARD Current time is standard time
|
2008-03-17 21:51:39 +01:00
|
|
|
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
|
2002-12-19 05:12:42 +01:00
|
|
|
*/
|
2007-07-29 14:27:41 +02:00
|
|
|
static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
|
2006-01-06 21:07:46 +01:00
|
|
|
FILETIME *lpFileTime, BOOL islocal )
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
2012-12-10 11:54:23 +01:00
|
|
|
int ret, year;
|
2003-04-17 04:14:38 +02:00
|
|
|
BOOL beforeStandardDate, afterDaylightDate;
|
2004-10-27 23:19:22 +02:00
|
|
|
DWORD retval = TIME_ZONE_ID_INVALID;
|
2004-09-10 21:35:06 +02:00
|
|
|
LONGLONG llTime = 0; /* initialized to prevent gcc complaining */
|
2004-10-27 23:19:22 +02:00
|
|
|
SYSTEMTIME SysTime;
|
|
|
|
FILETIME ftTemp;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
if (pTZinfo->DaylightDate.wMonth != 0)
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
2007-08-09 06:44:50 +02:00
|
|
|
/* if year is 0 then date is in day-of-week format, otherwise
|
|
|
|
* it's absolute date.
|
|
|
|
*/
|
2007-08-21 14:44:50 +02:00
|
|
|
if (pTZinfo->StandardDate.wMonth == 0 ||
|
|
|
|
(pTZinfo->StandardDate.wYear == 0 &&
|
2007-08-09 06:44:50 +02:00
|
|
|
(pTZinfo->StandardDate.wDay<1 ||
|
2004-10-27 23:19:22 +02:00
|
|
|
pTZinfo->StandardDate.wDay>5 ||
|
|
|
|
pTZinfo->DaylightDate.wDay<1 ||
|
2007-08-21 14:44:50 +02:00
|
|
|
pTZinfo->DaylightDate.wDay>5)))
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2004-10-27 23:19:22 +02:00
|
|
|
return TIME_ZONE_ID_INVALID;
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
|
2004-09-10 21:35:06 +02:00
|
|
|
if (!islocal) {
|
2004-10-27 23:19:22 +02:00
|
|
|
FILETIME2LL( lpFileTime, llTime );
|
2012-12-10 11:54:23 +01:00
|
|
|
llTime -= pTZinfo->Bias * (LONGLONG)600000000;
|
2004-10-27 23:19:22 +02:00
|
|
|
LL2FILETIME( llTime, &ftTemp)
|
|
|
|
lpFileTime = &ftTemp;
|
2004-09-10 21:35:06 +02:00
|
|
|
}
|
2004-10-27 23:19:22 +02:00
|
|
|
|
|
|
|
FileTimeToSystemTime(lpFileTime, &SysTime);
|
2012-12-10 11:54:23 +01:00
|
|
|
year = SysTime.wYear;
|
|
|
|
|
|
|
|
if (!islocal) {
|
|
|
|
llTime -= pTZinfo->DaylightBias * (LONGLONG)600000000;
|
|
|
|
LL2FILETIME( llTime, &ftTemp)
|
|
|
|
FileTimeToSystemTime(lpFileTime, &SysTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for daylight savings */
|
|
|
|
if(year == SysTime.wYear) {
|
|
|
|
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate);
|
|
|
|
if (ret == -2)
|
|
|
|
return TIME_ZONE_ID_INVALID;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2012-12-10 11:54:23 +01:00
|
|
|
beforeStandardDate = ret < 0;
|
|
|
|
} else
|
|
|
|
beforeStandardDate = SysTime.wYear < year;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-09-10 21:35:06 +02:00
|
|
|
if (!islocal) {
|
2004-10-27 23:19:22 +02:00
|
|
|
llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias )
|
|
|
|
* (LONGLONG)600000000;
|
|
|
|
LL2FILETIME( llTime, &ftTemp)
|
|
|
|
FileTimeToSystemTime(lpFileTime, &SysTime);
|
2004-09-10 21:35:06 +02:00
|
|
|
}
|
|
|
|
|
2012-12-10 11:54:23 +01:00
|
|
|
if(year == SysTime.wYear) {
|
|
|
|
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate);
|
|
|
|
if (ret == -2)
|
|
|
|
return TIME_ZONE_ID_INVALID;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2012-12-10 11:54:23 +01:00
|
|
|
afterDaylightDate = ret >= 0;
|
|
|
|
} else
|
|
|
|
afterDaylightDate = SysTime.wYear > year;
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
retval = TIME_ZONE_ID_STANDARD;
|
|
|
|
if( pTZinfo->DaylightDate.wMonth < pTZinfo->StandardDate.wMonth ) {
|
|
|
|
/* Northern hemisphere */
|
2004-09-10 21:35:06 +02:00
|
|
|
if( beforeStandardDate && afterDaylightDate )
|
2004-10-27 23:19:22 +02:00
|
|
|
retval = TIME_ZONE_ID_DAYLIGHT;
|
2004-09-10 21:35:06 +02:00
|
|
|
} else /* Down south */
|
|
|
|
if( beforeStandardDate || afterDaylightDate )
|
2004-10-27 23:19:22 +02:00
|
|
|
retval = TIME_ZONE_ID_DAYLIGHT;
|
|
|
|
} else
|
|
|
|
/* No transition date */
|
|
|
|
retval = TIME_ZONE_ID_UNKNOWN;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TIME_TimeZoneID
|
|
|
|
*
|
2008-03-17 21:51:39 +01:00
|
|
|
* Calculates whether daylight savings is on now.
|
2004-10-27 23:19:22 +02:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* pTzi [in] Timezone info.
|
|
|
|
*
|
|
|
|
* RETURNS
|
2004-10-27 23:19:22 +02:00
|
|
|
* TIME_ZONE_ID_INVALID An error occurred
|
|
|
|
* TIME_ZONE_ID_UNKNOWN There are no transition time known
|
|
|
|
* TIME_ZONE_ID_STANDARD Current time is standard time
|
2008-03-17 21:51:39 +01:00
|
|
|
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
|
2004-10-27 23:19:22 +02:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
FILETIME ftTime;
|
|
|
|
GetSystemTimeAsFileTime( &ftTime);
|
|
|
|
return TIME_CompTimeZoneID( pTzi, &ftTime, FALSE);
|
|
|
|
}
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* TIME_GetTimezoneBias
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* Calculates the local time bias for a given time zone.
|
2004-10-27 23:19:22 +02:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* pTZinfo [in] The time zone data.
|
|
|
|
* lpFileTime [in] The system or local time.
|
|
|
|
* islocal [in] It is local time.
|
|
|
|
* pBias [out] The calculated bias in minutes.
|
2004-10-27 23:19:22 +02:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* RETURNS
|
|
|
|
* TRUE when the time zone bias was calculated.
|
2004-10-27 23:19:22 +02:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
static BOOL TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION *pTZinfo,
|
|
|
|
FILETIME *lpFileTime, BOOL islocal, LONG *pBias )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
LONG bias = pTZinfo->Bias;
|
|
|
|
DWORD tzid = TIME_CompTimeZoneID( pTZinfo, lpFileTime, islocal);
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
if( tzid == TIME_ZONE_ID_INVALID)
|
|
|
|
return FALSE;
|
|
|
|
if (tzid == TIME_ZONE_ID_DAYLIGHT)
|
|
|
|
bias += pTZinfo->DaylightBias;
|
|
|
|
else if (tzid == TIME_ZONE_ID_STANDARD)
|
|
|
|
bias += pTZinfo->StandardBias;
|
2002-12-19 05:12:42 +01:00
|
|
|
*pBias = bias;
|
2004-10-27 23:19:22 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-01-29 21:31:27 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* TIME_GetSpecificTimeZoneKey
|
|
|
|
*
|
|
|
|
* Opens the registry key for the time zone with the given name.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* key_name [in] The time zone name.
|
|
|
|
* result [out] The open registry key handle.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if successful.
|
|
|
|
*/
|
|
|
|
static BOOL TIME_GetSpecificTimeZoneKey( const WCHAR *key_name, HANDLE *result )
|
|
|
|
{
|
|
|
|
static const WCHAR Time_ZonesW[] = { '\\','R','E','G','I','S','T','R','Y','\\',
|
|
|
|
'M','a','c','h','i','n','e','\\',
|
|
|
|
'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s',' ','N','T','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'T','i','m','e',' ','Z','o','n','e','s',0 };
|
|
|
|
HANDLE time_zones_key;
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
UNICODE_STRING nameW;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
attr.Length = sizeof(attr);
|
|
|
|
attr.RootDirectory = 0;
|
|
|
|
attr.ObjectName = &nameW;
|
|
|
|
attr.Attributes = 0;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
|
|
|
RtlInitUnicodeString( &nameW, Time_ZonesW );
|
|
|
|
status = NtOpenKey( &time_zones_key, KEY_READ, &attr );
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
WARN("Unable to open the time zones key\n");
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
attr.RootDirectory = time_zones_key;
|
|
|
|
RtlInitUnicodeString( &nameW, key_name );
|
|
|
|
status = NtOpenKey( result, KEY_READ, &attr );
|
|
|
|
|
|
|
|
NtClose( time_zones_key );
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL reg_query_value(HKEY hkey, LPCWSTR name, DWORD type, void *data, DWORD count)
|
|
|
|
{
|
|
|
|
UNICODE_STRING nameW;
|
|
|
|
char buf[256];
|
|
|
|
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buf;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
if (count > sizeof(buf) - sizeof(KEY_VALUE_PARTIAL_INFORMATION))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&nameW, name);
|
|
|
|
|
|
|
|
if ((status = NtQueryValueKey(hkey, &nameW, KeyValuePartialInformation,
|
|
|
|
buf, sizeof(buf), &count)))
|
|
|
|
{
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->Type != type)
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_DATATYPE_MISMATCH );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(data, info->Data, info->DataLength);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-12-06 16:33:26 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-01-29 21:31:27 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* TIME_GetSpecificTimeZoneInfo
|
|
|
|
*
|
|
|
|
* Returns time zone information for the given time zone and year.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* key_name [in] The time zone name.
|
|
|
|
* year [in] The year, if Dynamic DST is used.
|
|
|
|
* dynamic [in] Whether to use Dynamic DST.
|
|
|
|
* result [out] The time zone information.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if successful.
|
|
|
|
*/
|
|
|
|
static BOOL TIME_GetSpecificTimeZoneInfo( const WCHAR *key_name, WORD year,
|
|
|
|
BOOL dynamic, DYNAMIC_TIME_ZONE_INFORMATION *tzinfo )
|
|
|
|
{
|
|
|
|
static const WCHAR Dynamic_DstW[] = { 'D','y','n','a','m','i','c',' ','D','S','T',0 };
|
|
|
|
static const WCHAR fmtW[] = { '%','d',0 };
|
|
|
|
static const WCHAR stdW[] = { 'S','t','d',0 };
|
|
|
|
static const WCHAR dltW[] = { 'D','l','t',0 };
|
|
|
|
static const WCHAR tziW[] = { 'T','Z','I',0 };
|
|
|
|
HANDLE time_zone_key, dynamic_dst_key;
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
UNICODE_STRING nameW;
|
|
|
|
WCHAR yearW[16];
|
|
|
|
BOOL got_reg_data = FALSE;
|
|
|
|
struct tz_reg_data
|
|
|
|
{
|
|
|
|
LONG bias;
|
|
|
|
LONG std_bias;
|
|
|
|
LONG dlt_bias;
|
|
|
|
SYSTEMTIME std_date;
|
|
|
|
SYSTEMTIME dlt_date;
|
|
|
|
} tz_data;
|
|
|
|
|
|
|
|
if (!TIME_GetSpecificTimeZoneKey( key_name, &time_zone_key ))
|
|
|
|
return FALSE;
|
|
|
|
|
2018-12-06 16:33:26 +01:00
|
|
|
if (!reg_load_mui_string( time_zone_key, mui_stdW, tzinfo->StandardName, sizeof(tzinfo->StandardName) ) &&
|
|
|
|
!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) ))
|
2016-01-29 21:31:27 +01:00
|
|
|
{
|
|
|
|
NtClose( time_zone_key );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lstrcpyW(tzinfo->TimeZoneKeyName, key_name);
|
|
|
|
|
|
|
|
if (dynamic)
|
|
|
|
{
|
|
|
|
attr.Length = sizeof(attr);
|
|
|
|
attr.RootDirectory = time_zone_key;
|
|
|
|
attr.ObjectName = &nameW;
|
|
|
|
attr.Attributes = 0;
|
|
|
|
attr.SecurityDescriptor = NULL;
|
|
|
|
attr.SecurityQualityOfService = NULL;
|
|
|
|
RtlInitUnicodeString( &nameW, Dynamic_DstW );
|
|
|
|
if (!NtOpenKey( &dynamic_dst_key, KEY_READ, &attr ))
|
|
|
|
{
|
|
|
|
sprintfW( yearW, fmtW, year );
|
|
|
|
got_reg_data = reg_query_value( dynamic_dst_key, yearW, REG_BINARY, &tz_data, sizeof(tz_data) );
|
|
|
|
|
|
|
|
NtClose( dynamic_dst_key );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!got_reg_data)
|
|
|
|
{
|
|
|
|
if (!reg_query_value( time_zone_key, tziW, REG_BINARY, &tz_data, sizeof(tz_data) ))
|
|
|
|
{
|
|
|
|
NtClose( time_zone_key );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tzinfo->Bias = tz_data.bias;
|
|
|
|
tzinfo->StandardBias = tz_data.std_bias;
|
|
|
|
tzinfo->DaylightBias = tz_data.dlt_bias;
|
|
|
|
tzinfo->StandardDate = tz_data.std_date;
|
|
|
|
tzinfo->DaylightDate = tz_data.dlt_date;
|
|
|
|
|
|
|
|
tzinfo->DynamicDaylightTimeDisabled = !dynamic;
|
|
|
|
|
|
|
|
NtClose( time_zone_key );
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetLocalTime (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Set the local time using current time zone and daylight
|
|
|
|
* savings settings.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* systime [in] The desired local time.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
2006-01-06 21:07:46 +01:00
|
|
|
* Success: TRUE. The time was set.
|
2004-10-27 23:19:22 +02:00
|
|
|
* Failure: FALSE, if the time was invalid or caller does not have
|
|
|
|
* permission to change the time.
|
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI SetLocalTime( const SYSTEMTIME *systime )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
FILETIME ft;
|
|
|
|
LARGE_INTEGER st, st2;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
2004-11-06 04:53:53 +01:00
|
|
|
if( !SystemTimeToFileTime( systime, &ft ))
|
|
|
|
return FALSE;
|
2004-10-27 23:19:22 +02:00
|
|
|
st.u.LowPart = ft.dwLowDateTime;
|
|
|
|
st.u.HighPart = ft.dwHighDateTime;
|
|
|
|
RtlLocalTimeToSystemTime( &st, &st2 );
|
|
|
|
|
|
|
|
if ((status = NtSetSystemTime(&st2, NULL)))
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return !status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetSystemTimeAdjustment (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Get the period between clock interrupts and the amount the clock
|
|
|
|
* is adjusted each interrupt so as to keep it in sync with an external source.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* lpTimeAdjustment [out] The clock adjustment per interrupt in 100's of nanoseconds.
|
|
|
|
* lpTimeIncrement [out] The time between clock interrupts in 100's of nanoseconds.
|
|
|
|
* lpTimeAdjustmentDisabled [out] The clock synchronisation has been disabled.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
|
|
|
* TRUE.
|
|
|
|
*
|
|
|
|
* BUGS
|
|
|
|
* Only the special case of disabled time adjustments is supported.
|
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement,
|
|
|
|
PBOOL lpTimeAdjustmentDisabled )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
*lpTimeAdjustment = 0;
|
2009-09-30 22:09:31 +02:00
|
|
|
*lpTimeIncrement = 10000000 / sysconf(_SC_CLK_TCK);
|
2004-10-27 23:19:22 +02:00
|
|
|
*lpTimeAdjustmentDisabled = TRUE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetSystemTime (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Set the system time in utc.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* systime [in] The desired system time.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
2006-01-06 21:07:46 +01:00
|
|
|
* Success: TRUE. The time was set.
|
2004-10-27 23:19:22 +02:00
|
|
|
* Failure: FALSE, if the time was invalid or caller does not have
|
|
|
|
* permission to change the time.
|
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI SetSystemTime( const SYSTEMTIME *systime )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
FILETIME ft;
|
|
|
|
LARGE_INTEGER t;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
2004-11-06 04:53:53 +01:00
|
|
|
if( !SystemTimeToFileTime( systime, &ft ))
|
|
|
|
return FALSE;
|
2004-10-27 23:19:22 +02:00
|
|
|
t.u.LowPart = ft.dwLowDateTime;
|
|
|
|
t.u.HighPart = ft.dwHighDateTime;
|
|
|
|
if ((status = NtSetSystemTime(&t, NULL)))
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return !status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetSystemTimeAdjustment (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Enables or disables the timing adjustments to the system's clock.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* dwTimeAdjustment [in] Number of units to add per clock interrupt.
|
|
|
|
* bTimeAdjustmentDisabled [in] Adjustment mode.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
/* Fake function for now... */
|
2006-10-12 22:56:29 +02:00
|
|
|
FIXME("(%08x,%d): stub !\n", dwTimeAdjustment, bTimeAdjustmentDisabled);
|
2002-12-19 05:12:42 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* GetTimeZoneInformation (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Get information about the current local time zone.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* tzinfo [out] Destination for time zone information.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
2006-01-06 21:07:46 +01:00
|
|
|
* TIME_ZONE_ID_INVALID An error occurred
|
|
|
|
* TIME_ZONE_ID_UNKNOWN There are no transition time known
|
|
|
|
* TIME_ZONE_ID_STANDARD Current time is standard time
|
2008-04-03 19:10:30 +02:00
|
|
|
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
|
2004-10-27 23:19:22 +02:00
|
|
|
*/
|
2018-12-06 16:33:26 +01:00
|
|
|
DWORD WINAPI GetTimeZoneInformation( LPTIME_ZONE_INFORMATION ret )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
2018-12-06 16:33:26 +01:00
|
|
|
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
|
|
|
DWORD time_zone_id;
|
2005-06-20 20:37:17 +02:00
|
|
|
|
2018-12-06 16:33:26 +01:00
|
|
|
time_zone_id = GetDynamicTimeZoneInformation( &tzinfo );
|
|
|
|
memcpy( ret, &tzinfo, sizeof(*ret) );
|
|
|
|
return time_zone_id;
|
2004-10-27 23:19:22 +02:00
|
|
|
}
|
|
|
|
|
2016-01-29 21:31:27 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* GetTimeZoneInformationForYear (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetTimeZoneInformationForYear( USHORT wYear,
|
|
|
|
PDYNAMIC_TIME_ZONE_INFORMATION pdtzi, LPTIME_ZONE_INFORMATION ptzi )
|
|
|
|
{
|
|
|
|
DYNAMIC_TIME_ZONE_INFORMATION local_dtzi, result;
|
|
|
|
|
|
|
|
if (!pdtzi)
|
|
|
|
{
|
|
|
|
if (GetDynamicTimeZoneInformation(&local_dtzi) == TIME_ZONE_ID_INVALID)
|
|
|
|
return FALSE;
|
|
|
|
pdtzi = &local_dtzi;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!TIME_GetSpecificTimeZoneInfo(pdtzi->TimeZoneKeyName, wYear,
|
|
|
|
!pdtzi->DynamicDaylightTimeDisabled, &result))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
memcpy(ptzi, &result, sizeof(*ptzi));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-10-27 23:19:22 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetTimeZoneInformation (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Change the settings of the current local time zone.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* tzinfo [in] The new time zone.
|
|
|
|
*
|
2004-10-27 23:19:22 +02:00
|
|
|
* RETURNS
|
2006-01-06 21:07:46 +01:00
|
|
|
* Success: TRUE. The time zone was updated with the settings from tzinfo.
|
2004-10-27 23:19:22 +02:00
|
|
|
* Failure: FALSE.
|
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI SetTimeZoneInformation( const TIME_ZONE_INFORMATION *tzinfo )
|
2004-10-27 23:19:22 +02:00
|
|
|
{
|
|
|
|
NTSTATUS status;
|
2006-09-14 18:39:53 +02:00
|
|
|
status = RtlSetTimeZoneInformation( (const RTL_TIME_ZONE_INFORMATION *)tzinfo );
|
2005-06-20 20:37:17 +02:00
|
|
|
if ( status != STATUS_SUCCESS )
|
2004-10-27 23:19:22 +02:00
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return !status;
|
|
|
|
}
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
/***********************************************************************
|
2001-06-13 22:13:18 +02:00
|
|
|
* SystemTimeToTzSpecificLocalTime (KERNEL32.@)
|
2000-12-20 00:33:03 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Convert a utc system time to a local time in a given time zone.
|
2000-12-20 00:33:03 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* lpTimeZoneInformation [in] The desired time zone.
|
|
|
|
* lpUniversalTime [in] The utc time to base local time on.
|
|
|
|
* lpLocalTime [out] The local time in the time zone.
|
|
|
|
*
|
2000-12-20 00:33:03 +01:00
|
|
|
* RETURNS
|
2003-03-18 19:35:48 +01:00
|
|
|
* Success: TRUE. lpLocalTime contains the converted time
|
|
|
|
* Failure: FALSE.
|
2000-09-29 22:48:04 +02:00
|
|
|
*/
|
2002-12-19 05:12:42 +01:00
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
BOOL WINAPI SystemTimeToTzSpecificLocalTime(
|
2009-05-04 10:52:14 +02:00
|
|
|
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
|
|
|
const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime )
|
2000-09-29 22:48:04 +02:00
|
|
|
{
|
2002-12-19 05:12:42 +01:00
|
|
|
FILETIME ft;
|
|
|
|
LONG lBias;
|
2004-09-10 21:35:06 +02:00
|
|
|
LONGLONG llTime;
|
2002-12-19 05:12:42 +01:00
|
|
|
TIME_ZONE_INFORMATION tzinfo;
|
|
|
|
|
|
|
|
if (lpTimeZoneInformation != NULL)
|
|
|
|
{
|
2008-03-03 23:27:46 +01:00
|
|
|
tzinfo = *lpTimeZoneInformation;
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-17 16:31:45 +01:00
|
|
|
RtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!SystemTimeToFileTime(lpUniversalTime, &ft))
|
|
|
|
return FALSE;
|
2004-09-10 21:35:06 +02:00
|
|
|
FILETIME2LL( &ft, llTime)
|
2004-10-27 23:19:22 +02:00
|
|
|
if (!TIME_GetTimezoneBias(&tzinfo, &ft, FALSE, &lBias))
|
2002-12-19 05:12:42 +01:00
|
|
|
return FALSE;
|
2004-09-10 21:35:06 +02:00
|
|
|
/* convert minutes to 100-nanoseconds-ticks */
|
|
|
|
llTime -= (LONGLONG)lBias * 600000000;
|
|
|
|
LL2FILETIME( llTime, &ft)
|
2002-12-19 05:12:42 +01:00
|
|
|
|
|
|
|
return FileTimeToSystemTime(&ft, lpLocalTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TzSpecificLocalTimeToSystemTime (KERNEL32.@)
|
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Converts a local time to a time in utc.
|
2002-12-19 05:12:42 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* lpTimeZoneInformation [in] The desired time zone.
|
|
|
|
* lpLocalTime [in] The local time.
|
|
|
|
* lpUniversalTime [out] The calculated utc time.
|
|
|
|
*
|
2002-12-19 05:12:42 +01:00
|
|
|
* RETURNS
|
2006-01-06 21:07:46 +01:00
|
|
|
* Success: TRUE. lpUniversalTime contains the converted time.
|
2003-03-18 19:35:48 +01:00
|
|
|
* Failure: FALSE.
|
2002-12-19 05:12:42 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI TzSpecificLocalTimeToSystemTime(
|
2009-05-04 10:52:14 +02:00
|
|
|
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
|
|
|
const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime)
|
2002-12-19 05:12:42 +01:00
|
|
|
{
|
|
|
|
FILETIME ft;
|
|
|
|
LONG lBias;
|
2004-09-10 21:35:06 +02:00
|
|
|
LONGLONG t;
|
2002-12-19 05:12:42 +01:00
|
|
|
TIME_ZONE_INFORMATION tzinfo;
|
|
|
|
|
|
|
|
if (lpTimeZoneInformation != NULL)
|
|
|
|
{
|
2008-03-03 23:27:46 +01:00
|
|
|
tzinfo = *lpTimeZoneInformation;
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-17 16:31:45 +01:00
|
|
|
RtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
|
2002-12-19 05:12:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!SystemTimeToFileTime(lpLocalTime, &ft))
|
|
|
|
return FALSE;
|
2004-09-10 21:35:06 +02:00
|
|
|
FILETIME2LL( &ft, t)
|
2004-10-27 23:19:22 +02:00
|
|
|
if (!TIME_GetTimezoneBias(&tzinfo, &ft, TRUE, &lBias))
|
2002-12-19 05:12:42 +01:00
|
|
|
return FALSE;
|
2004-09-10 21:35:06 +02:00
|
|
|
/* convert minutes to 100-nanoseconds-ticks */
|
|
|
|
t += (LONGLONG)lBias * 600000000;
|
|
|
|
LL2FILETIME( t, &ft)
|
2002-12-19 05:12:42 +01:00
|
|
|
return FileTimeToSystemTime(&ft, lpUniversalTime);
|
2000-09-29 22:48:04 +02:00
|
|
|
}
|
|
|
|
|
2000-10-01 03:40:42 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-13 22:13:18 +02:00
|
|
|
* GetSystemTimeAsFileTime (KERNEL32.@)
|
2000-12-20 00:33:03 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Get the current time in utc format.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
2000-10-01 03:40:42 +02:00
|
|
|
*/
|
2000-12-20 00:33:03 +01:00
|
|
|
VOID WINAPI GetSystemTimeAsFileTime(
|
2003-03-18 19:35:48 +01:00
|
|
|
LPFILETIME time) /* [out] Destination for the current utc time */
|
2000-10-01 03:40:42 +02:00
|
|
|
{
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER t;
|
|
|
|
NtQuerySystemTime( &t );
|
2004-01-23 02:51:33 +01:00
|
|
|
time->dwLowDateTime = t.u.LowPart;
|
|
|
|
time->dwHighDateTime = t.u.HighPart;
|
2000-10-01 03:40:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-19 21:20:46 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* GetSystemTimePreciseAsFileTime (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Get the current time in utc format, with <1 us precision.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
|
|
|
*/
|
|
|
|
VOID WINAPI GetSystemTimePreciseAsFileTime(
|
|
|
|
LPFILETIME time) /* [out] Destination for the current utc time */
|
|
|
|
{
|
|
|
|
GetSystemTimeAsFileTime(time);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
/*********************************************************************
|
2000-12-20 00:33:03 +01:00
|
|
|
* TIME_ClockTimeToFileTime (olorin@fandra.org, 20-Sep-1998)
|
|
|
|
*
|
|
|
|
* Used by GetProcessTimes to convert clock_t into FILETIME.
|
|
|
|
*
|
2000-09-29 22:48:04 +02:00
|
|
|
* Differences to UnixTimeToFileTime:
|
|
|
|
* 1) Divided by CLK_TCK
|
2002-06-01 01:06:46 +02:00
|
|
|
* 2) Time is relative. There is no 'starting date', so there is
|
2003-08-18 21:47:42 +02:00
|
|
|
* no need for offset correction, like in UnixTimeToFileTime
|
2000-09-29 22:48:04 +02:00
|
|
|
*/
|
|
|
|
static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
|
|
|
|
{
|
2007-09-10 10:14:42 +02:00
|
|
|
long clocksPerSec = sysconf(_SC_CLK_TCK);
|
2009-08-24 12:50:11 +02:00
|
|
|
ULONGLONG secs = (ULONGLONG)unix_time * 10000000 / clocksPerSec;
|
2002-05-29 19:04:10 +02:00
|
|
|
filetime->dwLowDateTime = (DWORD)secs;
|
|
|
|
filetime->dwHighDateTime = (DWORD)(secs >> 32);
|
2000-09-29 22:48:04 +02:00
|
|
|
}
|
|
|
|
|
2018-04-18 09:44:29 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* TIMEZONE_InitRegistry
|
|
|
|
*
|
|
|
|
* Update registry contents on startup if the user timezone has changed.
|
|
|
|
* This simulates the action of the Windows control panel.
|
|
|
|
*/
|
|
|
|
void TIMEZONE_InitRegistry(void)
|
|
|
|
{
|
|
|
|
static const WCHAR timezoneInformationW[] = {
|
|
|
|
'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 standardNameW[] = {'S','t','a','n','d','a','r','d','N','a','m','e','\0'};
|
|
|
|
static const WCHAR timezoneKeyNameW[] = {'T','i','m','e','Z','o','n','e','K','e','y','N','a','m','e','\0'};
|
|
|
|
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
|
|
|
UNICODE_STRING name;
|
|
|
|
OBJECT_ATTRIBUTES attr;
|
|
|
|
HANDLE hkey;
|
|
|
|
DWORD tzid;
|
|
|
|
|
|
|
|
tzid = GetDynamicTimeZoneInformation(&tzinfo);
|
|
|
|
if (tzid == TIME_ZONE_ID_INVALID) return;
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&name, timezoneInformationW);
|
|
|
|
InitializeObjectAttributes(&attr, &name, 0, 0, NULL);
|
|
|
|
if (NtCreateKey(&hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL) != STATUS_SUCCESS) return;
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&name, standardNameW);
|
|
|
|
NtSetValueKey(hkey, &name, 0, REG_SZ, tzinfo.StandardName,
|
|
|
|
(strlenW(tzinfo.StandardName) + 1) * sizeof(WCHAR));
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&name, timezoneKeyNameW);
|
|
|
|
NtSetValueKey(hkey, &name, 0, REG_SZ, tzinfo.TimeZoneKeyName,
|
|
|
|
(strlenW(tzinfo.TimeZoneKeyName) + 1) * sizeof(WCHAR));
|
|
|
|
|
|
|
|
NtClose( hkey );
|
|
|
|
}
|
|
|
|
|
2000-09-29 22:48:04 +02:00
|
|
|
/*********************************************************************
|
2001-06-13 22:13:18 +02:00
|
|
|
* GetProcessTimes (KERNEL32.@)
|
2000-09-29 22:48:04 +02:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* Get the user and kernel execution times of a process,
|
2000-12-20 00:33:03 +01:00
|
|
|
* along with the creation and exit times if known.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* hprocess [in] The process to be queried.
|
|
|
|
* lpCreationTime [out] The creation time of the process.
|
|
|
|
* lpExitTime [out] The exit time of the process if exited.
|
|
|
|
* lpKernelTime [out] The time spent in kernel routines in 100's of nanoseconds.
|
|
|
|
* lpUserTime [out] The time spent in user routines in 100's of nanoseconds.
|
|
|
|
*
|
2000-12-20 00:33:03 +01:00
|
|
|
* RETURNS
|
2003-03-18 19:35:48 +01:00
|
|
|
* TRUE.
|
2000-12-20 00:33:03 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* NOTES
|
|
|
|
* olorin@fandra.org:
|
|
|
|
* Would be nice to subtract the cpu time used by Wine at startup.
|
|
|
|
* Also, there is a need to separate times used by different applications.
|
2000-12-20 00:33:03 +01:00
|
|
|
*
|
|
|
|
* BUGS
|
2006-07-20 23:30:04 +02:00
|
|
|
* KernelTime and UserTime are always for the current process
|
2000-09-29 22:48:04 +02:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
BOOL WINAPI GetProcessTimes( HANDLE hprocess, LPFILETIME lpCreationTime,
|
|
|
|
LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime )
|
2000-09-29 22:48:04 +02:00
|
|
|
{
|
|
|
|
struct tms tms;
|
2006-07-20 23:30:04 +02:00
|
|
|
KERNEL_USER_TIMES pti;
|
2000-09-29 22:48:04 +02:00
|
|
|
|
|
|
|
times(&tms);
|
|
|
|
TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
|
|
|
|
TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
|
2006-07-20 23:30:04 +02:00
|
|
|
if (NtQueryInformationProcess( hprocess, ProcessTimes, &pti, sizeof(pti), NULL))
|
|
|
|
return FALSE;
|
|
|
|
LL2FILETIME( pti.CreateTime.QuadPart, lpCreationTime);
|
|
|
|
LL2FILETIME( pti.ExitTime.QuadPart, lpExitTime);
|
2000-09-29 22:48:04 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2001-02-26 23:33:29 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-19 05:36:23 +02:00
|
|
|
* GetCalendarInfoA (KERNEL32.@)
|
2001-02-26 23:33:29 +01:00
|
|
|
*
|
|
|
|
*/
|
2003-12-01 23:47:28 +01:00
|
|
|
int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
|
2001-02-26 23:33:29 +01:00
|
|
|
LPSTR lpCalData, int cchData, LPDWORD lpValue)
|
|
|
|
{
|
2014-06-12 15:51:24 +02:00
|
|
|
int ret, cchDataW = cchData;
|
2002-05-14 23:44:07 +02:00
|
|
|
LPWSTR lpCalDataW = NULL;
|
|
|
|
|
2003-12-01 23:47:28 +01:00
|
|
|
if (NLS_IsUnicodeOnlyLcid(lcid))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-12 15:51:24 +02:00
|
|
|
if (!cchData && !(CalType & CAL_RETURN_NUMBER))
|
|
|
|
cchDataW = GetCalendarInfoW(lcid, Calendar, CalType, NULL, 0, NULL);
|
|
|
|
if (!(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchDataW*sizeof(WCHAR))))
|
|
|
|
return 0;
|
2003-12-01 23:47:28 +01:00
|
|
|
|
2014-06-12 15:51:24 +02:00
|
|
|
ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchDataW, lpValue);
|
2002-05-14 23:44:07 +02:00
|
|
|
if(ret && lpCalDataW && lpCalData)
|
2014-06-12 15:51:24 +02:00
|
|
|
ret = WideCharToMultiByte(CP_ACP, 0, lpCalDataW, -1, lpCalData, cchData, NULL, NULL);
|
2011-06-08 16:18:26 +02:00
|
|
|
else if (CalType & CAL_RETURN_NUMBER)
|
|
|
|
ret *= sizeof(WCHAR);
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpCalDataW);
|
2002-05-14 23:44:07 +02:00
|
|
|
|
|
|
|
return ret;
|
2001-02-26 23:33:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-19 05:36:23 +02:00
|
|
|
* GetCalendarInfoW (KERNEL32.@)
|
2001-02-26 23:33:29 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType,
|
|
|
|
LPWSTR lpCalData, int cchData, LPDWORD lpValue)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2016-09-01 01:04:51 +02:00
|
|
|
static const LCTYPE caltype_lctype_map[] = {
|
|
|
|
0, /* not used */
|
|
|
|
0, /* CAL_ICALINTVALUE */
|
|
|
|
0, /* CAL_SCALNAME */
|
|
|
|
0, /* CAL_IYEAROFFSETRANGE */
|
|
|
|
0, /* CAL_SERASTRING */
|
|
|
|
LOCALE_SSHORTDATE,
|
|
|
|
LOCALE_SLONGDATE,
|
|
|
|
LOCALE_SDAYNAME1,
|
|
|
|
LOCALE_SDAYNAME2,
|
|
|
|
LOCALE_SDAYNAME3,
|
|
|
|
LOCALE_SDAYNAME4,
|
|
|
|
LOCALE_SDAYNAME5,
|
|
|
|
LOCALE_SDAYNAME6,
|
|
|
|
LOCALE_SDAYNAME7,
|
|
|
|
LOCALE_SABBREVDAYNAME1,
|
|
|
|
LOCALE_SABBREVDAYNAME2,
|
|
|
|
LOCALE_SABBREVDAYNAME3,
|
|
|
|
LOCALE_SABBREVDAYNAME4,
|
|
|
|
LOCALE_SABBREVDAYNAME5,
|
|
|
|
LOCALE_SABBREVDAYNAME6,
|
|
|
|
LOCALE_SABBREVDAYNAME7,
|
|
|
|
LOCALE_SMONTHNAME1,
|
|
|
|
LOCALE_SMONTHNAME2,
|
|
|
|
LOCALE_SMONTHNAME3,
|
|
|
|
LOCALE_SMONTHNAME4,
|
|
|
|
LOCALE_SMONTHNAME5,
|
|
|
|
LOCALE_SMONTHNAME6,
|
|
|
|
LOCALE_SMONTHNAME7,
|
|
|
|
LOCALE_SMONTHNAME8,
|
|
|
|
LOCALE_SMONTHNAME9,
|
|
|
|
LOCALE_SMONTHNAME10,
|
|
|
|
LOCALE_SMONTHNAME11,
|
|
|
|
LOCALE_SMONTHNAME12,
|
|
|
|
LOCALE_SMONTHNAME13,
|
|
|
|
LOCALE_SABBREVMONTHNAME1,
|
|
|
|
LOCALE_SABBREVMONTHNAME2,
|
|
|
|
LOCALE_SABBREVMONTHNAME3,
|
|
|
|
LOCALE_SABBREVMONTHNAME4,
|
|
|
|
LOCALE_SABBREVMONTHNAME5,
|
|
|
|
LOCALE_SABBREVMONTHNAME6,
|
|
|
|
LOCALE_SABBREVMONTHNAME7,
|
|
|
|
LOCALE_SABBREVMONTHNAME8,
|
|
|
|
LOCALE_SABBREVMONTHNAME9,
|
|
|
|
LOCALE_SABBREVMONTHNAME10,
|
|
|
|
LOCALE_SABBREVMONTHNAME11,
|
|
|
|
LOCALE_SABBREVMONTHNAME12,
|
|
|
|
LOCALE_SABBREVMONTHNAME13,
|
|
|
|
LOCALE_SYEARMONTH,
|
|
|
|
0, /* CAL_ITWODIGITYEARMAX */
|
|
|
|
LOCALE_SSHORTESTDAYNAME1,
|
|
|
|
LOCALE_SSHORTESTDAYNAME2,
|
|
|
|
LOCALE_SSHORTESTDAYNAME3,
|
|
|
|
LOCALE_SSHORTESTDAYNAME4,
|
|
|
|
LOCALE_SSHORTESTDAYNAME5,
|
|
|
|
LOCALE_SSHORTESTDAYNAME6,
|
|
|
|
LOCALE_SSHORTESTDAYNAME7,
|
|
|
|
LOCALE_SMONTHDAY,
|
|
|
|
0, /* CAL_SABBREVERASTRING */
|
|
|
|
};
|
2016-09-05 18:46:06 +02:00
|
|
|
DWORD localeflags = 0;
|
2016-09-01 01:04:51 +02:00
|
|
|
CALTYPE calinfo;
|
|
|
|
|
2002-05-14 23:44:07 +02:00
|
|
|
if (CalType & CAL_NOUSEROVERRIDE)
|
|
|
|
FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n");
|
|
|
|
if (CalType & CAL_USE_CP_ACP)
|
|
|
|
FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n");
|
|
|
|
|
|
|
|
if (CalType & CAL_RETURN_NUMBER) {
|
2011-06-08 16:18:26 +02:00
|
|
|
if (!lpValue)
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return 0;
|
|
|
|
}
|
2002-05-14 23:44:07 +02:00
|
|
|
if (lpCalData != NULL)
|
|
|
|
WARN("lpCalData not NULL (%p) when it should!\n", lpCalData);
|
|
|
|
if (cchData != 0)
|
|
|
|
WARN("cchData not 0 (%d) when it should!\n", cchData);
|
|
|
|
} else {
|
|
|
|
if (lpValue != NULL)
|
|
|
|
WARN("lpValue not NULL (%p) when it should!\n", lpValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: No verification is made yet wrt Locale
|
|
|
|
* for the CALTYPES not requiring GetLocaleInfoA */
|
2016-09-01 01:04:51 +02:00
|
|
|
|
|
|
|
calinfo = CalType & 0xffff;
|
|
|
|
|
2016-09-05 18:46:06 +02:00
|
|
|
if (CalType & CAL_RETURN_GENITIVE_NAMES)
|
|
|
|
localeflags |= LOCALE_RETURN_GENITIVE_NAMES;
|
|
|
|
|
2016-09-01 01:04:51 +02:00
|
|
|
switch (calinfo) {
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_ICALINTVALUE:
|
2013-05-20 22:32:36 +02:00
|
|
|
if (CalType & CAL_RETURN_NUMBER)
|
|
|
|
return GetLocaleInfoW(Locale, LOCALE_RETURN_NUMBER | LOCALE_ICALENDARTYPE,
|
|
|
|
(LPWSTR)lpValue, 2);
|
|
|
|
return GetLocaleInfoW(Locale, LOCALE_ICALENDARTYPE, lpCalData, cchData);
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_SCALNAME:
|
2016-09-01 01:04:51 +02:00
|
|
|
FIXME("Unimplemented caltype %d\n", calinfo);
|
2013-05-20 22:37:56 +02:00
|
|
|
if (lpCalData) *lpCalData = 0;
|
|
|
|
return 1;
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_IYEAROFFSETRANGE:
|
2016-09-01 01:04:51 +02:00
|
|
|
FIXME("Unimplemented caltype %d\n", calinfo);
|
2008-08-06 13:31:55 +02:00
|
|
|
return 0;
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_SERASTRING:
|
2016-09-01 01:04:51 +02:00
|
|
|
FIXME("Unimplemented caltype %d\n", calinfo);
|
2008-08-06 13:31:55 +02:00
|
|
|
return 0;
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_SSHORTDATE:
|
|
|
|
case CAL_SLONGDATE:
|
|
|
|
case CAL_SDAYNAME1:
|
|
|
|
case CAL_SDAYNAME2:
|
|
|
|
case CAL_SDAYNAME3:
|
|
|
|
case CAL_SDAYNAME4:
|
|
|
|
case CAL_SDAYNAME5:
|
|
|
|
case CAL_SDAYNAME6:
|
|
|
|
case CAL_SDAYNAME7:
|
|
|
|
case CAL_SABBREVDAYNAME1:
|
|
|
|
case CAL_SABBREVDAYNAME2:
|
|
|
|
case CAL_SABBREVDAYNAME3:
|
|
|
|
case CAL_SABBREVDAYNAME4:
|
|
|
|
case CAL_SABBREVDAYNAME5:
|
|
|
|
case CAL_SABBREVDAYNAME6:
|
|
|
|
case CAL_SABBREVDAYNAME7:
|
|
|
|
case CAL_SMONTHNAME1:
|
|
|
|
case CAL_SMONTHNAME2:
|
|
|
|
case CAL_SMONTHNAME3:
|
|
|
|
case CAL_SMONTHNAME4:
|
|
|
|
case CAL_SMONTHNAME5:
|
|
|
|
case CAL_SMONTHNAME6:
|
|
|
|
case CAL_SMONTHNAME7:
|
|
|
|
case CAL_SMONTHNAME8:
|
|
|
|
case CAL_SMONTHNAME9:
|
|
|
|
case CAL_SMONTHNAME10:
|
|
|
|
case CAL_SMONTHNAME11:
|
|
|
|
case CAL_SMONTHNAME12:
|
|
|
|
case CAL_SMONTHNAME13:
|
|
|
|
case CAL_SABBREVMONTHNAME1:
|
|
|
|
case CAL_SABBREVMONTHNAME2:
|
|
|
|
case CAL_SABBREVMONTHNAME3:
|
|
|
|
case CAL_SABBREVMONTHNAME4:
|
|
|
|
case CAL_SABBREVMONTHNAME5:
|
|
|
|
case CAL_SABBREVMONTHNAME6:
|
|
|
|
case CAL_SABBREVMONTHNAME7:
|
|
|
|
case CAL_SABBREVMONTHNAME8:
|
|
|
|
case CAL_SABBREVMONTHNAME9:
|
|
|
|
case CAL_SABBREVMONTHNAME10:
|
|
|
|
case CAL_SABBREVMONTHNAME11:
|
|
|
|
case CAL_SABBREVMONTHNAME12:
|
|
|
|
case CAL_SABBREVMONTHNAME13:
|
|
|
|
case CAL_SYEARMONTH:
|
2016-09-05 18:46:06 +02:00
|
|
|
return GetLocaleInfoW(Locale, caltype_lctype_map[calinfo] | localeflags, lpCalData, cchData);
|
2002-05-14 23:44:07 +02:00
|
|
|
case CAL_ITWODIGITYEARMAX:
|
2011-06-08 16:18:26 +02:00
|
|
|
if (CalType & CAL_RETURN_NUMBER)
|
|
|
|
{
|
|
|
|
*lpValue = CALINFO_MAX_YEAR;
|
|
|
|
return sizeof(DWORD) / sizeof(WCHAR);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
|
|
|
WCHAR buffer[10];
|
|
|
|
int ret = snprintfW( buffer, 10, fmtW, CALINFO_MAX_YEAR ) + 1;
|
|
|
|
if (!lpCalData) return ret;
|
|
|
|
if (ret <= cchData)
|
|
|
|
{
|
|
|
|
strcpyW( lpCalData, buffer );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
|
|
|
return 0;
|
|
|
|
}
|
2002-06-13 23:44:15 +02:00
|
|
|
break;
|
2008-08-06 13:31:55 +02:00
|
|
|
default:
|
2016-09-01 01:04:51 +02:00
|
|
|
FIXME("Unknown caltype %d\n", calinfo);
|
2008-08-06 13:31:55 +02:00
|
|
|
SetLastError(ERROR_INVALID_FLAGS);
|
|
|
|
return 0;
|
2002-05-14 23:44:07 +02:00
|
|
|
}
|
2001-02-26 23:33:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-02-28 06:13:56 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* GetCalendarInfoEx (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
int WINAPI GetCalendarInfoEx(LPCWSTR locale, CALID calendar, LPCWSTR lpReserved, CALTYPE caltype,
|
|
|
|
LPWSTR data, int len, DWORD *value)
|
|
|
|
{
|
2017-01-24 19:01:36 +01:00
|
|
|
static int once;
|
|
|
|
|
2014-02-28 06:13:56 +01:00
|
|
|
LCID lcid = LocaleNameToLCID(locale, 0);
|
2017-01-24 19:01:36 +01:00
|
|
|
if (!once++)
|
|
|
|
FIXME("(%s, %d, %p, 0x%08x, %p, %d, %p): semi-stub\n", debugstr_w(locale), calendar, lpReserved, caltype,
|
2014-02-28 06:13:56 +01:00
|
|
|
data, len, value);
|
|
|
|
return GetCalendarInfoW(lcid, calendar, caltype, data, len, value);
|
|
|
|
}
|
|
|
|
|
2001-02-26 23:33:29 +01:00
|
|
|
/*********************************************************************
|
2001-06-19 05:36:23 +02:00
|
|
|
* SetCalendarInfoA (KERNEL32.@)
|
2001-02-26 23:33:29 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
int WINAPI SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData)
|
|
|
|
{
|
2006-10-12 22:56:29 +02:00
|
|
|
FIXME("(%08x,%08x,%08x,%s): stub\n",
|
2001-02-26 23:33:29 +01:00
|
|
|
Locale, Calendar, CalType, debugstr_a(lpCalData));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-19 05:36:23 +02:00
|
|
|
* SetCalendarInfoW (KERNEL32.@)
|
2001-02-26 23:33:29 +01:00
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
*
|
2001-02-26 23:33:29 +01:00
|
|
|
*/
|
|
|
|
int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData)
|
|
|
|
{
|
2006-10-12 22:56:29 +02:00
|
|
|
FIXME("(%08x,%08x,%08x,%s): stub\n",
|
2001-02-26 23:33:29 +01:00
|
|
|
Locale, Calendar, CalType, debugstr_w(lpCalData));
|
|
|
|
return 0;
|
|
|
|
}
|
2002-12-11 01:19:56 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* LocalFileTimeToFileTime (KERNEL32.@)
|
|
|
|
*/
|
2002-12-13 21:53:04 +01:00
|
|
|
BOOL WINAPI LocalFileTimeToFileTime( const FILETIME *localft, LPFILETIME utcft )
|
2002-12-11 01:19:56 +01:00
|
|
|
{
|
|
|
|
NTSTATUS status;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER local, utc;
|
|
|
|
|
2004-01-23 02:51:33 +01:00
|
|
|
local.u.LowPart = localft->dwLowDateTime;
|
|
|
|
local.u.HighPart = localft->dwHighDateTime;
|
2002-12-13 21:53:04 +01:00
|
|
|
if (!(status = RtlLocalTimeToSystemTime( &local, &utc )))
|
|
|
|
{
|
2004-01-23 02:51:33 +01:00
|
|
|
utcft->dwLowDateTime = utc.u.LowPart;
|
|
|
|
utcft->dwHighDateTime = utc.u.HighPart;
|
2002-12-13 21:53:04 +01:00
|
|
|
}
|
|
|
|
else SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
|
2002-12-11 01:19:56 +01:00
|
|
|
return !status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* FileTimeToLocalFileTime (KERNEL32.@)
|
|
|
|
*/
|
2002-12-13 21:53:04 +01:00
|
|
|
BOOL WINAPI FileTimeToLocalFileTime( const FILETIME *utcft, LPFILETIME localft )
|
2002-12-11 01:19:56 +01:00
|
|
|
{
|
|
|
|
NTSTATUS status;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER local, utc;
|
|
|
|
|
2004-01-23 02:51:33 +01:00
|
|
|
utc.u.LowPart = utcft->dwLowDateTime;
|
|
|
|
utc.u.HighPart = utcft->dwHighDateTime;
|
2002-12-13 21:53:04 +01:00
|
|
|
if (!(status = RtlSystemTimeToLocalTime( &utc, &local )))
|
|
|
|
{
|
2004-01-23 02:51:33 +01:00
|
|
|
localft->dwLowDateTime = local.u.LowPart;
|
|
|
|
localft->dwHighDateTime = local.u.HighPart;
|
2002-12-13 21:53:04 +01:00
|
|
|
}
|
|
|
|
else SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
|
2002-12-11 01:19:56 +01:00
|
|
|
return !status;
|
|
|
|
}
|
2002-12-13 21:30:06 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* FileTimeToSystemTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI FileTimeToSystemTime( const FILETIME *ft, LPSYSTEMTIME syst )
|
|
|
|
{
|
|
|
|
TIME_FIELDS tf;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER t;
|
2002-12-13 21:30:06 +01:00
|
|
|
|
2004-01-23 02:51:33 +01:00
|
|
|
t.u.LowPart = ft->dwLowDateTime;
|
|
|
|
t.u.HighPart = ft->dwHighDateTime;
|
2002-12-13 21:53:04 +01:00
|
|
|
RtlTimeToTimeFields(&t, &tf);
|
2002-12-13 21:30:06 +01:00
|
|
|
|
|
|
|
syst->wYear = tf.Year;
|
|
|
|
syst->wMonth = tf.Month;
|
|
|
|
syst->wDay = tf.Day;
|
|
|
|
syst->wHour = tf.Hour;
|
|
|
|
syst->wMinute = tf.Minute;
|
|
|
|
syst->wSecond = tf.Second;
|
|
|
|
syst->wMilliseconds = tf.Milliseconds;
|
|
|
|
syst->wDayOfWeek = tf.Weekday;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* SystemTimeToFileTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
|
|
|
|
{
|
|
|
|
TIME_FIELDS tf;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER t;
|
2002-12-13 21:30:06 +01:00
|
|
|
|
|
|
|
tf.Year = syst->wYear;
|
|
|
|
tf.Month = syst->wMonth;
|
|
|
|
tf.Day = syst->wDay;
|
|
|
|
tf.Hour = syst->wHour;
|
|
|
|
tf.Minute = syst->wMinute;
|
|
|
|
tf.Second = syst->wSecond;
|
|
|
|
tf.Milliseconds = syst->wMilliseconds;
|
|
|
|
|
2004-11-06 04:53:53 +01:00
|
|
|
if( !RtlTimeFieldsToTime(&tf, &t)) {
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-01-23 02:51:33 +01:00
|
|
|
ft->dwLowDateTime = t.u.LowPart;
|
|
|
|
ft->dwHighDateTime = t.u.HighPart;
|
2002-12-13 21:30:06 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* CompareFileTime (KERNEL32.@)
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Compare two FILETIME's to each other.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* x [I] First time
|
|
|
|
* y [I] time to compare to x
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* -1, 0, or 1 indicating that x is less than, equal to, or greater
|
|
|
|
* than y respectively.
|
2002-12-13 21:30:06 +01:00
|
|
|
*/
|
2002-12-13 21:53:04 +01:00
|
|
|
INT WINAPI CompareFileTime( const FILETIME *x, const FILETIME *y )
|
2002-12-13 21:30:06 +01:00
|
|
|
{
|
|
|
|
if (!x || !y) return -1;
|
|
|
|
|
|
|
|
if (x->dwHighDateTime > y->dwHighDateTime)
|
|
|
|
return 1;
|
|
|
|
if (x->dwHighDateTime < y->dwHighDateTime)
|
|
|
|
return -1;
|
|
|
|
if (x->dwLowDateTime > y->dwLowDateTime)
|
|
|
|
return 1;
|
|
|
|
if (x->dwLowDateTime < y->dwLowDateTime)
|
|
|
|
return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* GetLocalTime (KERNEL32.@)
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Get the current local time.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* systime [O] Destination for current time.
|
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
2002-12-13 21:30:06 +01:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
|
2002-12-13 21:30:06 +01:00
|
|
|
{
|
|
|
|
FILETIME lft;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER ft, ft2;
|
2002-12-13 21:30:06 +01:00
|
|
|
|
|
|
|
NtQuerySystemTime(&ft);
|
2002-12-13 21:53:04 +01:00
|
|
|
RtlSystemTimeToLocalTime(&ft, &ft2);
|
2004-01-23 02:51:33 +01:00
|
|
|
lft.dwLowDateTime = ft2.u.LowPart;
|
|
|
|
lft.dwHighDateTime = ft2.u.HighPart;
|
2002-12-13 21:30:06 +01:00
|
|
|
FileTimeToSystemTime(&lft, systime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* GetSystemTime (KERNEL32.@)
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Get the current system time.
|
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* PARAMS
|
|
|
|
* systime [O] Destination for current time.
|
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
2002-12-13 21:30:06 +01:00
|
|
|
*/
|
2006-01-06 21:07:46 +01:00
|
|
|
VOID WINAPI GetSystemTime(LPSYSTEMTIME systime)
|
2002-12-13 21:30:06 +01:00
|
|
|
{
|
|
|
|
FILETIME ft;
|
2002-12-13 21:53:04 +01:00
|
|
|
LARGE_INTEGER t;
|
2002-12-13 21:30:06 +01:00
|
|
|
|
2002-12-13 21:53:04 +01:00
|
|
|
NtQuerySystemTime(&t);
|
2004-01-23 02:51:33 +01:00
|
|
|
ft.dwLowDateTime = t.u.LowPart;
|
|
|
|
ft.dwHighDateTime = t.u.HighPart;
|
2002-12-13 21:30:06 +01:00
|
|
|
FileTimeToSystemTime(&ft, systime);
|
|
|
|
}
|
2004-03-03 03:17:58 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* GetDaylightFlag (KERNEL32.@)
|
|
|
|
*
|
2008-03-17 21:51:39 +01:00
|
|
|
* Specifies if daylight savings time is in operation.
|
2006-01-06 21:07:46 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This function is called from the Win98's control applet timedate.cpl.
|
2004-03-03 03:17:58 +01:00
|
|
|
*
|
2006-01-06 21:07:46 +01:00
|
|
|
* RETURNS
|
2008-03-17 21:51:39 +01:00
|
|
|
* TRUE if daylight savings time is in operation.
|
2006-01-06 21:07:46 +01:00
|
|
|
* FALSE otherwise.
|
2004-03-03 03:17:58 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI GetDaylightFlag(void)
|
|
|
|
{
|
2004-10-27 23:19:22 +02:00
|
|
|
TIME_ZONE_INFORMATION tzinfo;
|
2018-12-17 16:31:45 +01:00
|
|
|
RtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
|
|
|
|
return (TIME_ZoneID(&tzinfo) == TIME_ZONE_ID_DAYLIGHT);
|
2004-03-03 03:17:58 +01:00
|
|
|
}
|
2004-04-28 05:53:19 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DosDateTimeToFileTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft)
|
|
|
|
{
|
|
|
|
struct tm newtm;
|
|
|
|
#ifndef HAVE_TIMEGM
|
|
|
|
struct tm *gtm;
|
|
|
|
time_t time1, time2;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
newtm.tm_sec = (fattime & 0x1f) * 2;
|
|
|
|
newtm.tm_min = (fattime >> 5) & 0x3f;
|
|
|
|
newtm.tm_hour = (fattime >> 11);
|
|
|
|
newtm.tm_mday = (fatdate & 0x1f);
|
|
|
|
newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1;
|
|
|
|
newtm.tm_year = (fatdate >> 9) + 80;
|
2007-03-08 21:06:41 +01:00
|
|
|
newtm.tm_isdst = -1;
|
2004-04-28 05:53:19 +02:00
|
|
|
#ifdef HAVE_TIMEGM
|
|
|
|
RtlSecondsSince1970ToTime( timegm(&newtm), (LARGE_INTEGER *)ft );
|
|
|
|
#else
|
|
|
|
time1 = mktime(&newtm);
|
|
|
|
gtm = gmtime(&time1);
|
|
|
|
time2 = mktime(gtm);
|
|
|
|
RtlSecondsSince1970ToTime( 2*time1-time2, (LARGE_INTEGER *)ft );
|
|
|
|
#endif
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* FileTimeToDosDateTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
|
|
|
|
LPWORD fattime )
|
|
|
|
{
|
|
|
|
LARGE_INTEGER li;
|
|
|
|
ULONG t;
|
|
|
|
time_t unixtime;
|
|
|
|
struct tm* tm;
|
|
|
|
|
2011-03-08 00:55:35 +01:00
|
|
|
if (!fatdate || !fattime)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-04-28 05:53:19 +02:00
|
|
|
li.u.LowPart = ft->dwLowDateTime;
|
|
|
|
li.u.HighPart = ft->dwHighDateTime;
|
2011-03-08 00:55:35 +01:00
|
|
|
if (!RtlTimeToSecondsSince1970( &li, &t ))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-04-28 05:53:19 +02:00
|
|
|
unixtime = t;
|
|
|
|
tm = gmtime( &unixtime );
|
2017-02-15 10:51:31 +01:00
|
|
|
*fattime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2);
|
|
|
|
*fatdate = ((tm->tm_year - 80) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday;
|
2004-04-28 05:53:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2009-03-26 23:00:55 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* GetSystemTimes (KERNEL32.@)
|
|
|
|
*
|
|
|
|
* Retrieves system timing information
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpIdleTime [O] Destination for idle time.
|
|
|
|
* lpKernelTime [O] Destination for kernel time.
|
|
|
|
* lpUserTime [O] Destination for user time.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if success, FALSE otherwise.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime)
|
|
|
|
{
|
2015-06-10 05:38:08 +02:00
|
|
|
LARGE_INTEGER idle_time, kernel_time, user_time;
|
|
|
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi;
|
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
NTSTATUS status;
|
|
|
|
ULONG ret_size;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", lpIdleTime, lpKernelTime, lpUserTime);
|
|
|
|
|
|
|
|
status = NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), &ret_size );
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-03-26 23:00:55 +01:00
|
|
|
|
2015-06-10 05:38:08 +02:00
|
|
|
sppi = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * sbi.NumberOfProcessors);
|
|
|
|
if (!sppi)
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_OUTOFMEMORY );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = NtQuerySystemInformation( SystemProcessorPerformanceInformation, sppi, sizeof(*sppi) * sbi.NumberOfProcessors,
|
|
|
|
&ret_size );
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, sppi );
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
idle_time.QuadPart = 0;
|
|
|
|
kernel_time.QuadPart = 0;
|
|
|
|
user_time.QuadPart = 0;
|
|
|
|
for (i = 0; i < sbi.NumberOfProcessors; i++)
|
|
|
|
{
|
|
|
|
idle_time.QuadPart += sppi[i].IdleTime.QuadPart;
|
|
|
|
kernel_time.QuadPart += sppi[i].KernelTime.QuadPart;
|
|
|
|
user_time.QuadPart += sppi[i].UserTime.QuadPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpIdleTime)
|
|
|
|
{
|
|
|
|
lpIdleTime->dwLowDateTime = idle_time.u.LowPart;
|
|
|
|
lpIdleTime->dwHighDateTime = idle_time.u.HighPart;
|
|
|
|
}
|
|
|
|
if (lpKernelTime)
|
|
|
|
{
|
|
|
|
lpKernelTime->dwLowDateTime = kernel_time.u.LowPart;
|
|
|
|
lpKernelTime->dwHighDateTime = kernel_time.u.HighPart;
|
|
|
|
}
|
|
|
|
if (lpUserTime)
|
|
|
|
{
|
|
|
|
lpUserTime->dwLowDateTime = user_time.u.LowPart;
|
|
|
|
lpUserTime->dwHighDateTime = user_time.u.HighPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, sppi );
|
|
|
|
return TRUE;
|
2009-03-26 23:00:55 +01:00
|
|
|
}
|
2012-07-05 15:26:48 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetDynamicTimeZoneInformation (KERNEL32.@)
|
|
|
|
*/
|
2015-05-08 16:34:10 +02:00
|
|
|
DWORD WINAPI GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo)
|
2012-07-05 15:26:48 +02:00
|
|
|
{
|
2015-05-08 16:34:10 +02:00
|
|
|
NTSTATUS status;
|
2018-12-06 16:33:26 +01:00
|
|
|
HANDLE time_zone_key;
|
2015-05-08 16:34:10 +02:00
|
|
|
|
|
|
|
status = RtlQueryDynamicTimeZoneInformation( (RTL_DYNAMIC_TIME_ZONE_INFORMATION*)tzinfo );
|
|
|
|
if ( status != STATUS_SUCCESS )
|
|
|
|
{
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
return TIME_ZONE_ID_INVALID;
|
|
|
|
}
|
2018-12-06 16:33:26 +01:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2015-05-08 16:34:10 +02:00
|
|
|
return TIME_ZoneID( (TIME_ZONE_INFORMATION*)tzinfo );
|
2012-07-05 15:26:48 +02:00
|
|
|
}
|
2014-04-02 14:43:50 +02:00
|
|
|
|
2018-08-07 16:28:38 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* GetDynamicTimeZoneInformationEffectiveYears (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetDynamicTimeZoneInformationEffectiveYears(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo, DWORD *first_year, DWORD *last_year)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p): stub!\n", tzinfo, first_year, last_year);
|
|
|
|
return ERROR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2018-01-30 23:29:44 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryProcessCycleTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI QueryProcessCycleTime(HANDLE process, PULONG64 cycle)
|
|
|
|
{
|
|
|
|
static int once;
|
|
|
|
if (!once++)
|
|
|
|
FIXME("(%p,%p): stub!\n", process, cycle);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-03-30 11:53:33 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryThreadCycleTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI QueryThreadCycleTime(HANDLE thread, PULONG64 cycle)
|
|
|
|
{
|
|
|
|
static int once;
|
|
|
|
if (!once++)
|
2015-08-17 15:11:55 +02:00
|
|
|
FIXME("(%p,%p): stub!\n", thread, cycle);
|
2015-03-30 11:53:33 +02:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-02 14:43:50 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* QueryUnbiasedInterruptTime (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI QueryUnbiasedInterruptTime(ULONGLONG *time)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", time);
|
|
|
|
if (!time) return FALSE;
|
|
|
|
RtlQueryUnbiasedInterruptTime(time);
|
|
|
|
return TRUE;
|
|
|
|
}
|