mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 08:30:21 +00:00
[NDK] Replace the SYSTEMTIME fields StandardDate and DaylightDate in RTL_TIME_ZONE_INFORMATION by TIME_FIELDs and fix resulting errors
Patch will be sent upstream. CORE-14658
This commit is contained in:
parent
ac45758aff
commit
4911382913
7 changed files with 96 additions and 56 deletions
|
@ -261,13 +261,14 @@ DWORD
|
|||
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))
|
||||
{
|
||||
|
@ -275,6 +276,32 @@ GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -286,11 +313,38 @@ BOOL
|
|||
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);
|
||||
|
@ -299,8 +353,8 @@ SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -1939,9 +1939,9 @@ QSI_DEF(SystemLegacyDriverInformation)
|
|||
/* 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;
|
||||
}
|
||||
|
@ -1949,7 +1949,7 @@ QSI_DEF(SystemCurrentTimeZoneInformation)
|
|||
/* Copy the time zone information struct */
|
||||
memcpy(Buffer,
|
||||
&ExpTimeZoneInfo,
|
||||
sizeof(TIME_ZONE_INFORMATION));
|
||||
sizeof(RTL_TIME_ZONE_INFORMATION));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1958,12 +1958,12 @@ QSI_DEF(SystemCurrentTimeZoneInformation)
|
|||
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
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/* GLOBALS ******************************************************************/
|
||||
|
||||
/* Note: Bias[minutes] = UTC - local time */
|
||||
TIME_ZONE_INFORMATION ExpTimeZoneInfo;
|
||||
RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
|
||||
ULONG ExpLastTimeZoneBias = -1;
|
||||
LARGE_INTEGER ExpTimeZoneBias;
|
||||
ULONG ExpAltTimeZoneBias;
|
||||
|
@ -233,7 +233,7 @@ ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
|
|||
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;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation)
|
||||
ExpSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
|
||||
{
|
||||
LARGE_INTEGER LocalTime, SystemTime, OldTime;
|
||||
TIME_FIELDS TimeFields;
|
||||
|
@ -303,7 +303,7 @@ ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation)
|
|||
/* 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;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/* GLOBAL VARIABLES *********************************************************/
|
||||
|
||||
extern TIME_ZONE_INFORMATION ExpTimeZoneInfo;
|
||||
extern RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo;
|
||||
extern LARGE_INTEGER ExpTimeZoneBias;
|
||||
extern ULONG ExpTimeZoneId;
|
||||
extern ULONG ExpTickCountMultiplier;
|
||||
|
@ -1417,7 +1417,7 @@ ExTryToAcquireResourceExclusiveLite(
|
|||
|
||||
NTSTATUS
|
||||
ExpSetTimeZoneInformation(
|
||||
IN PTIME_ZONE_INFORMATION TimeZoneInformation
|
||||
IN PRTL_TIME_ZONE_INFORMATION TimeZoneInformation
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -1662,38 +1662,19 @@ typedef struct _RTL_ATOM_TABLE
|
|||
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
|
||||
|
|
|
@ -102,6 +102,7 @@ typedef struct _FILETIME
|
|||
} 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
|
||||
|
@ -120,14 +121,26 @@ typedef struct _RTL_SYSTEM_TIME {
|
|||
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;
|
||||
|
||||
|
@ -135,10 +148,10 @@ typedef struct _RTL_TIME_DYNAMIC_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;
|
||||
|
@ -1647,17 +1660,6 @@ typedef struct _SYSTEM_TIME_ADJUSTMENT {
|
|||
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;
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
|
||||
#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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue