xref: /reactos/base/services/wkssvc/rpcserver.c (revision 88b3d86b)
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
RpcThreadRoutine(LPVOID lpParameter)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 
midl_user_allocate(SIZE_T len)68 void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len)
69 {
70     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
71 }
72 
73 
midl_user_free(void __RPC_FAR * ptr)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
NetrWkstaGetInfo(WKSSVC_IDENTIFY_HANDLE ServerName,unsigned long Level,LPWKSTA_INFO * WkstaInfo)83 NetrWkstaGetInfo(
84     WKSSVC_IDENTIFY_HANDLE ServerName,
85     unsigned long Level,
86     LPWKSTA_INFO *WkstaInfo)
87 {
88     WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
89     DWORD dwComputerNameLength;
90     LPCWSTR pszLanRoot = L"";
91     PWKSTA_INFO pWkstaInfo = NULL;
92     LSA_OBJECT_ATTRIBUTES ObjectAttributes;
93     LSA_HANDLE PolicyHandle;
94     PPOLICY_PRIMARY_DOMAIN_INFO DomainInfo = NULL;
95     NTSTATUS NtStatus;
96     DWORD dwResult = NERR_Success;
97 
98     TRACE("NetrWkstaGetInfo level %lu\n", Level);
99 
100     dwComputerNameLength = MAX_COMPUTERNAME_LENGTH + 1;
101     GetComputerNameW(szComputerName, &dwComputerNameLength);
102     dwComputerNameLength++; /* include NULL terminator */
103 
104     ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
105     NtStatus = LsaOpenPolicy(NULL,
106                              &ObjectAttributes,
107                              POLICY_VIEW_LOCAL_INFORMATION,
108                              &PolicyHandle);
109     if (NtStatus != STATUS_SUCCESS)
110     {
111         WARN("LsaOpenPolicy() failed (Status 0x%08lx)\n", NtStatus);
112         return LsaNtStatusToWinError(NtStatus);
113     }
114 
115     NtStatus = LsaQueryInformationPolicy(PolicyHandle,
116                                          PolicyPrimaryDomainInformation,
117                                          (PVOID*)&DomainInfo);
118 
119     LsaClose(PolicyHandle);
120 
121     if (NtStatus != STATUS_SUCCESS)
122     {
123         WARN("LsaQueryInformationPolicy() failed (Status 0x%08lx)\n", NtStatus);
124         return LsaNtStatusToWinError(NtStatus);
125     }
126 
127     switch (Level)
128     {
129         case 100:
130             pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_100));
131             if (pWkstaInfo == NULL)
132             {
133                 dwResult = ERROR_NOT_ENOUGH_MEMORY;
134                 break;
135             }
136 
137             pWkstaInfo->WkstaInfo100.wki100_platform_id = PLATFORM_ID_NT;
138 
139             pWkstaInfo->WkstaInfo100.wki100_computername = midl_user_allocate(dwComputerNameLength * sizeof(WCHAR));
140             if (pWkstaInfo->WkstaInfo100.wki100_computername != NULL)
141                 wcscpy(pWkstaInfo->WkstaInfo100.wki100_computername, szComputerName);
142 
143             pWkstaInfo->WkstaInfo100.wki100_langroup = midl_user_allocate((wcslen(DomainInfo->Name.Buffer) + 1) * sizeof(WCHAR));
144             if (pWkstaInfo->WkstaInfo100.wki100_langroup != NULL)
145                 wcscpy(pWkstaInfo->WkstaInfo100.wki100_langroup, DomainInfo->Name.Buffer);
146 
147             pWkstaInfo->WkstaInfo100.wki100_ver_major = VersionInfo.dwMajorVersion;
148             pWkstaInfo->WkstaInfo100.wki100_ver_minor = VersionInfo.dwMinorVersion;
149 
150             *WkstaInfo = pWkstaInfo;
151             break;
152 
153         case 101:
154             pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_101));
155             if (pWkstaInfo == NULL)
156             {
157                 dwResult = ERROR_NOT_ENOUGH_MEMORY;
158                 break;
159             }
160 
161             pWkstaInfo->WkstaInfo101.wki101_platform_id = PLATFORM_ID_NT;
162 
163             pWkstaInfo->WkstaInfo101.wki101_computername = midl_user_allocate(dwComputerNameLength * sizeof(WCHAR));
164             if (pWkstaInfo->WkstaInfo101.wki101_computername != NULL)
165                 wcscpy(pWkstaInfo->WkstaInfo101.wki101_computername, szComputerName);
166 
167             pWkstaInfo->WkstaInfo101.wki101_langroup = midl_user_allocate((wcslen(DomainInfo->Name.Buffer) + 1) * sizeof(WCHAR));
168             if (pWkstaInfo->WkstaInfo101.wki101_langroup != NULL)
169                 wcscpy(pWkstaInfo->WkstaInfo101.wki101_langroup, DomainInfo->Name.Buffer);
170 
171             pWkstaInfo->WkstaInfo101.wki101_ver_major = VersionInfo.dwMajorVersion;
172             pWkstaInfo->WkstaInfo101.wki101_ver_minor = VersionInfo.dwMinorVersion;
173 
174             pWkstaInfo->WkstaInfo101.wki101_lanroot = midl_user_allocate((wcslen(pszLanRoot) + 1) * sizeof(WCHAR));
175             if (pWkstaInfo->WkstaInfo101.wki101_lanroot != NULL)
176                 wcscpy(pWkstaInfo->WkstaInfo101.wki101_lanroot, pszLanRoot);
177 
178             *WkstaInfo = pWkstaInfo;
179             break;
180 
181         case 102:
182             pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_102));
183             if (pWkstaInfo == NULL)
184             {
185                 dwResult = ERROR_NOT_ENOUGH_MEMORY;
186                 break;
187             }
188 
189             pWkstaInfo->WkstaInfo102.wki102_platform_id = PLATFORM_ID_NT;
190 
191             pWkstaInfo->WkstaInfo102.wki102_computername = midl_user_allocate(dwComputerNameLength * sizeof(WCHAR));
192             if (pWkstaInfo->WkstaInfo102.wki102_computername != NULL)
193                 wcscpy(pWkstaInfo->WkstaInfo102.wki102_computername, szComputerName);
194 
195             pWkstaInfo->WkstaInfo102.wki102_langroup = midl_user_allocate((wcslen(DomainInfo->Name.Buffer) + 1) * sizeof(WCHAR));
196             if (pWkstaInfo->WkstaInfo102.wki102_langroup != NULL)
197                 wcscpy(pWkstaInfo->WkstaInfo102.wki102_langroup, DomainInfo->Name.Buffer);
198 
199             pWkstaInfo->WkstaInfo102.wki102_ver_major = VersionInfo.dwMajorVersion;
200             pWkstaInfo->WkstaInfo102.wki102_ver_minor = VersionInfo.dwMinorVersion;
201 
202             pWkstaInfo->WkstaInfo102.wki102_lanroot = midl_user_allocate((wcslen(pszLanRoot) + 1) * sizeof(WCHAR));
203             if (pWkstaInfo->WkstaInfo102.wki102_lanroot != NULL)
204                 wcscpy(pWkstaInfo->WkstaInfo102.wki102_lanroot, pszLanRoot);
205 
206             pWkstaInfo->WkstaInfo102.wki102_logged_on_users = 1; /* FIXME */
207 
208             *WkstaInfo = pWkstaInfo;
209             break;
210 
211         case 502:
212             pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_502));
213             if (pWkstaInfo == NULL)
214             {
215                 dwResult = ERROR_NOT_ENOUGH_MEMORY;
216                 break;
217             }
218 
219             CopyMemory(&pWkstaInfo->WkstaInfo502, &WkstaInfo502, sizeof(WKSTA_INFO_502));
220 
221             *WkstaInfo = pWkstaInfo;
222             break;
223 
224         default:
225             FIXME("Level %lu unimplemented\n", Level);
226             dwResult = ERROR_INVALID_LEVEL;
227             break;
228     }
229 
230     if (DomainInfo != NULL)
231         LsaFreeMemory(DomainInfo);
232 
233     return dwResult;
234 }
235 
236 
237 /* Function 1 */
238 unsigned long
239 __stdcall
NetrWkstaSetInfo(WKSSVC_IDENTIFY_HANDLE ServerName,unsigned long Level,LPWKSTA_INFO WkstaInfo,unsigned long * ErrorParameter)240 NetrWkstaSetInfo(
241     WKSSVC_IDENTIFY_HANDLE ServerName,
242     unsigned long Level,
243     LPWKSTA_INFO WkstaInfo,
244     unsigned long *ErrorParameter)
245 {
246     DWORD dwResult = NERR_Success;
247 
248     TRACE("NetrWkstaSetInfo(%lu %p %p)\n",
249           Level, WkstaInfo, ErrorParameter);
250 
251     switch (Level)
252     {
253         case 502:
254             if (WkstaInfo->WkstaInfo502.wki502_keep_conn >= 1 && WkstaInfo->WkstaInfo502.wki502_keep_conn <= 65535)
255             {
256                 WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo502.wki502_keep_conn;
257 
258                 if (WkstaInfo->WkstaInfo502.wki502_max_cmds >= 50 && WkstaInfo->WkstaInfo502.wki502_max_cmds <= 65535)
259                 {
260                     WkstaInfo502.wki502_max_cmds = WkstaInfo->WkstaInfo502.wki502_max_cmds;
261 
262                     if (WkstaInfo->WkstaInfo502.wki502_sess_timeout >= 60 && WkstaInfo->WkstaInfo502.wki502_sess_timeout <= 65535)
263                     {
264                         WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo502.wki502_sess_timeout;
265 
266                         if (WkstaInfo->WkstaInfo502.wki502_dormant_file_limit != 0)
267                         {
268                             WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo502.wki502_dormant_file_limit;
269                         }
270                         else
271                         {
272                             if (ErrorParameter)
273                                 *ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
274                             dwResult = ERROR_INVALID_PARAMETER;
275                         }
276                     }
277                     else
278                     {
279                         if (ErrorParameter)
280                             *ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
281                         dwResult = ERROR_INVALID_PARAMETER;
282                     }
283                 }
284                 else
285                 {
286                     if (ErrorParameter)
287                         *ErrorParameter = WKSTA_MAXCMDS_PARMNUM;
288                     dwResult = ERROR_INVALID_PARAMETER;
289                 }
290             }
291             else
292             {
293                 if (ErrorParameter)
294                     *ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
295                 dwResult = ERROR_INVALID_PARAMETER;
296             }
297             break;
298 
299         case 1013:
300             if (WkstaInfo->WkstaInfo1013.wki1013_keep_conn >= 1 && WkstaInfo->WkstaInfo1013.wki1013_keep_conn <= 65535)
301             {
302                 WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo1013.wki1013_keep_conn;
303             }
304             else
305             {
306                 if (ErrorParameter)
307                     *ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
308                 dwResult = ERROR_INVALID_PARAMETER;
309             }
310             break;
311 
312         case 1018:
313             if (WkstaInfo->WkstaInfo1018.wki1018_sess_timeout >= 60 && WkstaInfo->WkstaInfo1018.wki1018_sess_timeout <= 65535)
314             {
315                 WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo1018.wki1018_sess_timeout;
316             }
317             else
318             {
319                 if (ErrorParameter)
320                     *ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
321                 dwResult = ERROR_INVALID_PARAMETER;
322             }
323             break;
324 
325         case 1046:
326             if (WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit != 0)
327             {
328                 WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit;
329             }
330             else
331             {
332                 if (ErrorParameter)
333                     *ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
334                 dwResult = ERROR_INVALID_PARAMETER;
335             }
336             break;
337 
338         default:
339             FIXME("Level %lu unimplemented\n", Level);
340             dwResult = ERROR_INVALID_LEVEL;
341             break;
342     }
343 
344     /* Save the workstation in the registry */
345     if (dwResult == NERR_Success)
346         SaveWorkstationInfo(Level);
347 
348     /* FIXME: Notify the redirector */
349 
350     return dwResult;
351 }
352 
353 
354 /* Function 2 */
355 unsigned long
356 __stdcall
NetrWkstaUserEnum(WKSSVC_IDENTIFY_HANDLE ServerName,LPWKSTA_USER_ENUM_STRUCT UserInfo,unsigned long PreferredMaximumLength,unsigned long * TotalEntries,unsigned long * ResumeHandle)357 NetrWkstaUserEnum(
358     WKSSVC_IDENTIFY_HANDLE ServerName,
359     LPWKSTA_USER_ENUM_STRUCT UserInfo,
360     unsigned long PreferredMaximumLength,
361     unsigned long *TotalEntries,
362     unsigned long *ResumeHandle)
363 {
364     ERR("NetrWkstaUserEnum(%p %p 0x%lx %p %p)\n",
365         ServerName, UserInfo, PreferredMaximumLength, TotalEntries, ResumeHandle);
366 
367 
368     UNIMPLEMENTED;
369     return 0;
370 }
371 
372 
373 /* Function 3 */
374 unsigned long
375 __stdcall
NetrWkstaUserGetInfo(WKSSVC_IDENTIFY_HANDLE Unused,unsigned long Level,LPWKSTA_USER_INFO UserInfo)376 NetrWkstaUserGetInfo(
377     WKSSVC_IDENTIFY_HANDLE Unused,
378     unsigned long Level,
379     LPWKSTA_USER_INFO UserInfo)
380 {
381     FIXME("(%s, %d, %p)\n", debugstr_w(Unused), Level, UserInfo);
382 
383     UNIMPLEMENTED;
384     return 0;
385 }
386 
387 
388 /* Function 4 */
389 unsigned long
390 __stdcall
NetrWkstaUserSetInfo(WKSSVC_IDENTIFY_HANDLE Unused,unsigned long Level,LPWKSTA_USER_INFO UserInfo,unsigned long * ErrorParameter)391 NetrWkstaUserSetInfo (
392     WKSSVC_IDENTIFY_HANDLE Unused,
393     unsigned long Level,
394     LPWKSTA_USER_INFO UserInfo,
395     unsigned long *ErrorParameter)
396 {
397     UNIMPLEMENTED;
398     return 0;
399 }
400 
401 
402 /* Function 5 */
403 unsigned long
404 __stdcall
NetrWkstaTransportEnum(WKSSVC_IDENTIFY_HANDLE ServerName,LPWKSTA_TRANSPORT_ENUM_STRUCT TransportInfo,unsigned long PreferredMaximumLength,unsigned long * TotalEntries,unsigned long * ResumeHandle)405 NetrWkstaTransportEnum(
406     WKSSVC_IDENTIFY_HANDLE ServerName,
407     LPWKSTA_TRANSPORT_ENUM_STRUCT TransportInfo,
408     unsigned long PreferredMaximumLength,
409     unsigned long* TotalEntries,
410     unsigned long *ResumeHandle)
411 {
412     UNIMPLEMENTED;
413     return 0;
414 }
415 
416 
417 /* Function 6 */
418 unsigned long
419 __stdcall
NetrWkstaTransportAdd(WKSSVC_IDENTIFY_HANDLE ServerName,unsigned long Level,LPWKSTA_TRANSPORT_INFO_0 TransportInfo,unsigned long * ErrorParameter)420 NetrWkstaTransportAdd(
421     WKSSVC_IDENTIFY_HANDLE ServerName,
422     unsigned long Level,
423     LPWKSTA_TRANSPORT_INFO_0 TransportInfo,
424     unsigned long *ErrorParameter)
425 {
426     UNIMPLEMENTED;
427     return 0;
428 }
429 
430 
431 /* Function 7 */
432 unsigned long
433 __stdcall
NetrWkstaTransportDel(WKSSVC_IDENTIFY_HANDLE ServerName,wchar_t * TransportName,unsigned long ForceLevel)434 NetrWkstaTransportDel(
435     WKSSVC_IDENTIFY_HANDLE ServerName,
436     wchar_t *TransportName,
437     unsigned long ForceLevel)
438 {
439     UNIMPLEMENTED;
440     return 0;
441 }
442 
443 
444 /* Function 8 */
445 unsigned long
446 __stdcall
NetrUseAdd(WKSSVC_IMPERSONATE_HANDLE ServerName,unsigned long Level,LPUSE_INFO InfoStruct,unsigned long * ErrorParameter)447 NetrUseAdd(
448     WKSSVC_IMPERSONATE_HANDLE ServerName,
449     unsigned long Level,
450     LPUSE_INFO InfoStruct,
451     unsigned long *ErrorParameter)
452 {
453     UNIMPLEMENTED;
454     return 0;
455 }
456 
457 
458 /* Function 9 */
459 unsigned long
460 __stdcall
NetrUseGetInfo(WKSSVC_IMPERSONATE_HANDLE ServerName,wchar_t * UseName,unsigned long Level,LPUSE_INFO InfoStruct)461 NetrUseGetInfo(
462     WKSSVC_IMPERSONATE_HANDLE ServerName,
463     wchar_t *UseName,
464     unsigned long Level,
465     LPUSE_INFO InfoStruct)
466 {
467     UNIMPLEMENTED;
468     return 0;
469 }
470 
471 
472 /* Function 10 */
473 unsigned long
474 __stdcall
NetrUseDel(WKSSVC_IMPERSONATE_HANDLE ServerName,wchar_t * UseName,unsigned long ForceLevel)475 NetrUseDel(
476     WKSSVC_IMPERSONATE_HANDLE ServerName,
477     wchar_t *UseName,
478     unsigned long ForceLevel)
479 {
480     UNIMPLEMENTED;
481     return 0;
482 }
483 
484 
485 /* Function 11 */
486 unsigned long
487 __stdcall
NetrUseEnum(WKSSVC_IDENTIFY_HANDLE ServerName,LPUSE_ENUM_STRUCT InfoStruct,unsigned long PreferredMaximumLength,unsigned long * TotalEntries,unsigned long * ResumeHandle)488 NetrUseEnum(
489     WKSSVC_IDENTIFY_HANDLE ServerName,
490     LPUSE_ENUM_STRUCT InfoStruct,
491     unsigned long PreferredMaximumLength,
492     unsigned long *TotalEntries,
493     unsigned long *ResumeHandle)
494 {
495     UNIMPLEMENTED;
496     return 0;
497 }
498 
499 
500 /* Function 12 - Not used on wire */
501 unsigned long
502 __stdcall
NetrMessageBufferSend(void)503 NetrMessageBufferSend(void)
504 {
505     TRACE("NetrMessageBufferSend()\n");
506     return ERROR_NOT_SUPPORTED;
507 }
508 
509 
510 /* Function 13 */
511 unsigned long
512 __stdcall
NetrWorkstationStatisticsGet(WKSSVC_IDENTIFY_HANDLE ServerName,wchar_t * ServiceName,unsigned long Level,unsigned long Options,LPSTAT_WORKSTATION_0 * Buffer)513 NetrWorkstationStatisticsGet(
514     WKSSVC_IDENTIFY_HANDLE ServerName,
515     wchar_t *ServiceName,
516     unsigned long Level,
517     unsigned long Options,
518     LPSTAT_WORKSTATION_0 *Buffer)
519 {
520     PSTAT_WORKSTATION_0 pStatBuffer;
521 
522     TRACE("NetrWorkstationStatisticsGet(%p %p %lu 0x%lx %p)\n",
523           ServerName, ServiceName, Level, Options, Buffer);
524 
525     if (Level != 0)
526         return ERROR_INVALID_LEVEL;
527 
528     if (Options != 0)
529         return ERROR_INVALID_PARAMETER;
530 
531     pStatBuffer = midl_user_allocate(sizeof(STAT_WORKSTATION_0));
532     if (pStatBuffer == NULL)
533         return ERROR_NOT_ENOUGH_MEMORY;
534 
535     ZeroMemory(pStatBuffer, sizeof(STAT_WORKSTATION_0));
536 
537     // FIXME: Return the actual statistcs data!
538 
539     *Buffer = pStatBuffer;
540 
541     return NERR_Success;
542 }
543 
544 
545 /* Function 14 - Not used on wire */
546 unsigned long
547 __stdcall
NetrLogonDomainNameAdd(WKSSVC_IDENTIFY_HANDLE DomainName)548 NetrLogonDomainNameAdd(
549     WKSSVC_IDENTIFY_HANDLE DomainName)
550 {
551     TRACE("NetrLogonDomainNameAdd(%s)\n",
552           debugstr_w(DomainName));
553     return ERROR_NOT_SUPPORTED;
554 }
555 
556 
557 /* Function 15 - Not used on wire */
558 unsigned long
559 __stdcall
NetrLogonDomainNameDel(WKSSVC_IDENTIFY_HANDLE DomainName)560 NetrLogonDomainNameDel(
561     WKSSVC_IDENTIFY_HANDLE DomainName)
562 {
563     TRACE("NetrLogonDomainNameDel(%s)\n",
564           debugstr_w(DomainName));
565     return ERROR_NOT_SUPPORTED;
566 }
567 
568 
569 /* Function 16 - Not used on wire */
570 unsigned long
571 __stdcall
NetrJoinDomain(void)572 NetrJoinDomain(void)
573 {
574     TRACE("NetrJoinDomain()\n");
575     return ERROR_NOT_SUPPORTED;
576 }
577 
578 
579 /* Function 17 - Not used on wire */
580 unsigned long
581 __stdcall
NetrUnjoinDomain(void)582 NetrUnjoinDomain(void)
583 {
584     TRACE("NetrUnjoinDomain()\n");
585     return ERROR_NOT_SUPPORTED;
586 }
587 
588 
589 /* Function 18 - Not used on wire */
590 unsigned long
591 __stdcall
NetrValidateName(void)592 NetrValidateName(void)
593 {
594     TRACE("NetrValidateName()\n");
595     return ERROR_NOT_SUPPORTED;
596 }
597 
598 
599 /* Function 19 - Not used on wire */
600 unsigned long
601 __stdcall
NetrRenameMachineInDomain(void)602 NetrRenameMachineInDomain(void)
603 {
604     TRACE("NetrRenameMachineInDomain()\n");
605     return ERROR_NOT_SUPPORTED;
606 }
607 
608 
609 /* Function 20 */
610 unsigned long
611 __stdcall
NetrGetJoinInformation(WKSSVC_IMPERSONATE_HANDLE ServerName,wchar_t ** NameBuffer,PNETSETUP_JOIN_STATUS BufferType)612 NetrGetJoinInformation(
613     WKSSVC_IMPERSONATE_HANDLE ServerName,
614     wchar_t **NameBuffer,
615     PNETSETUP_JOIN_STATUS BufferType)
616 {
617     TRACE("NetrGetJoinInformation(%p %p %p)\n",
618           ServerName, NameBuffer, BufferType);
619 
620     if (NameBuffer == NULL)
621         return ERROR_INVALID_PARAMETER;
622 
623     return NetpGetJoinInformation(NameBuffer,
624                                   BufferType);
625 }
626 
627 
628 /* Function 21 - Not used on wire */
629 unsigned long
630 __stdcall
NetrGetJoinableOUs(void)631 NetrGetJoinableOUs(void)
632 {
633     TRACE("NetrGetJoinableOUs()\n");
634     return ERROR_NOT_SUPPORTED;
635 }
636 
637 
638 /* Function 22 */
639 unsigned long
640 __stdcall
NetrJoinDomain2(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * DomainNameParam,wchar_t * MachineAccountOU,wchar_t * AccountName,PJOINPR_ENCRYPTED_USER_PASSWORD Password,unsigned long Options)641 NetrJoinDomain2(
642     handle_t RpcBindingHandle,
643     wchar_t *ServerName,
644     wchar_t *DomainNameParam,
645     wchar_t *MachineAccountOU,
646     wchar_t *AccountName,
647     PJOINPR_ENCRYPTED_USER_PASSWORD Password,
648     unsigned long Options)
649 {
650     NET_API_STATUS status;
651 
652     FIXME("NetrJoinDomain2(%p %S %S %S %S %p 0x%lx)\n",
653           RpcBindingHandle, ServerName, DomainNameParam, MachineAccountOU,
654           AccountName, Password, Options);
655 
656     if (DomainNameParam == NULL)
657         return ERROR_INVALID_PARAMETER;
658 
659     if (Options & NETSETUP_JOIN_DOMAIN)
660     {
661         FIXME("NetrJoinDomain2: NETSETUP_JOIN_DOMAIN is not supported yet!\n");
662         status = ERROR_CALL_NOT_IMPLEMENTED;
663     }
664     else
665     {
666         status = NetpJoinWorkgroup(DomainNameParam);
667     }
668 
669     return status;
670 }
671 
672 
673 /* Function 23 */
674 unsigned long
675 __stdcall
NetrUnjoinDomain2(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * AccountName,PJOINPR_ENCRYPTED_USER_PASSWORD Password,unsigned long Options)676 NetrUnjoinDomain2(
677     handle_t RpcBindingHandle,
678     wchar_t *ServerName,
679     wchar_t *AccountName,
680     PJOINPR_ENCRYPTED_USER_PASSWORD Password,
681     unsigned long Options)
682 {
683     UNIMPLEMENTED;
684     return 0;
685 }
686 
687 
688 /* Function 24 */
689 unsigned long
690 __stdcall
NetrRenameMachineInDomain2(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * MachineName,wchar_t * AccountName,PJOINPR_ENCRYPTED_USER_PASSWORD Password,unsigned long Options)691 NetrRenameMachineInDomain2(
692     handle_t RpcBindingHandle,
693     wchar_t *ServerName,
694     wchar_t *MachineName,
695     wchar_t *AccountName,
696     PJOINPR_ENCRYPTED_USER_PASSWORD Password,
697     unsigned long Options)
698 {
699     UNIMPLEMENTED;
700     return 0;
701 }
702 
703 
704 /* Function 25 */
705 unsigned long
706 __stdcall
NetrValidateName2(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * NameToValidate,wchar_t * AccountName,PJOINPR_ENCRYPTED_USER_PASSWORD Password,NETSETUP_NAME_TYPE NameType)707 NetrValidateName2(
708     handle_t RpcBindingHandle,
709     wchar_t *ServerName,
710     wchar_t *NameToValidate,
711     wchar_t *AccountName,
712     PJOINPR_ENCRYPTED_USER_PASSWORD Password,
713     NETSETUP_NAME_TYPE NameType)
714 {
715     UNIMPLEMENTED;
716     return 0;
717 }
718 
719 
720 /* Function 26 */
721 unsigned long
722 __stdcall
NetrGetJoinableOUs2(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * DomainNameParam,wchar_t * AccountName,PJOINPR_ENCRYPTED_USER_PASSWORD Password,unsigned long * OUCount,wchar_t *** OUs)723 NetrGetJoinableOUs2(
724     handle_t RpcBindingHandle,
725     wchar_t *ServerName,
726     wchar_t *DomainNameParam,
727     wchar_t *AccountName,
728     PJOINPR_ENCRYPTED_USER_PASSWORD Password,
729     unsigned long* OUCount,
730     wchar_t ***OUs)
731 {
732     UNIMPLEMENTED;
733     return 0;
734 }
735 
736 
737 /* Function 27 */
738 unsigned long
739 __stdcall
NetrAddAlternateComputerName(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * AlternateName,wchar_t * DomainAccount,PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,unsigned long Reserved)740 NetrAddAlternateComputerName(
741     handle_t RpcBindingHandle,
742     wchar_t *ServerName,
743     wchar_t *AlternateName,
744     wchar_t *DomainAccount,
745     PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
746     unsigned long Reserved)
747 {
748     UNIMPLEMENTED;
749     return 0;
750 }
751 
752 
753 /* Function 28 */
754 unsigned long
755 __stdcall
NetrRemoveAlternateComputerName(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * AlternateName,wchar_t * DomainAccount,PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,unsigned long Reserved)756 NetrRemoveAlternateComputerName(
757     handle_t RpcBindingHandle,
758     wchar_t *ServerName,
759     wchar_t *AlternateName,
760     wchar_t *DomainAccount,
761     PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
762     unsigned long Reserved)
763 {
764     UNIMPLEMENTED;
765     return 0;
766 }
767 
768 
769 /* Function 29 */
770 unsigned long
771 __stdcall
NetrSetPrimaryComputerName(handle_t RpcBindingHandle,wchar_t * ServerName,wchar_t * PrimaryName,wchar_t * DomainAccount,PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,unsigned long Reserved)772 NetrSetPrimaryComputerName(
773     handle_t RpcBindingHandle,
774     wchar_t *ServerName,
775     wchar_t *PrimaryName,
776     wchar_t *DomainAccount,
777     PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword,
778     unsigned long Reserved)
779 {
780     UNIMPLEMENTED;
781     return 0;
782 }
783 
784 
785 /* Function 30 */
786 unsigned long
787 __stdcall
NetrEnumerateComputerNames(WKSSVC_IMPERSONATE_HANDLE ServerName,NET_COMPUTER_NAME_TYPE NameType,unsigned long Reserved,PNET_COMPUTER_NAME_ARRAY * ComputerNames)788 NetrEnumerateComputerNames(
789     WKSSVC_IMPERSONATE_HANDLE ServerName,
790     NET_COMPUTER_NAME_TYPE NameType,
791     unsigned long Reserved,
792     PNET_COMPUTER_NAME_ARRAY *ComputerNames)
793 {
794     UNIMPLEMENTED;
795     return 0;
796 }
797 
798 /* EOF */
799