ReactOS  0.4.14-dev-376-gaedba84
timezone.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * PURPOSE: Timezone functions
5  * FILE: lib/rtl/timezone.c
6  * PROGRAMER: Eric Kohl
7  */
8 
9 /* INCLUDES *****************************************************************/
10 
11 #include <rtl.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FUNCTIONS ***************************************************************/
17 
18 /*
19  * @implemented
20  */
22 NTAPI
24 {
26  UNICODE_STRING StandardName;
27  UNICODE_STRING DaylightName;
29 
30  DPRINT("RtlQueryTimeZoneInformation()\n");
31 
33 
35  sizeof(QueryTable));
36 
37  StandardName.Length = 0;
38  StandardName.MaximumLength = 32 * sizeof(WCHAR);
39  StandardName.Buffer = TimeZoneInformation->StandardName;
40 
41  DaylightName.Length = 0;
42  DaylightName.MaximumLength = 32 * sizeof(WCHAR);
43  DaylightName.Buffer = TimeZoneInformation->DaylightName;
44 
45  QueryTable[0].Name = L"Bias";
47  QueryTable[0].EntryContext = &TimeZoneInformation->Bias;
48 
49  QueryTable[1].Name = L"StandardName";
51  QueryTable[1].EntryContext = &StandardName;
52 
53  QueryTable[2].Name = L"StandardBias";
55  QueryTable[2].EntryContext = &TimeZoneInformation->StandardBias;
56 
57  QueryTable[3].Name = L"StandardStart";
59  QueryTable[3].EntryContext = &TimeZoneInformation->StandardDate;
60 
61  QueryTable[4].Name = L"DaylightName";
63  QueryTable[4].EntryContext = &DaylightName;
64 
65  QueryTable[5].Name = L"DaylightBias";
67  QueryTable[5].EntryContext = &TimeZoneInformation->DaylightBias;
68 
69  QueryTable[6].Name = L"DaylightStart";
71  QueryTable[6].EntryContext = &TimeZoneInformation->DaylightDate;
72 
74  L"TimeZoneInformation",
75  QueryTable,
76  NULL,
77  NULL);
78 
79  return Status;
80 }
81 
82 
83 /*
84  * @implemented
85  */
87 NTAPI
89 {
90  SIZE_T Length;
92 
93  DPRINT("RtlSetTimeZoneInformation()\n");
94 
96 
98  L"TimeZoneInformation",
99  L"Bias",
100  REG_DWORD,
101  &TimeZoneInformation->Bias,
102  sizeof(LONG));
103  if (!NT_SUCCESS(Status))
104  {
105  return Status;
106  }
107 
108  Length = (wcslen(TimeZoneInformation->StandardName) + 1) * sizeof(WCHAR);
110  L"TimeZoneInformation",
111  L"StandardName",
112  REG_SZ,
113  TimeZoneInformation->StandardName,
114  (ULONG)Length);
115  if (!NT_SUCCESS(Status))
116  {
117  return Status;
118  }
119 
121  L"TimeZoneInformation",
122  L"StandardBias",
123  REG_DWORD,
124  &TimeZoneInformation->StandardBias,
125  sizeof(LONG));
126  if (!NT_SUCCESS(Status))
127  {
128  return Status;
129  }
130 
132  L"TimeZoneInformation",
133  L"StandardStart",
134  REG_BINARY,
135  &TimeZoneInformation->StandardDate,
136  sizeof(SYSTEMTIME));
137  if (!NT_SUCCESS(Status))
138  {
139  return Status;
140  }
141 
142  Length = (wcslen(TimeZoneInformation->DaylightName) + 1) * sizeof(WCHAR);
144  L"TimeZoneInformation",
145  L"DaylightName",
146  REG_SZ,
147  TimeZoneInformation->DaylightName,
148  (ULONG)Length);
149  if (!NT_SUCCESS(Status))
150  {
151  return Status;
152  }
153 
155  L"TimeZoneInformation",
156  L"DaylightBias",
157  REG_DWORD,
158  &TimeZoneInformation->DaylightBias,
159  sizeof(LONG));
160  if (!NT_SUCCESS(Status))
161  {
162  return Status;
163  }
164 
166  L"TimeZoneInformation",
167  L"DaylightStart",
168  REG_BINARY,
169  &TimeZoneInformation->DaylightDate,
170  sizeof(SYSTEMTIME));
171 
172  return Status;
173 }
174 
175 /* EOF */
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4004
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define REG_BINARY
Definition: nt_native.h:1496
NTSTATUS NTAPI RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
Definition: timezone.c:23
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
#define RTL_REGISTRY_CONTROL
Definition: nt_native.h:163
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
Definition: timezone.c:88
#define REG_DWORD
Definition: sdbapi.c:596
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define REG_SZ
Definition: layer.c:22