Patch will be sent upstream.
CORE-14658
WINAPI
GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
{
+ RTL_TIME_ZONE_INFORMATION TimeZoneInformation;
NTSTATUS Status;
DPRINT("GetTimeZoneInformation()\n");
Status = NtQuerySystemInformation(SystemCurrentTimeZoneInformation,
- lpTimeZoneInformation,
- sizeof(TIME_ZONE_INFORMATION),
+ &TimeZoneInformation,
+ sizeof(RTL_TIME_ZONE_INFORMATION),
NULL);
if (!NT_SUCCESS(Status))
{
return TIME_ZONE_ID_INVALID;
}
+ lpTimeZoneInformation->Bias = TimeZoneInformation.Bias;
+
+ wcsncpy(lpTimeZoneInformation->StandardName,
+ TimeZoneInformation.StandardName,
+ ARRAYSIZE(lpTimeZoneInformation->StandardName));
+ lpTimeZoneInformation->StandardDate.wYear = TimeZoneInformation.StandardDate.Year;
+ lpTimeZoneInformation->StandardDate.wMonth = TimeZoneInformation.StandardDate.Month;
+ lpTimeZoneInformation->StandardDate.wDay = TimeZoneInformation.StandardDate.Day;
+ lpTimeZoneInformation->StandardDate.wHour = TimeZoneInformation.StandardDate.Hour;
+ lpTimeZoneInformation->StandardDate.wMinute = TimeZoneInformation.StandardDate.Minute;
+ lpTimeZoneInformation->StandardDate.wSecond = TimeZoneInformation.StandardDate.Second;
+ lpTimeZoneInformation->StandardDate.wDayOfWeek = TimeZoneInformation.StandardDate.Weekday;
+ lpTimeZoneInformation->StandardBias = TimeZoneInformation.StandardBias;
+
+ wcsncpy(lpTimeZoneInformation->DaylightName,
+ TimeZoneInformation.DaylightName,
+ ARRAYSIZE(lpTimeZoneInformation->DaylightName));
+ lpTimeZoneInformation->DaylightDate.wYear = TimeZoneInformation.DaylightDate.Year;
+ lpTimeZoneInformation->DaylightDate.wMonth = TimeZoneInformation.DaylightDate.Month;
+ lpTimeZoneInformation->DaylightDate.wDay = TimeZoneInformation.DaylightDate.Day;
+ lpTimeZoneInformation->DaylightDate.wHour = TimeZoneInformation.DaylightDate.Hour;
+ lpTimeZoneInformation->DaylightDate.wMinute = TimeZoneInformation.DaylightDate.Minute;
+ lpTimeZoneInformation->DaylightDate.wSecond = TimeZoneInformation.DaylightDate.Second;
+ lpTimeZoneInformation->DaylightDate.wDayOfWeek = TimeZoneInformation.DaylightDate.Weekday;
+ lpTimeZoneInformation->DaylightBias = TimeZoneInformation.DaylightBias;
+
return TIME_ZoneID(lpTimeZoneInformation);
}
WINAPI
SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
{
+ RTL_TIME_ZONE_INFORMATION TimeZoneInformation;
NTSTATUS Status;
DPRINT("SetTimeZoneInformation()\n");
- Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation);
+ TimeZoneInformation.Bias = lpTimeZoneInformation->Bias;
+
+ wcsncpy(TimeZoneInformation.StandardName,
+ lpTimeZoneInformation->StandardName,
+ ARRAYSIZE(TimeZoneInformation.StandardName));
+ TimeZoneInformation.StandardDate.Year = lpTimeZoneInformation->StandardDate.wYear;
+ TimeZoneInformation.StandardDate.Month = lpTimeZoneInformation->StandardDate.wMonth;
+ TimeZoneInformation.StandardDate.Day = lpTimeZoneInformation->StandardDate.wDay;
+ TimeZoneInformation.StandardDate.Hour = lpTimeZoneInformation->StandardDate.wHour;
+ TimeZoneInformation.StandardDate.Minute = lpTimeZoneInformation->StandardDate.wMinute;
+ TimeZoneInformation.StandardDate.Second = lpTimeZoneInformation->StandardDate.wSecond;
+ TimeZoneInformation.StandardDate.Weekday = lpTimeZoneInformation->StandardDate.wDayOfWeek;
+ TimeZoneInformation.StandardBias = lpTimeZoneInformation->StandardBias;
+
+ wcsncpy(TimeZoneInformation.DaylightName,
+ lpTimeZoneInformation->DaylightName,
+ ARRAYSIZE(TimeZoneInformation.DaylightName));
+ TimeZoneInformation.DaylightDate.Year = lpTimeZoneInformation->DaylightDate.wYear;
+ TimeZoneInformation.DaylightDate.Month = lpTimeZoneInformation->DaylightDate.wMonth;
+ TimeZoneInformation.DaylightDate.Day = lpTimeZoneInformation->DaylightDate.wDay;
+ TimeZoneInformation.DaylightDate.Hour = lpTimeZoneInformation->DaylightDate.wHour;
+ TimeZoneInformation.DaylightDate.Minute = lpTimeZoneInformation->DaylightDate.wMinute;
+ TimeZoneInformation.DaylightDate.Second = lpTimeZoneInformation->DaylightDate.wSecond;
+ TimeZoneInformation.DaylightDate.Weekday = lpTimeZoneInformation->DaylightDate.wDayOfWeek;
+ TimeZoneInformation.DaylightBias = lpTimeZoneInformation->DaylightBias;
+
+ Status = RtlSetTimeZoneInformation(&TimeZoneInformation);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status);
}
Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation,
- (PVOID)lpTimeZoneInformation,
- sizeof(TIME_ZONE_INFORMATION));
+ (PVOID)&TimeZoneInformation,
+ sizeof(RTL_TIME_ZONE_INFORMATION));
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetSystemInformation() failed (Status %lx)\n", Status);
/* Class 44 - Current Time Zone Information */
QSI_DEF(SystemCurrentTimeZoneInformation)
{
- *ReqSize = sizeof(TIME_ZONE_INFORMATION);
+ *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
- if (sizeof(TIME_ZONE_INFORMATION) != Size)
+ if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
{
return STATUS_INFO_LENGTH_MISMATCH;
}
/* Copy the time zone information struct */
memcpy(Buffer,
&ExpTimeZoneInfo,
- sizeof(TIME_ZONE_INFORMATION));
+ sizeof(RTL_TIME_ZONE_INFORMATION));
return STATUS_SUCCESS;
}
SSI_DEF(SystemCurrentTimeZoneInformation)
{
/* Check user buffer's size */
- if (Size < sizeof(TIME_ZONE_INFORMATION))
+ if (Size < sizeof(RTL_TIME_ZONE_INFORMATION))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
- return ExpSetTimeZoneInformation((PTIME_ZONE_INFORMATION)Buffer);
+ return ExpSetTimeZoneInformation((PRTL_TIME_ZONE_INFORMATION)Buffer);
}
static
/* GLOBALS ******************************************************************/
/* Note: Bias[minutes] = UTC - local time */
-TIME_ZONE_INFORMATION ExpTimeZoneInfo;
+RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
ULONG ExpLastTimeZoneBias = -1;
LARGE_INTEGER ExpTimeZoneBias;
ULONG ExpAltTimeZoneBias;
if (!NT_SUCCESS(Status))
{
/* Failed, clear all data */
- RtlZeroMemory(&ExpTimeZoneInfo, sizeof(TIME_ZONE_INFORMATION));
+ RtlZeroMemory(&ExpTimeZoneInfo, sizeof(RTL_TIME_ZONE_INFORMATION));
ExpTimeZoneBias.QuadPart = (LONGLONG)0;
ExpTimeZoneId = TIME_ZONE_ID_UNKNOWN;
}
}
NTSTATUS
-ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation)
+ExpSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
{
LARGE_INTEGER LocalTime, SystemTime, OldTime;
TIME_FIELDS TimeFields;
/* Copy the timezone information */
RtlCopyMemory(&ExpTimeZoneInfo,
TimeZoneInformation,
- sizeof(TIME_ZONE_INFORMATION));
+ sizeof(RTL_TIME_ZONE_INFORMATION));
/* Set the new time zone information */
SharedUserData->TimeZoneBias.High1Time = ExpTimeZoneBias.u.HighPart;
/* GLOBAL VARIABLES *********************************************************/
-extern TIME_ZONE_INFORMATION ExpTimeZoneInfo;
+extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
extern LARGE_INTEGER ExpTimeZoneBias;
extern ULONG ExpTimeZoneId;
extern ULONG ExpTickCountMultiplier;
NTSTATUS
ExpSetTimeZoneInformation(
- IN PTIME_ZONE_INFORMATION TimeZoneInformation
+ IN PRTL_TIME_ZONE_INFORMATION TimeZoneInformation
);
BOOLEAN
PRTL_ATOM_TABLE_ENTRY Buckets[1];
} RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
-#ifndef _WINBASE_
//
-// System Time and Timezone Structures
+// Timezone Information
//
-typedef struct _SYSTEMTIME
-{
- USHORT wYear;
- USHORT wMonth;
- USHORT wDayOfWeek;
- USHORT wDay;
- USHORT wHour;
- USHORT wMinute;
- USHORT wSecond;
- USHORT wMilliseconds;
-} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
-
-typedef struct _TIME_ZONE_INFORMATION
+typedef struct _RTL_TIME_ZONE_INFORMATION
{
LONG Bias;
WCHAR StandardName[32];
- SYSTEMTIME StandardDate;
+ TIME_FIELDS StandardDate;
LONG StandardBias;
WCHAR DaylightName[32];
- SYSTEMTIME DaylightDate;
+ TIME_FIELDS DaylightDate;
LONG DaylightBias;
-} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
-#endif /* !_WINBASE_ */
-
-//
-// Native version of Timezone Structure
-//
-typedef LPTIME_ZONE_INFORMATION PRTL_TIME_ZONE_INFORMATION;
+} RTL_TIME_ZONE_INFORMATION, *PRTL_TIME_ZONE_INFORMATION;
//
// Hotpatch Header
} FILETIME, *PFILETIME, *LPFILETIME;
#endif /* _FILETIME_ */
+#if 0
/*
* RTL_SYSTEM_TIME and RTL_TIME_ZONE_INFORMATION are the same as
* the SYSTEMTIME and TIME_ZONE_INFORMATION structures defined
WORD wSecond;
WORD wMilliseconds;
} RTL_SYSTEM_TIME, *PRTL_SYSTEM_TIME;
+#endif
+
+typedef struct _TIME_FIELDS {
+ CSHORT Year;
+ CSHORT Month;
+ CSHORT Day;
+ CSHORT Hour;
+ CSHORT Minute;
+ CSHORT Second;
+ CSHORT Milliseconds;
+ CSHORT Weekday;
+} TIME_FIELDS, *PTIME_FIELDS;
typedef struct _RTL_TIME_ZONE_INFORMATION {
LONG Bias;
WCHAR StandardName[32];
- RTL_SYSTEM_TIME StandardDate;
+ TIME_FIELDS StandardDate;
LONG StandardBias;
WCHAR DaylightName[32];
- RTL_SYSTEM_TIME DaylightDate;
+ TIME_FIELDS DaylightDate;
LONG DaylightBias;
} RTL_TIME_ZONE_INFORMATION, *PRTL_TIME_ZONE_INFORMATION;
{
LONG Bias;
WCHAR StandardName[32];
- RTL_SYSTEM_TIME StandardDate;
+ TIME_FIELDS StandardDate;
LONG StandardBias;
WCHAR DaylightName[32];
- RTL_SYSTEM_TIME DaylightDate;
+ TIME_FIELDS DaylightDate;
LONG DaylightBias;
WCHAR TimeZoneKeyName[128];
BOOLEAN DynamicDaylightTimeDisabled;
BOOLEAN TimeAdjustmentDisabled;
} SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
-typedef struct _TIME_FIELDS
-{ CSHORT Year;
- CSHORT Month;
- CSHORT Day;
- CSHORT Hour;
- CSHORT Minute;
- CSHORT Second;
- CSHORT Milliseconds;
- CSHORT Weekday;
-} TIME_FIELDS, *PTIME_FIELDS;
-
typedef struct _WINSTATIONINFORMATIONW {
BYTE Reserved2[70];
ULONG LogonId;
#include <win32k.h>
-#include <winnls.h>
+// Was included only because of CP_ACP and required the
+// definition of SYSTEMTIME in ndk\rtltypes.h
+//#include <winnls.h>
+#define CP_ACP 0
DBG_DEFAULT_CHANNEL(UserKbdLayout);