422138e32db9bb9b69435d8b8b973d423b3f4772
[reactos.git] / base / services / wkssvc / rpcserver.c
1 /*
2 * ReactOS Services
3 * Copyright (C) 2015 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS Services
22 * FILE: base/services/wkssvc/rpcserver.c
23 * PURPOSE: Workstation service
24 * PROGRAMMER: Eric Kohl
25 */
26
27 /* INCLUDES *****************************************************************/
28
29 #include "precomp.h"
30
31 #include "lmerr.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(wkssvc);
34
35 /* FUNCTIONS *****************************************************************/
36
37 DWORD
38 WINAPI
39 RpcThreadRoutine(
40 LPVOID lpParameter)
41 {
42 RPC_STATUS Status;
43
44 Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\wkssvc", NULL);
45 if (Status != RPC_S_OK)
46 {
47 ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
48 return 0;
49 }
50
51 Status = RpcServerRegisterIf(wkssvc_v1_0_s_ifspec, NULL, NULL);
52 if (Status != RPC_S_OK)
53 {
54 ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status);
55 return 0;
56 }
57
58 Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, FALSE);
59 if (Status != RPC_S_OK)
60 {
61 ERR("RpcServerListen() failed (Status %lx)\n", Status);
62 }
63
64 return 0;
65 }
66
67
68 void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len)
69 {
70 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
71 }
72
73
74 void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
75 {
76 HeapFree(GetProcessHeap(), 0, ptr);
77 }
78
79
80 /* Function 0 */
81 unsigned long
82 __stdcall
83 NetrWkstaGetInfo(
84 WKSSVC_IDENTIFY_HANDLE ServerName,
85 unsigned long Level,
86 LPWKSTA_INFO WkstaInfo)
87 {
88 TRACE("NetrWkstaGetInfo level %lu\n", Level);
89
90 return 0;
91 }
92
93
94 /* Function 1 */
95 unsigned long
96 __stdcall
97 NetrWkstaSetInfo(
98 WKSSVC_IDENTIFY_HANDLE ServerName,
99 unsigned long Level,
100 LPWKSTA_INFO WkstaInfo,
101 unsigned long *ErrorParameter)
102 {
103 UNIMPLEMENTED;
104 return 0;
105 }
106
107
108 /* Function 2 */
109 unsigned long
110 __stdcall
111 NetrWkstaUserEnum(
112 WKSSVC_IDENTIFY_HANDLE ServerName,
113 LPWKSTA_USER_ENUM_STRUCT UserInfo,
114 unsigned long PreferredMaximumLength,
115 unsigned long *TotalEntries,
116 unsigned long *ResumeHandle)
117 {
118 UNIMPLEMENTED;
119 return 0;
120 }
121
122
123 /* Function 3 */
124 unsigned long
125 __stdcall
126 NetrWkstaUserGetInfo(
127 WKSSVC_IDENTIFY_HANDLE Unused,
128 unsigned long Level,
129 LPWKSTA_USER_INFO UserInfo)
130 {
131 FIXME("(%s, %d, %p)\n", debugstr_w(Unused), Level, UserInfo);
132
133 UNIMPLEMENTED;
134 return 0;
135 }
136
137
138 /* Function 4 */
139 unsigned long
140 __stdcall
141 NetrWkstaUserSetInfo (
142 WKSSVC_IDENTIFY_HANDLE Unused,
143 unsigned long Level,
144 LPWKSTA_USER_INFO UserInfo,
145 unsigned long *ErrorParameter)
146 {
147 UNIMPLEMENTED;
148 return 0;
149 }
150
151
152 /* Function 5 */
153 unsigned long
154 __stdcall
155 NetrWkstaTransportEnum(
156 WKSSVC_IDENTIFY_HANDLE ServerName,
157 LPWKSTA_TRANSPORT_ENUM_STRUCT TransportInfo,
158 unsigned long PreferredMaximumLength,
159 unsigned long* TotalEntries,
160 unsigned long *ResumeHandle)
161 {
162 UNIMPLEMENTED;
163 return 0;
164 }
165
166
167 /* Function 6 */
168 unsigned long
169 __stdcall
170 NetrWkstaTransportAdd(
171 WKSSVC_IDENTIFY_HANDLE ServerName,
172 unsigned long Level,
173 LPWKSTA_TRANSPORT_INFO_0 TransportInfo,
174 unsigned long *ErrorParameter)
175 {
176 UNIMPLEMENTED;
177 return 0;
178 }
179
180
181 /* Function 7 */
182 unsigned long
183 __stdcall
184 NetrWkstaTransportDel(
185 WKSSVC_IDENTIFY_HANDLE ServerName,
186 wchar_t *TransportName,
187 unsigned long ForceLevel)
188 {
189 UNIMPLEMENTED;
190 return 0;
191 }
192
193
194 /* Function 8 */
195 unsigned long
196 __stdcall
197 NetrUseAdd(
198 WKSSVC_IMPERSONATE_HANDLE ServerName,
199 unsigned long Level,
200 LPUSE_INFO InfoStruct,
201 unsigned long *ErrorParameter)
202 {
203 UNIMPLEMENTED;
204 return 0;
205 }
206
207
208 /* Function 9 */
209 unsigned long
210 __stdcall
211 NetrUseGetInfo(
212 WKSSVC_IMPERSONATE_HANDLE ServerName,
213 wchar_t *UseName,
214 unsigned long Level,
215 LPUSE_INFO InfoStruct)
216 {
217 UNIMPLEMENTED;
218 return 0;
219 }
220
221
222 /* Function 10 */
223 unsigned long
224 __stdcall
225 NetrUseDel(
226 WKSSVC_IMPERSONATE_HANDLE ServerName,
227 wchar_t *UseName,
228 unsigned long ForceLevel)
229 {
230 UNIMPLEMENTED;
231 return 0;
232 }
233
234
235 /* Function 11 */
236 unsigned long
237 __stdcall
238 NetrUseEnum(
239 WKSSVC_IDENTIFY_HANDLE ServerName,
240 LPUSE_ENUM_STRUCT InfoStruct,
241 unsigned long PreferredMaximumLength,
242 unsigned long *TotalEntries,
243 unsigned long *ResumeHandle)
244 {
245 UNIMPLEMENTED;
246 return 0;
247 }
248
249
250 /* Function 12 */
251 void
252 __stdcall
253 Opnum12NotUsedOnWire(void)
254 {
255 UNIMPLEMENTED;
256 // return 0;
257 }
258
259
260 /* Function 13 */
261 unsigned long
262 __stdcall
263 NetrWorkstationStatisticsGet(
264 WKSSVC_IDENTIFY_HANDLE ServerName,
265 wchar_t *ServiceName,
266 unsigned long Level,
267 unsigned long Options,
268 LPSTAT_WORKSTATION_0 *Buffer)
269 {
270 PSTAT_WORKSTATION_0 pStatBuffer;
271
272 TRACE("NetrWorkstationStatisticsGet(%p %p %lu 0x%lx %p)\n",
273 ServerName, ServiceName, Level, Options, Buffer);
274
275 if (Level != 0)
276 return ERROR_INVALID_LEVEL;
277
278 if (Options != 0)
279 return ERROR_INVALID_PARAMETER;
280
281 pStatBuffer = midl_user_allocate(sizeof(STAT_WORKSTATION_0));
282 if (pStatBuffer == NULL)
283 return ERROR_NOT_ENOUGH_MEMORY;
284
285 ZeroMemory(pStatBuffer, sizeof(STAT_WORKSTATION_0));
286
287 // FIXME: Return the actual statistcs data!
288
289 *Buffer = pStatBuffer;
290
291 return NERR_Success;
292 }
293
294
295 /* Function 14 */
296 void
297 __stdcall
298 Opnum14NotUsedOnWire(void)
299 {
300 UNIMPLEMENTED;
301 // return 0;
302 }
303
304
305 /* Function 15 */
306 void
307 __stdcall
308 Opnum15NotUsedOnWire(void)
309 {
310 UNIMPLEMENTED;
311 // return 0;
312 }
313
314
315 /* Function 16 */
316 void
317 __stdcall
318 Opnum16NotUsedOnWire(void)
319 {
320 UNIMPLEMENTED;
321 // return 0;
322 }
323
324
325 /* Function 17 */
326 void
327 __stdcall
328 Opnum17NotUsedOnWire(void)
329 {
330 UNIMPLEMENTED;
331 // return 0;
332 }
333
334
335 /* Function 18 */
336 void
337 __stdcall
338 Opnum18NotUsedOnWire(void)
339 {
340 UNIMPLEMENTED;
341 // return 0;
342 }
343
344
345 /* Function 19 */
346 void
347 __stdcall
348 Opnum19NotUsedOnWire(void)
349 {
350 UNIMPLEMENTED;
351 // return 0;
352 }
353
354
355 /* Function 20 */
356 unsigned long
357 __stdcall
358 NetrGetJoinInformation(
359 WKSSVC_IMPERSONATE_HANDLE ServerName,
360 wchar_t **NameBuffer,
361 PNETSETUP_JOIN_STATUS BufferType)
362 {
363 TRACE("NetrGetJoinInformation()\n");
364
365 *NameBuffer = NULL;
366 *BufferType = NetSetupUnjoined;
367
368 return NERR_Success;
369 }
370
371
372 /* Function 21 */
373 void
374 __stdcall
375 Opnum21NotUsedOnWire(void)
376 {
377 UNIMPLEMENTED;
378 // return 0;
379 }
380
381
382 /* Function 22 */
383 unsigned long
384 __stdcall
385 NetrJoinDomain2(
386 handle_t RpcBindingHandle,
387 wchar_t *ServerName,
388 wchar_t *DomainNameParam,
389 wchar_t *MachineAccountOU,
390 wchar_t *AccountName,
391 PJOINPR_ENCRYPTED_USER_PASSWORD Password,
392 unsigned long Options)
393 {
394 UNIMPLEMENTED;
395 return 0;
396 }
397
398
399 /* Function 23 */
400 unsigned long
401 __stdcall
402 NetrUnjoinDomain2(
403 handle_t RpcBindingHandle,
404 wchar_t *ServerName,
405 wchar_t *AccountName,
406 PJOINPR_ENCRYPTED_USER_PASSWORD Password,
407 unsigned long Options)
408 {
409 UNIMPLEMENTED;
410 return 0;
411 }
412
413
414 /* Function 24 */
415 unsigned long
416 __stdcall
417 NetrRenameMachineInDomain2(
418 handle_t RpcBindingHandle,
419 wchar_t *ServerName,
420 wchar_t *MachineName,
421 wchar_t *AccountName,
422 PJOINPR_ENCRYPTED_USER_PASSWORD Password,
423 unsigned long Options)
424 {
425 UNIMPLEMENTED;
426 return 0;
427 }
428
429
430 /* Function 25 */
431 unsigned long
432 __stdcall
433 NetrValidateName2(
434 handle_t RpcBindingHandle,
435 wchar_t *ServerName,
436 wchar_t *NameToValidate,
437 wchar_t *AccountName,
438 PJOINPR_ENCRYPTED_USER_PASSWORD Password,
439 NETSETUP_NAME_TYPE NameType)
440 {
441 UNIMPLEMENTED;
442 return 0;
443 }
444
445
446 /* Function 26 */
447 unsigned long
448 __stdcall
449 NetrGetJoinableOUs2(
450 handle_t RpcBindingHandle,
451 wchar_t *ServerName,
452 wchar_t *DomainNameParam,
453 wchar_t *AccountName,
454 PJOINPR_ENCRYPTED_USER_PASSWORD Password,
455 unsigned long* OUCount,
456 wchar_t ***OUs)
457 {
458 UNIMPLEMENTED;
459 return 0;
460 }
461
462
463 /* Function 27 */
464 unsigned long
465 __stdcall
466 NetrAddAlternateComputerName(
467 handle_t RpcBindingHandle,
468 wchar_t *ServerName,
469 wchar_t *AlternateName,
470 wchar_t *DomainAccount,
471 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
472 unsigned long Reserved)
473 {
474 UNIMPLEMENTED;
475 return 0;
476 }
477
478
479 /* Function 28 */
480 unsigned long
481 __stdcall
482 NetrRemoveAlternateComputerName(
483 handle_t RpcBindingHandle,
484 wchar_t *ServerName,
485 wchar_t *AlternateName,
486 wchar_t *DomainAccount,
487 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
488 unsigned long Reserved)
489 {
490 UNIMPLEMENTED;
491 return 0;
492 }
493
494
495 /* Function 29 */
496 unsigned long
497 __stdcall
498 NetrSetPrimaryComputerName(
499 handle_t RpcBindingHandle,
500 wchar_t *ServerName,
501 wchar_t *PrimaryName,
502 wchar_t *DomainAccount,
503 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
504 unsigned long Reserved)
505 {
506 UNIMPLEMENTED;
507 return 0;
508 }
509
510
511 /* Function 30 */
512 unsigned long
513 __stdcall
514 NetrEnumerateComputerNames(
515 WKSSVC_IMPERSONATE_HANDLE ServerName,
516 NET_COMPUTER_NAME_TYPE NameType,
517 unsigned long Reserved,
518 PNET_COMPUTER_NAME_ARRAY *ComputerNames)
519 {
520 UNIMPLEMENTED;
521 return 0;
522 }
523
524 /* EOF */