[NETAPI32]
[reactos.git] / reactos / dll / win32 / netapi32 / netlogon.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: NetAPI DLL
4 * FILE: dll/win32/netapi32/netlogon.c
5 * PURPOSE: Netlogon service interface code
6 * PROGRAMMERS: Eric Kohl (eric.kohl@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include "netapi32.h"
12 #include <rpc.h>
13 #include "netlogon_c.h"
14
15 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
16
17 /* FUNCTIONS *****************************************************************/
18
19 handle_t __RPC_USER
20 LOGONSRV_HANDLE_bind(LOGONSRV_HANDLE pszSystemName)
21 {
22 handle_t hBinding = NULL;
23 LPWSTR pszStringBinding;
24 RPC_STATUS status;
25
26 TRACE("LOGONSRV_HANDLE_bind() called\n");
27
28 status = RpcStringBindingComposeW(NULL,
29 L"ncacn_np",
30 pszSystemName,
31 L"\\pipe\\netlogon",
32 NULL,
33 &pszStringBinding);
34 if (status)
35 {
36 TRACE("RpcStringBindingCompose returned 0x%x\n", status);
37 return NULL;
38 }
39
40 /* Set the binding handle that will be used to bind to the server. */
41 status = RpcBindingFromStringBindingW(pszStringBinding,
42 &hBinding);
43 if (status)
44 {
45 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
46 }
47
48 status = RpcStringFreeW(&pszStringBinding);
49 if (status)
50 {
51 // TRACE("RpcStringFree returned 0x%x\n", status);
52 }
53
54 return hBinding;
55 }
56
57
58 void __RPC_USER
59 LOGONSRV_HANDLE_unbind(LOGONSRV_HANDLE pszSystemName,
60 handle_t hBinding)
61 {
62 RPC_STATUS status;
63
64 TRACE("LOGONSRV_HANDLE_unbind() called\n");
65
66 status = RpcBindingFree(&hBinding);
67 if (status)
68 {
69 TRACE("RpcBindingFree returned 0x%x\n", status);
70 }
71 }
72
73
74 NTSTATUS
75 WINAPI
76 NetEnumerateTrustedDomains(
77 _In_ LPWSTR ServerName,
78 _Out_ LPWSTR *DomainNames)
79 {
80 FIXME("NetEnumerateTrustedDomains(%s, %p)\n",
81 debugstr_w(ServerName), DomainNames);
82
83 return STATUS_NOT_IMPLEMENTED;
84 }
85
86
87 NET_API_STATUS
88 WINAPI
89 NetGetAnyDCName(
90 _In_opt_ LPCWSTR ServerName,
91 _In_opt_ LPCWSTR DomainName,
92 _Out_ LPBYTE *BufPtr)
93 {
94 NET_API_STATUS status;
95
96 TRACE("NetGetAnyDCName(%s, %s, %p)\n",
97 debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
98
99 *BufPtr = NULL;
100
101 RpcTryExcept
102 {
103 status = NetrGetAnyDCName((PWSTR)ServerName,
104 (PWSTR)DomainName,
105 (PWSTR*)BufPtr);
106 }
107 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
108 {
109 status = I_RpcMapWin32Status(RpcExceptionCode());
110 }
111 RpcEndExcept;
112
113 return status;
114 }
115
116
117 NET_API_STATUS
118 WINAPI
119 NetGetDCName(
120 _In_ LPCWSTR servername,
121 _In_ LPCWSTR domainname,
122 _Out_ LPBYTE *bufptr)
123 {
124 FIXME("NetGetDCName(%s, %s, %p)\n",
125 debugstr_w(servername), debugstr_w(domainname), bufptr);
126
127 return NERR_DCNotFound;
128 }
129
130 /* EOF */