[NETAPI32]
[reactos.git] / reactos / dll / win32 / netapi32 / wksta_new.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: NetAPI DLL
4 * FILE: reactos/dll/win32/netapi32/wksta_new.c
5 * PURPOSE: Workstation service interface code
6 *
7 * PROGRAMMERS: Eric Kohl
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #include "netapi32.h"
13 #include "wkssvc_c.h"
14
15 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
16
17 /* FUNCTIONS *****************************************************************/
18
19 void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len)
20 {
21 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
22 }
23
24
25 void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
26 {
27 HeapFree(GetProcessHeap(), 0, ptr);
28 }
29
30
31 handle_t __RPC_USER
32 WKSSVC_IDENTIFY_HANDLE_bind(WKSSVC_IDENTIFY_HANDLE pszSystemName)
33 {
34 handle_t hBinding = NULL;
35 LPWSTR pszStringBinding;
36 RPC_STATUS status;
37
38 TRACE("WKSSVC_IDENTIFY_HANDLE_bind() called\n");
39
40 status = RpcStringBindingComposeW(NULL,
41 L"ncacn_np",
42 pszSystemName,
43 L"\\pipe\\wkssvc",
44 NULL,
45 &pszStringBinding);
46 if (status)
47 {
48 TRACE("RpcStringBindingCompose returned 0x%x\n", status);
49 return NULL;
50 }
51
52 /* Set the binding handle that will be used to bind to the server. */
53 status = RpcBindingFromStringBindingW(pszStringBinding,
54 &hBinding);
55 if (status)
56 {
57 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
58 }
59
60 status = RpcStringFreeW(&pszStringBinding);
61 if (status)
62 {
63 // TRACE("RpcStringFree returned 0x%x\n", status);
64 }
65
66 return hBinding;
67 }
68
69
70 void __RPC_USER
71 WKSSVC_IDENTIFY_HANDLE_unbind(WKSSVC_IDENTIFY_HANDLE pszSystemName,
72 handle_t hBinding)
73 {
74 RPC_STATUS status;
75
76 TRACE("WKSSVC_IDENTIFY_HANDLE_unbind() called\n");
77
78 status = RpcBindingFree(&hBinding);
79 if (status)
80 {
81 TRACE("RpcBindingFree returned 0x%x\n", status);
82 }
83 }
84
85
86 handle_t __RPC_USER
87 WKSSVC_IMPERSONATE_HANDLE_bind(WKSSVC_IMPERSONATE_HANDLE pszSystemName)
88 {
89 handle_t hBinding = NULL;
90 LPWSTR pszStringBinding;
91 RPC_STATUS status;
92
93 TRACE("WKSSVC_IMPERSONATE_HANDLE_bind() called\n");
94
95 status = RpcStringBindingComposeW(NULL,
96 L"ncacn_np",
97 pszSystemName,
98 L"\\pipe\\wkssvc",
99 NULL,
100 &pszStringBinding);
101 if (status)
102 {
103 TRACE("RpcStringBindingCompose returned 0x%x\n", status);
104 return NULL;
105 }
106
107 /* Set the binding handle that will be used to bind to the server. */
108 status = RpcBindingFromStringBindingW(pszStringBinding,
109 &hBinding);
110 if (status)
111 {
112 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
113 }
114
115 status = RpcStringFreeW(&pszStringBinding);
116 if (status)
117 {
118 // TRACE("RpcStringFree returned 0x%x\n", status);
119 }
120
121 return hBinding;
122 }
123
124
125 void __RPC_USER
126 WKSSVC_IMPERSONATE_HANDLE_unbind(WKSSVC_IMPERSONATE_HANDLE pszSystemName,
127 handle_t hBinding)
128 {
129 RPC_STATUS status;
130
131 TRACE("WKSSVC_IMPERSONATE_HANDLE_unbind() called\n");
132
133 status = RpcBindingFree(&hBinding);
134 if (status)
135 {
136 TRACE("RpcBindingFree returned 0x%x\n", status);
137 }
138 }
139
140
141 NET_API_STATUS
142 WINAPI
143 NetAddAlternateComputerName(
144 _In_opt_ LPCWSTR Server,
145 _In_ LPCWSTR AlternateName,
146 _In_opt_ LPCWSTR DomainAccount,
147 _In_opt_ LPCWSTR DomainAccountPassword,
148 _In_ ULONG Reserved)
149 {
150 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
151 handle_t BindingHandle;
152 NET_API_STATUS status;
153
154 TRACE("NetAddAlternateComputerName(%s %s %s %s 0x%lx)\n",
155 debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
156 debugstr_w(DomainAccountPassword), Reserved);
157
158 /* FIXME */
159 BindingHandle = NULL;
160 EncryptedPassword = NULL;
161
162 RpcTryExcept
163 {
164 status = NetrAddAlternateComputerName(BindingHandle,
165 (PWSTR)Server,
166 (PWSTR)AlternateName,
167 (PWSTR)DomainAccount,
168 EncryptedPassword,
169 Reserved);
170 }
171 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
172 {
173 status = I_RpcMapWin32Status(RpcExceptionCode());
174 }
175 RpcEndExcept;
176
177 return status;
178 }
179
180
181 #if 0
182 NET_API_STATUS
183 WINAPI
184 NetGetJoinInformation(
185 LPCWSTR Server,
186 LPWSTR *Name,
187 PNETSETUP_JOIN_STATUS type)
188 {
189 NET_API_STATUS status;
190
191 TRACE("NetGetJoinInformation(%s %p %p)\n", debugstr_w(Server),
192 Name, type);
193
194 if (Name == NULL || type == NULL)
195 return ERROR_INVALID_PARAMETER;
196
197 RpcTryExcept
198 {
199 status = NetrGetJoinInformation((LPWSTR)Server,
200 Name,
201 type);
202 }
203 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
204 {
205 status = I_RpcMapWin32Status(RpcExceptionCode());
206 }
207 RpcEndExcept;
208
209 return status;
210 }
211 #endif
212
213
214 NET_API_STATUS
215 WINAPI
216 NetGetJoinableOUs(
217 _In_ LPCWSTR lpServer,
218 _In_ LPCWSTR lpDomain,
219 _In_ LPCWSTR lpAccount,
220 _In_ LPCWSTR lpPassword,
221 _Out_ DWORD *OUCount,
222 _Out_ LPWSTR **OUs)
223 {
224 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
225 handle_t BindingHandle;
226 NET_API_STATUS status;
227
228 TRACE("NetGetJoinableOUs(%s %s %s %s %p %p)\n",
229 debugstr_w(lpServer), debugstr_w(lpDomain), debugstr_w(lpAccount),
230 debugstr_w(lpPassword), OUCount, OUs);
231
232 /* FIXME */
233 BindingHandle = NULL;
234 EncryptedPassword = NULL;
235
236 RpcTryExcept
237 {
238 status = NetrGetJoinableOUs2(BindingHandle,
239 (PWSTR)lpServer,
240 (PWSTR)lpDomain,
241 (PWSTR)lpAccount,
242 EncryptedPassword,
243 OUCount,
244 OUs);
245 }
246 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
247 {
248 status = I_RpcMapWin32Status(RpcExceptionCode());
249 }
250 RpcEndExcept;
251
252 return status;
253 }
254
255
256 NET_API_STATUS
257 WINAPI
258 NetJoinDomain(
259 _In_ LPCWSTR lpServer,
260 _In_ LPCWSTR lpDomain,
261 _In_ LPCWSTR lpAccountOU,
262 _In_ LPCWSTR lpAccount,
263 _In_ LPCWSTR lpPassword,
264 _In_ DWORD fJoinOptions)
265 {
266 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
267 handle_t BindingHandle;
268 NET_API_STATUS status;
269
270 TRACE("NetJoinDomain(%s %s %s %s 0x%lx)\n",
271 debugstr_w(lpServer), debugstr_w(lpDomain), debugstr_w(lpAccountOU),
272 debugstr_w(lpAccount), debugstr_w(lpPassword), fJoinOptions);
273
274 /* FIXME */
275 BindingHandle = NULL;
276 EncryptedPassword = NULL;
277
278 RpcTryExcept
279 {
280 status = NetrJoinDomain2(BindingHandle,
281 (PWSTR)lpServer,
282 (PWSTR)lpDomain,
283 (PWSTR)lpAccountOU,
284 (PWSTR)lpAccount,
285 EncryptedPassword,
286 fJoinOptions);
287 }
288 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
289 {
290 status = I_RpcMapWin32Status(RpcExceptionCode());
291 }
292 RpcEndExcept;
293
294 return status;
295 }
296
297
298 NET_API_STATUS
299 WINAPI
300 NetRemoveAlternateComputerName(
301 _In_opt_ LPCWSTR Server,
302 _In_ LPCWSTR AlternateName,
303 _In_opt_ LPCWSTR DomainAccount,
304 _In_opt_ LPCWSTR DomainAccountPassword,
305 _In_ ULONG Reserved)
306 {
307 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
308 handle_t BindingHandle;
309 NET_API_STATUS status;
310
311 TRACE("NetRemoveAlternateComputerName(%s %s %s %s 0x%lx)\n",
312 debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
313 debugstr_w(DomainAccountPassword), Reserved);
314
315 /* FIXME */
316 BindingHandle = NULL;
317 EncryptedPassword = NULL;
318
319 RpcTryExcept
320 {
321 status = NetrRemoveAlternateComputerName(BindingHandle,
322 (PWSTR)Server,
323 (PWSTR)AlternateName,
324 (PWSTR)DomainAccount,
325 EncryptedPassword,
326 Reserved);
327 }
328 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
329 {
330 status = I_RpcMapWin32Status(RpcExceptionCode());
331 }
332 RpcEndExcept;
333
334 return status;
335 }
336
337
338 NET_API_STATUS
339 WINAPI
340 NetRenameMachineInDomain(
341 _In_ LPCWSTR lpServer,
342 _In_ LPCWSTR lpNewMachineName,
343 _In_ LPCWSTR lpAccount,
344 _In_ LPCWSTR lpPassword,
345 _In_ DWORD fRenameOptions)
346 {
347 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
348 handle_t BindingHandle;
349 NET_API_STATUS status;
350
351 TRACE("NetRenameMachineInDomain(%s %s %s %s 0x%lx)\n",
352 debugstr_w(lpServer), debugstr_w(lpNewMachineName), debugstr_w(lpAccount),
353 debugstr_w(lpPassword), fRenameOptions);
354
355 /* FIXME */
356 BindingHandle = NULL;
357 EncryptedPassword = NULL;
358
359 RpcTryExcept
360 {
361 status = NetrRenameMachineInDomain2(BindingHandle,
362 (PWSTR)lpServer,
363 (PWSTR)lpNewMachineName,
364 (PWSTR)lpAccount,
365 EncryptedPassword,
366 fRenameOptions);
367 }
368 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
369 {
370 status = I_RpcMapWin32Status(RpcExceptionCode());
371 }
372 RpcEndExcept;
373
374 return status;
375 }
376
377
378 NET_API_STATUS
379 WINAPI
380 NetSetPrimaryComputerName(
381 _In_opt_ LPCWSTR Server,
382 _In_ LPCWSTR PrimaryName,
383 _In_opt_ LPCWSTR DomainAccount,
384 _In_opt_ LPCWSTR DomainAccountPassword,
385 _In_ ULONG Reserved)
386 {
387 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
388 handle_t BindingHandle;
389 NET_API_STATUS status;
390
391 TRACE("NetSetPrimaryComputerName(%s %s %s %s %lu)\n",
392 debugstr_w(Server), debugstr_w(PrimaryName), debugstr_w(DomainAccount),
393 debugstr_w(DomainAccountPassword), Reserved);
394
395 /* FIXME */
396 BindingHandle = NULL;
397 EncryptedPassword = NULL;
398
399 RpcTryExcept
400 {
401 status = NetrSetPrimaryComputerName(BindingHandle,
402 (PWSTR)Server,
403 (PWSTR)PrimaryName,
404 (PWSTR)DomainAccount,
405 EncryptedPassword,
406 Reserved);
407 }
408 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
409 {
410 status = I_RpcMapWin32Status(RpcExceptionCode());
411 }
412 RpcEndExcept;
413
414 return status;
415 }
416
417
418 NET_API_STATUS
419 WINAPI
420 NetUnjoinDomain(
421 _In_ LPCWSTR lpServer,
422 _In_ LPCWSTR lpAccount,
423 _In_ LPCWSTR lpPassword,
424 _In_ DWORD fUnjoinOptions)
425 {
426 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
427 handle_t BindingHandle;
428 NET_API_STATUS status;
429
430 TRACE("NetUnjoinDomain(%s %s %s %s 0x%lx)\n",
431 debugstr_w(lpServer), debugstr_w(lpAccount),
432 debugstr_w(lpPassword), fUnjoinOptions);
433
434 /* FIXME */
435 BindingHandle = NULL;
436 EncryptedPassword = NULL;
437
438 RpcTryExcept
439 {
440 status = NetrUnjoinDomain2(BindingHandle,
441 (PWSTR)lpServer,
442 (PWSTR)lpAccount,
443 EncryptedPassword,
444 fUnjoinOptions);
445 }
446 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
447 {
448 status = I_RpcMapWin32Status(RpcExceptionCode());
449 }
450 RpcEndExcept;
451
452 return status;
453 }
454
455
456 NET_API_STATUS
457 WINAPI
458 NetUseAdd(
459 LMSTR UncServerName,
460 DWORD Level,
461 LPBYTE Buf,
462 LPDWORD ParmError)
463 {
464 NET_API_STATUS status;
465
466 TRACE("NetUseAdd(%s %d %p %p)\n", debugstr_w(UncServerName),
467 Level, Buf, ParmError);
468
469 RpcTryExcept
470 {
471 status = NetrUseAdd(UncServerName,
472 Level,
473 (LPUSE_INFO)Buf,
474 ParmError);
475 }
476 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
477 {
478 status = I_RpcMapWin32Status(RpcExceptionCode());
479 }
480 RpcEndExcept;
481
482 return status;
483 }
484
485
486 NET_API_STATUS
487 WINAPI
488 NetUseDel(
489 LMSTR UncServerName,
490 LMSTR UseName,
491 DWORD ForceCond)
492 {
493 NET_API_STATUS status;
494
495 TRACE("NetUseDel(%s %s %d)\n", debugstr_w(UncServerName),
496 debugstr_w(UseName), ForceCond);
497
498 RpcTryExcept
499 {
500 status = NetrUseDel(UncServerName,
501 UseName,
502 ForceCond);
503 }
504 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
505 {
506 status = I_RpcMapWin32Status(RpcExceptionCode());
507 }
508 RpcEndExcept;
509
510 return status;
511 }
512
513
514 NET_API_STATUS
515 WINAPI
516 NetUseEnum(
517 LMSTR UncServerName,
518 DWORD Level,
519 LPBYTE *BufPtr,
520 DWORD PreferedMaximumSize,
521 LPDWORD EntriesRead,
522 LPDWORD TotalEntries,
523 LPDWORD ResumeHandle)
524 {
525 USE_ENUM_STRUCT UseEnumInfo;
526 USE_INFO_0_CONTAINER Container0;
527 USE_INFO_1_CONTAINER Container1;
528 USE_INFO_2_CONTAINER Container2;
529 NET_API_STATUS status;
530
531 TRACE("NetUseEnum(%s, %d, %p, %d, %p, %p, %p)\n", debugstr_w(UncServerName),
532 Level, BufPtr, PreferedMaximumSize, EntriesRead, TotalEntries, ResumeHandle);
533
534 UseEnumInfo.Level = Level;
535 switch (Level)
536 {
537 case 0:
538 UseEnumInfo.UseInfo.Level0 = &Container0;
539 Container0.EntriesRead = 0;
540 Container0.Buffer = NULL;
541 break;
542
543 case 1:
544 UseEnumInfo.UseInfo.Level1 = &Container1;
545 Container1.EntriesRead = 0;
546 Container1.Buffer = NULL;
547 break;
548
549 case 2:
550 UseEnumInfo.UseInfo.Level2 = &Container2;
551 Container2.EntriesRead = 0;
552 Container2.Buffer = NULL;
553 break;
554
555 default:
556 return ERROR_INVALID_PARAMETER;
557 }
558
559 RpcTryExcept
560 {
561 status = NetrUseEnum(UncServerName,
562 &UseEnumInfo,
563 PreferedMaximumSize,
564 TotalEntries,
565 ResumeHandle);
566 if (status == NERR_Success || status == ERROR_MORE_DATA)
567 {
568 switch (Level)
569 {
570 case 0:
571 *BufPtr = (LPBYTE)UseEnumInfo.UseInfo.Level0->Buffer;
572 *EntriesRead = UseEnumInfo.UseInfo.Level0->EntriesRead;
573 break;
574
575 case 1:
576 *BufPtr = (LPBYTE)UseEnumInfo.UseInfo.Level1->Buffer;
577 *EntriesRead = UseEnumInfo.UseInfo.Level1->EntriesRead;
578 break;
579
580 case 2:
581 *BufPtr = (LPBYTE)UseEnumInfo.UseInfo.Level2->Buffer;
582 *EntriesRead = UseEnumInfo.UseInfo.Level2->EntriesRead;
583 break;
584 }
585 }
586 }
587 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
588 {
589 status = I_RpcMapWin32Status(RpcExceptionCode());
590 }
591 RpcEndExcept;
592
593 return status;
594 }
595
596
597 NET_API_STATUS
598 WINAPI
599 NetValidateName(
600 _In_ LPCWSTR lpServer,
601 _In_ LPCWSTR lpName,
602 _In_ LPCWSTR lpAccount,
603 _In_ LPCWSTR lpPassword,
604 _In_ NETSETUP_NAME_TYPE NameType)
605 {
606 PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
607 handle_t BindingHandle;
608 NET_API_STATUS status;
609
610 TRACE("NetValidateName(%s %s %s %s %u)\n",
611 debugstr_w(lpServer), debugstr_w(lpName), debugstr_w(lpAccount),
612 debugstr_w(lpPassword), NameType);
613
614 /* FIXME */
615 BindingHandle = NULL;
616 EncryptedPassword = NULL;
617
618 RpcTryExcept
619 {
620 status = NetrValidateName2(BindingHandle,
621 (PWSTR)lpServer,
622 (PWSTR)lpName,
623 (PWSTR)lpAccount,
624 EncryptedPassword,
625 NameType);
626 }
627 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
628 {
629 status = I_RpcMapWin32Status(RpcExceptionCode());
630 }
631 RpcEndExcept;
632
633 return status;
634 }
635
636
637 NET_API_STATUS
638 WINAPI
639 NetUseGetInfo(
640 LMSTR UncServerName,
641 LMSTR UseName,
642 DWORD Level,
643 LPBYTE *BufPtr)
644 {
645 NET_API_STATUS status;
646
647 TRACE("NetUseGetInfo(%s, %s, %d, %p)\n", debugstr_w(UncServerName),
648 debugstr_w(UseName), Level, BufPtr);
649
650 *BufPtr = NULL;
651
652 RpcTryExcept
653 {
654 status = NetrUseGetInfo(UncServerName,
655 UseName,
656 Level,
657 (LPUSE_INFO)BufPtr);
658 }
659 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
660 {
661 status = I_RpcMapWin32Status(RpcExceptionCode());
662 }
663 RpcEndExcept;
664
665 return status;
666 }
667
668
669 #if 0
670 NET_API_STATUS
671 WINAPI
672 NetWkstaGetInfo(
673 LPWSTR servername,
674 DWORD level,
675 LPBYTE *bufptr)
676 {
677 NET_API_STATUS status;
678
679 TRACE("NetWkstaGetInfo(%s, %d, %p)\n", debugstr_w(servername),
680 level, bufptr);
681
682 if (bufptr == NULL)
683 return ERROR_INVALID_PARAMETER;
684
685 *bufptr = NULL;
686
687 RpcTryExcept
688 {
689 status = NetrWkstaGetInfo(servername,
690 level,
691 (LPWKSTA_INFO)bufptr);
692 }
693 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
694 {
695 status = I_RpcMapWin32Status(RpcExceptionCode());
696 }
697 RpcEndExcept;
698
699 return status;
700 }
701 #endif
702
703
704 NET_API_STATUS
705 WINAPI
706 NetWkstaSetInfo(
707 LPWSTR servername,
708 DWORD level,
709 LPBYTE buffer,
710 LPDWORD parm_err)
711 {
712 NET_API_STATUS status;
713
714 TRACE("NetWkstaSetInfo(%s, %d, %p, %p)\n", debugstr_w(servername),
715 level, buffer, parm_err);
716
717 RpcTryExcept
718 {
719 status = NetrWkstaSetInfo(servername,
720 level,
721 (LPWKSTA_INFO)buffer,
722 parm_err);
723 }
724 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
725 {
726 status = I_RpcMapWin32Status(RpcExceptionCode());
727 }
728 RpcEndExcept;
729
730 return status;
731 }
732
733
734 NET_API_STATUS
735 WINAPI
736 NetWkstaTransportAdd(
737 LPWSTR servername,
738 DWORD level,
739 LPBYTE buf,
740 LPDWORD parm_err)
741 {
742 NET_API_STATUS status;
743
744 TRACE("NetWkstaTransportAdd(%s, %d, %p, %p)\n", debugstr_w(servername),
745 level, buf, parm_err);
746
747 RpcTryExcept
748 {
749 status = NetrWkstaTransportAdd(servername,
750 level,
751 (LPWKSTA_TRANSPORT_INFO_0)buf,
752 parm_err);
753 }
754 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
755 {
756 status = I_RpcMapWin32Status(RpcExceptionCode());
757 }
758 RpcEndExcept;
759
760 return status;
761 }
762
763
764 NET_API_STATUS
765 WINAPI
766 NetWkstaTransportDel(
767 LPWSTR servername,
768 LPWSTR transportname,
769 DWORD ucond)
770 {
771 NET_API_STATUS status;
772
773 TRACE("NetWkstaTransportDel(%s, %s, %d)\n", debugstr_w(servername),
774 debugstr_w(transportname), ucond);
775
776 RpcTryExcept
777 {
778 status = NetrWkstaTransportDel(servername,
779 transportname,
780 ucond);
781 }
782 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
783 {
784 status = I_RpcMapWin32Status(RpcExceptionCode());
785 }
786 RpcEndExcept;
787
788 return status;
789 }
790
791
792 #if 0
793 NET_API_STATUS
794 WINAPI
795 NetWkstaTransportEnum(
796 LPWSTR servername,
797 DWORD level,
798 LPBYTE *bufptr,
799 DWORD prefmaxlen,
800 LPDWORD entriesread,
801 LPDWORD totalentries,
802 LPDWORD resumehandle)
803 {
804 WKSTA_TRANSPORT_ENUM_STRUCT TransportEnumInfo;
805 WKSTA_TRANSPORT_INFO_0_CONTAINER Container0;
806 NET_API_STATUS status;
807
808 TRACE("NetWkstaTransportEnum(%s, %d, %p, %d, %p, %p, %p)\n", debugstr_w(servername),
809 level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
810
811 TransportEnumInfo.Level = level;
812 switch (level)
813 {
814 case 0:
815 TransportEnumInfo.WkstaTransportInfo.Level0 = &Container0;
816 Container0.EntriesRead = 0;
817 Container0.Buffer = NULL;
818 break;
819
820 default:
821 return ERROR_INVALID_PARAMETER;
822 }
823
824 RpcTryExcept
825 {
826 status = NetrWkstaTransportEnum(servername,
827 &TransportEnumInfo,
828 prefmaxlen,
829 totalentries,
830 resumehandle);
831 if (status == NERR_Success || status == ERROR_MORE_DATA)
832 {
833 switch (level)
834 {
835 case 0:
836 *bufptr = (LPBYTE)TransportEnumInfo.WkstaTransportInfo.Level0->Buffer;
837 *entriesread = TransportEnumInfo.WkstaTransportInfo.Level0->EntriesRead;
838 break;
839 }
840 }
841 }
842 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
843 {
844 status = I_RpcMapWin32Status(RpcExceptionCode());
845 }
846 RpcEndExcept;
847
848 return status;
849 }
850
851
852 NET_API_STATUS
853 WINAPI
854 NetWkstaUserEnum(
855 LPWSTR servername,
856 DWORD level,
857 LPBYTE *bufptr,
858 DWORD prefmaxlen,
859 LPDWORD entriesread,
860 LPDWORD totalentries,
861 LPDWORD resumehandle)
862 {
863 WKSTA_USER_ENUM_STRUCT UserEnumInfo;
864 WKSTA_USER_INFO_0_CONTAINER Container0;
865 WKSTA_USER_INFO_1_CONTAINER Container1;
866 NET_API_STATUS status;
867
868 TRACE("NetWkstaUserEnum(%s, %d, %p, %d, %p, %p, %p)\n", debugstr_w(servername),
869 level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
870
871 UserEnumInfo.Level = level;
872 switch (level)
873 {
874 case 0:
875 UserEnumInfo.WkstaUserInfo.Level0 = &Container0;
876 Container0.EntriesRead = 0;
877 Container0.Buffer = NULL;
878 break;
879
880 case 1:
881 UserEnumInfo.WkstaUserInfo.Level1 = &Container1;
882 Container1.EntriesRead = 0;
883 Container1.Buffer = NULL;
884 break;
885
886 default:
887 return ERROR_INVALID_PARAMETER;
888 }
889
890 RpcTryExcept
891 {
892 status = NetrWkstaUserEnum(servername,
893 &UserEnumInfo,
894 prefmaxlen,
895 totalentries,
896 resumehandle);
897 if (status == NERR_Success || status == ERROR_MORE_DATA)
898 {
899 switch (level)
900 {
901 case 0:
902 *bufptr = (LPBYTE)UserEnumInfo.WkstaUserInfo.Level0->Buffer;
903 *entriesread = UserEnumInfo.WkstaUserInfo.Level0->EntriesRead;
904 break;
905
906 case 1:
907 *bufptr = (LPBYTE)UserEnumInfo.WkstaUserInfo.Level1->Buffer;
908 *entriesread = UserEnumInfo.WkstaUserInfo.Level1->EntriesRead;
909 break;
910 }
911 }
912 }
913 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
914 {
915 status = I_RpcMapWin32Status(RpcExceptionCode());
916 }
917 RpcEndExcept;
918
919 return status;
920 }
921
922
923 NET_API_STATUS
924 WINAPI
925 NetWkstaUserGetInfo(
926 LPWSTR reserved,
927 DWORD level,
928 PBYTE *bufptr)
929 {
930 NET_API_STATUS status;
931
932 TRACE("NetWkstaUserGetInfo(%s, %d, %p)\n", debugstr_w(reserved),
933 level, bufptr);
934
935 if (reserved != NULL)
936 return ERROR_INVALID_PARAMETER;
937
938 *bufptr = NULL;
939
940 RpcTryExcept
941 {
942 status = NetrWkstaUserGetInfo(NULL,
943 level,
944 (LPWKSTA_USER_INFO)bufptr);
945 }
946 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
947 {
948 status = I_RpcMapWin32Status(RpcExceptionCode());
949 }
950 RpcEndExcept;
951
952 return status;
953 }
954 #endif
955
956
957 NET_API_STATUS
958 WINAPI
959 NetWkstaUserSetInfo(
960 LPWSTR reserved,
961 DWORD level,
962 LPBYTE buf,
963 LPDWORD parm_err)
964 {
965 NET_API_STATUS status;
966
967 TRACE("NetWkstaSetInfo(%s, %d, %p, %p)\n", debugstr_w(reserved),
968 level, buf, parm_err);
969
970 if (reserved != NULL)
971 return ERROR_INVALID_PARAMETER;
972
973 RpcTryExcept
974 {
975 status = NetrWkstaUserSetInfo(NULL,
976 level,
977 (LPWKSTA_USER_INFO)&buf,
978 parm_err);
979 }
980 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
981 {
982 status = I_RpcMapWin32Status(RpcExceptionCode());
983 }
984 RpcEndExcept;
985
986 return status;
987 }
988
989 /* EOF */