[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 NET_API_FUNCTION
143 NetGetJoinInformation(
144 LPCWSTR Server,
145 LPWSTR *Name,
146 PNETSETUP_JOIN_STATUS type)
147 {
148 NET_API_STATUS status;
149
150 FIXME("Stub %s %p %p\n", wine_dbgstr_w(Server), Name, type);
151
152 if (Name == NULL || type == NULL)
153 return ERROR_INVALID_PARAMETER;
154
155 RpcTryExcept
156 {
157 status = NetrGetJoinInformation((LPWSTR)Server,
158 Name,
159 type);
160 }
161 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
162 {
163 status = I_RpcMapWin32Status(RpcExceptionCode());
164 }
165 RpcEndExcept;
166
167 return status;
168 }
169
170
171 NET_API_STATUS
172 WINAPI
173 NetWkstaGetInfo(
174 LMSTR servername,
175 DWORD level,
176 LPBYTE *bufptr)
177 {
178 NET_API_STATUS status;
179
180 *bufptr = NULL;
181
182 RpcTryExcept
183 {
184 status = NetrWkstaGetInfo(servername,
185 level,
186 (LPWKSTA_INFO)bufptr);
187 }
188 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
189 {
190 status = I_RpcMapWin32Status(RpcExceptionCode());
191 }
192 RpcEndExcept;
193
194 return status;
195 }
196
197 /* EOF */