Sync with trunk r58740.
[reactos.git] / drivers / sac / driver / channel.c
1 /*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/sac/driver/channel.c
5 * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include "sacdrv.h"
12
13 /* GLOBALS ********************************************************************/
14
15 /* FUNCTIONS ******************************************************************/
16
17 BOOLEAN
18 ChannelIsValidType(
19 IN SAC_CHANNEL_TYPE ChannelType
20 )
21 {
22 return ((ChannelType >= VtUtf8) && (ChannelType <= Raw));
23 }
24
25 BOOLEAN
26 ChannelIsEqual(
27 IN PSAC_CHANNEL Channel,
28 IN PSAC_CHANNEL_ID ChannelId
29 )
30 {
31 return IsEqualGUIDAligned(
32 &Channel->ChannelId.ChannelGuid,
33 &ChannelId->ChannelGuid);
34 }
35
36 NTSTATUS
37 ChannelInitializeVTable(
38 IN PSAC_CHANNEL Channel
39 )
40 {
41 return STATUS_NOT_IMPLEMENTED;
42 }
43
44 NTSTATUS
45 ChannelDereferenceHandles(
46 IN PSAC_CHANNEL Channel
47 )
48 {
49 return STATUS_NOT_IMPLEMENTED;
50 }
51
52 NTSTATUS
53 ChannelDestroy(
54 IN PSAC_CHANNEL Channel
55 )
56 {
57 CHECK_PARAMETER(Channel);
58
59 return ChannelDereferenceHandles(Channel);
60 }
61
62 NTSTATUS
63 ChannelOWrite(
64 IN PSAC_CHANNEL Channel,
65 IN PWCHAR Buffer,
66 IN ULONG BufferSize
67 )
68 {
69 NTSTATUS Status;
70
71 CHECK_PARAMETER3(BufferSize < SAC_OBUFFER_SIZE);
72
73 ChannelLockOBuffer(Channel);
74
75 Status = Channel->OBufferWrite(Channel, Buffer, BufferSize);
76
77 ChannelUnlockOBuffer(Channel);
78
79 return Status;
80 }
81
82 NTSTATUS
83 ChannelOFlush(
84 IN PSAC_CHANNEL Channel
85 )
86 {
87 NTSTATUS Status;
88
89 ChannelLockOBuffer(Channel);
90
91 Status = Channel->OBufferFlush(Channel);
92
93 ChannelUnlockOBuffer(Channel);
94
95 return Status;
96 }
97
98 NTSTATUS
99 ChannelIWrite(
100 IN PSAC_CHANNEL Channel,
101 IN PWCHAR Buffer,
102 IN ULONG BufferSize
103 )
104 {
105 NTSTATUS Status;
106
107 ChannelLockIBuffer(Channel);
108
109 Status = Channel->IBufferWrite(Channel, Buffer, BufferSize);
110
111 ChannelUnlockIBuffer(Channel);
112
113 return Status;
114 }
115
116 ULONG
117 ChannelIRead(
118 IN PSAC_CHANNEL Channel,
119 PWCHAR Buffer,
120 ULONG BufferSize,
121 OUT PULONG ResultBufferSize
122 )
123 {
124 NTSTATUS Status;
125
126 ChannelLockIBuffer(Channel);
127
128 Status = Channel->IBufferRead(Channel, Buffer, BufferSize, ResultBufferSize);
129
130 ChannelUnlockIBuffer(Channel);
131
132 return Status;
133 }
134
135 NTSTATUS
136 ChannelIReadLast(
137 IN PSAC_CHANNEL Channel
138 )
139 {
140 NTSTATUS Status;
141
142 ChannelLockIBuffer(Channel);
143
144 Status = Channel->IBufferReadLast(Channel);
145
146 ChannelUnlockIBuffer(Channel);
147
148 return Status;
149 }
150
151 ULONG
152 ChannelIBufferLength(
153 IN PSAC_CHANNEL Channel
154 )
155 {
156 NTSTATUS Length;
157
158 ChannelLockOBuffer(Channel);
159
160 Length = Channel->IBufferLength(Channel);
161
162 ChannelUnlockOBuffer(Channel);
163
164 return Length;
165 }
166
167 NTSTATUS
168 ChannelGetName(
169 IN PSAC_CHANNEL Channel,
170 OUT PWCHAR *Name
171 )
172 {
173 return STATUS_NOT_IMPLEMENTED;
174 }
175
176 NTSTATUS
177 ChannelSetName(
178 IN PSAC_CHANNEL Channel,
179 IN PWCHAR Name
180 )
181 {
182 return STATUS_NOT_IMPLEMENTED;
183 }
184
185 NTSTATUS
186 ChannelGetDescription(
187 IN PSAC_CHANNEL Channel,
188 OUT PWCHAR *Description
189 )
190 {
191 return STATUS_NOT_IMPLEMENTED;
192 }
193
194 NTSTATUS
195 ChannelSetDescription(
196 IN PSAC_CHANNEL Channel,
197 IN PWCHAR Description
198 )
199 {
200 return STATUS_NOT_IMPLEMENTED;
201 }
202
203 NTSTATUS
204 ChannelSetStatus(
205 IN PSAC_CHANNEL Channel,
206 IN SAC_CHANNEL_STATUS ChannelStatus
207 )
208 {
209 return STATUS_NOT_IMPLEMENTED;
210 }
211
212 NTSTATUS
213 ChannelGetStatus(
214 IN PSAC_CHANNEL Channel,
215 OUT PSAC_CHANNEL_STATUS ChannelStatus
216 )
217 {
218 return STATUS_NOT_IMPLEMENTED;
219 }
220
221 NTSTATUS
222 ChannelGetApplicationType(
223 IN PSAC_CHANNEL Channel,
224 OUT PGUID ApplicationType
225 )
226 {
227 return STATUS_NOT_IMPLEMENTED;
228 }
229
230 NTSTATUS
231 NTAPI
232 ChannelSetLockEvent(
233 IN PSAC_CHANNEL Channel
234 )
235 {
236 NTSTATUS Status;
237
238 ChannelSetEvent(Channel, LockEvent);
239
240 return Status;
241 }
242
243 NTSTATUS
244 NTAPI
245 ChannelSetRedrawEvent(
246 IN PSAC_CHANNEL Channel
247 )
248 {
249 NTSTATUS Status;
250
251 ChannelSetEvent(Channel, RedrawEvent);
252
253 return Status;
254 }
255
256 NTSTATUS
257 ChannelClearRedrawEvent(
258 IN PSAC_CHANNEL Channel
259 )
260 {
261 NTSTATUS Status;
262
263 ChannelClearEvent(Channel, RedrawEvent);
264
265 return Status;
266 }
267
268 NTSTATUS
269 ChannelHasRedrawEvent(
270 IN PSAC_CHANNEL Channel,
271 OUT PBOOLEAN Present
272 )
273 {
274 CHECK_PARAMETER1(Channel);
275 CHECK_PARAMETER2(Present);
276
277 *Present = Channel->Flags & SAC_CHANNEL_FLAG_REDRAW_EVENT;
278
279 return STATUS_SUCCESS;
280 }
281
282 BOOLEAN
283 ChannelIsActive(
284 IN PSAC_CHANNEL Channel
285 )
286 {
287 SAC_CHANNEL_STATUS ChannelStatus;
288
289 if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus))) return FALSE;
290
291 return (ChannelStatus == Active);
292 }
293
294 BOOLEAN
295 ChannelIsClosed(
296 IN PSAC_CHANNEL Channel
297 )
298 {
299 return FALSE;
300 }
301
302 NTSTATUS
303 ChannelCreate(
304 IN PSAC_CHANNEL Channel,
305 IN PSAC_CHANNEL_ATTRIBUTES Attributes,
306 IN SAC_CHANNEL_ID ChannelId
307 )
308 {
309 return STATUS_NOT_IMPLEMENTED;
310 }
311
312 NTSTATUS
313 ChannelClose(
314 IN PSAC_CHANNEL Channel
315 )
316 {
317 return STATUS_NOT_IMPLEMENTED;
318 }