From 78911f34d9c137cac2971ee51b58e0068d8dc85c Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 20 Jun 2005 18:37:17 +0000 Subject: [PATCH] - avoid winternl.h depending on winbase.h - define RTL versions of TIME_ZONE_INFORMATION and SYSTEMTIME --- dlls/kernel/time.c | 9 +++++++-- dlls/ntdll/time.c | 9 ++++----- include/winternl.h | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/dlls/kernel/time.c b/dlls/kernel/time.c index 5e2b3b668cc..5f3a275956a 100644 --- a/dlls/kernel/time.c +++ b/dlls/kernel/time.c @@ -42,6 +42,7 @@ #include "windef.h" #include "winbase.h" #include "winternl.h" +#include "ntstatus.h" #include "kernel_private.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -371,7 +372,10 @@ DWORD WINAPI GetTimeZoneInformation( LPTIME_ZONE_INFORMATION tzinfo) /* [out] Destination for time zone information */ { NTSTATUS status; - if ((status = RtlQueryTimeZoneInformation(tzinfo))) { + + status = RtlQueryTimeZoneInformation( (RTL_TIME_ZONE_INFORMATION*)tzinfo ); + if ( status != STATUS_SUCCESS ) + { SetLastError( RtlNtStatusToDosError(status) ); return TIME_ZONE_ID_INVALID; } @@ -391,7 +395,8 @@ BOOL WINAPI SetTimeZoneInformation( const TIME_ZONE_INFORMATION *tzinfo) /* [in] The new time zone. */ { NTSTATUS status; - if ((status = RtlSetTimeZoneInformation(tzinfo))) + status = RtlSetTimeZoneInformation( (RTL_TIME_ZONE_INFORMATION*) tzinfo ); + if ( status != STATUS_SUCCESS ) SetLastError( RtlNtStatusToDosError(status) ); return !status; } diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index d60231ef286..9cbb9ce87f5 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -40,7 +40,6 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT #include "windef.h" -#include "winbase.h" #include "winternl.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -842,7 +841,7 @@ static const WCHAR* TIME_GetTZAsStr (time_t utc, int bias, int dst) /*** TIME_GetTimeZoneInfoFromReg: helper for GetTimeZoneInformation ***/ -static int TIME_GetTimeZoneInfoFromReg(LPTIME_ZONE_INFORMATION tzinfo) +static int TIME_GetTimeZoneInfoFromReg(RTL_TIME_ZONE_INFORMATION *tzinfo) { BYTE buf[90]; KEY_VALUE_PARTIAL_INFORMATION * KpInfo = @@ -909,13 +908,13 @@ static int TIME_GetTimeZoneInfoFromReg(LPTIME_ZONE_INFORMATION tzinfo) * Success: STATUS_SUCCESS. * Failure: An NTSTATUS error code indicating the problem. */ -NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo) +NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION *tzinfo) { time_t gmt; int bias, daylight; const WCHAR *psTZ; - memset(tzinfo, 0, sizeof(TIME_ZONE_INFORMATION)); + memset(tzinfo, 0, sizeof(RTL_TIME_ZONE_INFORMATION)); if( !TIME_GetTimeZoneInfoFromReg(tzinfo)) { @@ -948,7 +947,7 @@ NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo) * BUGS * Uses the obsolete unix timezone structure and tz_dsttime member. */ -NTSTATUS WINAPI RtlSetTimeZoneInformation( const TIME_ZONE_INFORMATION *tzinfo ) +NTSTATUS WINAPI RtlSetTimeZoneInformation( const RTL_TIME_ZONE_INFORMATION *tzinfo ) { #ifdef HAVE_SETTIMEOFDAY struct timezone tz; diff --git a/include/winternl.h b/include/winternl.h index 345b7aa4cc4..e64dbf0dcac 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -76,6 +76,35 @@ typedef struct _FILETIME } FILETIME, *PFILETIME, *LPFILETIME; #endif /* _FILETIME_ */ +/* + * RTL_SYSTEM_TIME and RTL_TIME_ZONE_INFORMATION are the same as + * the SYSTEMTIME and TIME_ZONE_INFORMATION structures defined + * in winbase.h, however we need to define them seperately so + * winternl.h doesn't depend on winbase.h. They are used by + * RtlQueryTimeZoneInformation and RtlSetTimeZoneInformation. + * The names are guessed; if anybody knows the real names, let me know. + */ +typedef struct _RTL_SYSTEM_TIME { + WORD wYear; + WORD wMonth; + WORD wDayOfWeek; + WORD wDay; + WORD wHour; + WORD wMinute; + WORD wSecond; + WORD wMilliseconds; +} RTL_SYSTEM_TIME, *PRTL_SYSTEM_TIME; + +typedef struct _RTL_TIME_ZONE_INFORMATION { + LONG Bias; + WCHAR StandardName[32]; + RTL_SYSTEM_TIME StandardDate; + LONG StandardBias; + WCHAR DaylightName[32]; + RTL_SYSTEM_TIME DaylightDate; + LONG DaylightBias; +} RTL_TIME_ZONE_INFORMATION, *PRTL_TIME_ZONE_INFORMATION; + typedef struct _CLIENT_ID { HANDLE UniqueProcess; @@ -1953,7 +1982,7 @@ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_ST NTSTATUS WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS); NTSTATUS WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER); NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID); -NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION); +NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*); void WINAPI RtlRaiseException(PEXCEPTION_RECORD); void WINAPI RtlRaiseStatus(NTSTATUS); ULONG WINAPI RtlRandom(PULONG); @@ -1979,7 +2008,7 @@ NTSTATUS WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN void WINAPI RtlSetLastWin32Error(DWORD); void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS); NTSTATUS WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN); -NTSTATUS WINAPI RtlSetTimeZoneInformation(const TIME_ZONE_INFORMATION*); +NTSTATUS WINAPI RtlSetTimeZoneInformation(const RTL_TIME_ZONE_INFORMATION*); ULONG WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID); LPDWORD WINAPI RtlSubAuthoritySid(PSID,DWORD); LPBYTE WINAPI RtlSubAuthorityCountSid(PSID);