xref: /reactos/dll/win32/wtsapi32/wtsapi32.c (revision 64daf542)
1 /* Copyright 2005 Ulrich Czekalla
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 #include <config.h>
19 #include <stdarg.h>
20 //#include <stdlib.h>
21 #include <ntstatus.h>
22 #define WIN32_NO_STATUS
23 #include <windef.h>
24 #include <winbase.h>
25 #include <wine/winternl.h>
26 #include <wtsapi32.h>
27 #include <wine/debug.h>
28 
29 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
30 
31 
32 /************************************************************
33  *                WTSCloseServer  (WTSAPI32.@)
34  */
35 void WINAPI WTSCloseServer(HANDLE hServer)
36 {
37     FIXME("Stub %p\n", hServer);
38 }
39 
40 /************************************************************
41  *                WTSConnectSessionA  (WTSAPI32.@)
42  */
43 BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait)
44 {
45    FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_a(pPassword), bWait);
46    return TRUE;
47 }
48 
49 /************************************************************
50  *                WTSConnectSessionW  (WTSAPI32.@)
51  */
52 BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
53 {
54    FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_w(pPassword), bWait);
55    return TRUE;
56 }
57 
58 /************************************************************
59  *                WTSDisconnectSession  (WTSAPI32.@)
60  */
61 BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
62 {
63     FIXME("Stub %p 0x%08x %d\n", hServer, SessionId, bWait);
64     return TRUE;
65 }
66 
67 /************************************************************
68  *                WTSEnableChildSessions  (WTSAPI32.@)
69  */
70 BOOL WINAPI WTSEnableChildSessions(BOOL enable)
71 {
72     FIXME("Stub %d\n", enable);
73     return TRUE;
74 }
75 
76 /************************************************************
77  *                WTSEnumerateProcessesA  (WTSAPI32.@)
78  */
79 BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
80     PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
81 {
82     FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
83           ppProcessInfo, pCount);
84 
85     if (!ppProcessInfo || !pCount) return FALSE;
86 
87     *pCount = 0;
88     *ppProcessInfo = NULL;
89 
90     return TRUE;
91 }
92 
93 /************************************************************
94  *                WTSEnumerateProcessesW  (WTSAPI32.@)
95  */
96 BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
97     PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
98 {
99     FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
100           ppProcessInfo, pCount);
101 
102     if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
103     {
104         SetLastError(ERROR_INVALID_PARAMETER);
105         return FALSE;
106     }
107 
108     *pCount = 0;
109     *ppProcessInfo = NULL;
110 
111     return TRUE;
112 }
113 
114 /************************************************************
115  *                WTSEnumerateServersA  (WTSAPI32.@)
116  */
117 BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA *ppServerInfo, DWORD *pCount)
118 {
119     FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName), Reserved, Version, ppServerInfo, pCount);
120     return FALSE;
121 }
122 
123 /************************************************************
124  *                WTSEnumerateServersW  (WTSAPI32.@)
125  */
126 BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW *ppServerInfo, DWORD *pCount)
127 {
128     FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName), Reserved, Version, ppServerInfo, pCount);
129     return FALSE;
130 }
131 
132 
133 /************************************************************
134  *                WTSEnumerateEnumerateSessionsA  (WTSAPI32.@)
135  */
136 BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
137     PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
138 {
139     static int once;
140 
141     if (!once++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
142           ppSessionInfo, pCount);
143 
144     if (!ppSessionInfo || !pCount) return FALSE;
145 
146     *pCount = 0;
147     *ppSessionInfo = NULL;
148 
149     return TRUE;
150 }
151 
152 /************************************************************
153  *                WTSEnumerateEnumerateSessionsW  (WTSAPI32.@)
154  */
155 BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
156     PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
157 {
158     FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
159           ppSessionInfo, pCount);
160 
161     if (!ppSessionInfo || !pCount) return FALSE;
162 
163     *pCount = 0;
164     *ppSessionInfo = NULL;
165 
166     return TRUE;
167 }
168 
169 /************************************************************
170  *                WTSFreeMemory (WTSAPI32.@)
171  */
172 void WINAPI WTSFreeMemory(PVOID pMemory)
173 {
174     static int once;
175 
176     if (!once++) FIXME("Stub %p\n", pMemory);
177 }
178 
179 /************************************************************
180  *                WTSLogoffSession (WTSAPI32.@)
181  */
182 BOOL WINAPI WTSLogoffSession(HANDLE hserver, DWORD session_id, BOOL bwait)
183 {
184     FIXME("(%p, 0x%x, %d): stub\n", hserver, session_id, bwait);
185     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
186     return FALSE;
187 }
188 
189 /************************************************************
190  *                WTSOpenServerA (WTSAPI32.@)
191  */
192 HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
193 {
194     FIXME("(%s) stub\n", debugstr_a(pServerName));
195     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
196     return NULL;
197 }
198 
199 /************************************************************
200  *                WTSOpenServerW (WTSAPI32.@)
201  */
202 HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
203 {
204     FIXME("(%s) stub\n", debugstr_w(pServerName));
205     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
206     return NULL;
207 }
208 
209 /************************************************************
210  *                WTSQuerySessionInformationA  (WTSAPI32.@)
211  */
212 BOOL WINAPI WTSQuerySessionInformationA(
213     HANDLE hServer,
214     DWORD SessionId,
215     WTS_INFO_CLASS WTSInfoClass,
216     LPSTR* Buffer,
217     DWORD* BytesReturned)
218 {
219     /* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
220     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
221         Buffer, BytesReturned);
222 
223     return FALSE;
224 }
225 
226 /************************************************************
227  *                WTSQuerySessionInformationW  (WTSAPI32.@)
228  */
229 BOOL WINAPI WTSQuerySessionInformationW(
230     HANDLE hServer,
231     DWORD SessionId,
232     WTS_INFO_CLASS WTSInfoClass,
233     LPWSTR* Buffer,
234     DWORD* BytesReturned)
235 {
236     /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
237     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
238         Buffer, BytesReturned);
239 
240     return FALSE;
241 }
242 
243 /************************************************************
244  *                WTSQueryUserToken (WTSAPI32.@)
245  */
246 BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
247 {
248     FIXME("%u %p\n", session_id, token);
249     return FALSE;
250 }
251 
252 /************************************************************
253  *                WTSQueryUserConfigA (WTSAPI32.@)
254  */
255 BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
256 {
257    FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,
258         ppBuffer, pBytesReturned);
259    return FALSE;
260 }
261 
262 /************************************************************
263  *                WTSQueryUserConfigW (WTSAPI32.@)
264  */
265 BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
266 {
267    FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,
268         ppBuffer, pBytesReturned);
269    return FALSE;
270 }
271 
272 
273 /************************************************************
274  *                WTSRegisterSessionNotification (WTSAPI32.@)
275  */
276 BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
277 {
278     FIXME("Stub %p 0x%08x\n", hWnd, dwFlags);
279     return TRUE;
280 }
281 
282 /************************************************************
283  *                WTSRegisterSessionNotificationEx (WTSAPI32.@)
284  */
285 BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags)
286 {
287     FIXME("Stub %p %p 0x%08x\n", hServer, hWnd, dwFlags);
288     return FALSE;
289 }
290 
291 
292 /************************************************************
293  *                WTSSendMessageA (WTSAPI32.@)
294  */
295 BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, LPSTR pMessage,
296    DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
297 {
298    FIXME("Stub %p 0x%08x (%s) %d (%s) %d 0x%08x %d %p %d\n", hServer, SessionId, debugstr_a(pTitle), TitleLength, debugstr_a(pMessage), MessageLength, Style, Timeout, pResponse, bWait);
299    return FALSE;
300 }
301 
302 /************************************************************
303  *                WTSSendMessageW (WTSAPI32.@)
304  */
305 BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, LPWSTR pMessage,
306    DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
307 {
308    FIXME("Stub %p 0x%08x (%s) %d (%s) %d 0x%08x %d %p %d\n", hServer, SessionId, debugstr_w(pTitle), TitleLength, debugstr_w(pMessage), MessageLength, Style, Timeout, pResponse, bWait);
309    return FALSE;
310 }
311 
312 /************************************************************
313  *                WTSSetUserConfigA (WTSAPI32.@)
314  */
315 BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength)
316 {
317    FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,pBuffer, DataLength);
318    return FALSE;
319 }
320 
321 /************************************************************
322  *                WTSSetUserConfigW (WTSAPI32.@)
323  */
324 BOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
325 {
326    FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,pBuffer, DataLength);
327    return FALSE;
328 }
329 
330 /************************************************************
331  *                WTSShutdownSystem (WTSAPI32.@)
332  */
333 BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
334 {
335    FIXME("Stub %p 0x%08x\n", hServer,ShutdownFlag);
336    return FALSE;
337 }
338 
339 /************************************************************
340  *                WTSStartRemoteControlSessionA (WTSAPI32.@)
341  */
342 BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
343 {
344    FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
345    return FALSE;
346 }
347 
348 /************************************************************
349  *                WTSStartRemoteControlSessionW (WTSAPI32.@)
350  */
351 BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
352 {
353    FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
354    return FALSE;
355 }
356 
357 /************************************************************
358  *                WTSStopRemoteControlSession (WTSAPI32.@)
359  */
360 BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId)
361 {
362    FIXME("Stub %d\n",  LogonId);
363    return FALSE;
364 }
365 
366 /************************************************************
367  *                WTSTerminateProcess (WTSAPI32.@)
368  */
369 BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
370 {
371    FIXME("Stub %p %d %d\n", hServer, ProcessId, ExitCode);
372    return FALSE;
373 }
374 
375 /************************************************************
376  *                WTSUnRegisterSessionNotification (WTSAPI32.@)
377  */
378 BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
379 {
380     FIXME("Stub %p\n", hWnd);
381     return FALSE;
382 }
383 
384 /************************************************************
385  *                WTSUnRegisterSessionNotification (WTSAPI32.@)
386  */
387 BOOL WINAPI WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd)
388 {
389     FIXME("Stub %p %p\n", hServer, hWnd);
390     return FALSE;
391 }
392 
393 
394 /************************************************************
395  *                WTSVirtualChannelClose (WTSAPI32.@)
396  */
397 BOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle)
398 {
399    FIXME("Stub %p\n", hChannelHandle);
400    return FALSE;
401 }
402 
403 /************************************************************
404  *                WTSVirtualChannelOpen (WTSAPI32.@)
405  */
406 HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
407 {
408    FIXME("Stub %p %d (%s)\n", hServer, SessionId, debugstr_a(pVirtualName));
409    return NULL;
410 }
411 
412 /************************************************************
413  *                WTSVirtualChannelOpen (WTSAPI32.@)
414  */
415 HANDLE WINAPI WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
416 {
417    FIXME("Stub %d (%s) %d\n",  SessionId, debugstr_a(pVirtualName), flags);
418    return NULL;
419 }
420 
421 /************************************************************
422  *                WTSVirtualChannelPurgeInput (WTSAPI32.@)
423  */
424 BOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
425 {
426    FIXME("Stub %p\n", hChannelHandle);
427    return FALSE;
428 }
429 
430 /************************************************************
431  *                WTSVirtualChannelPurgeOutput (WTSAPI32.@)
432  */
433 BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
434 {
435    FIXME("Stub %p\n", hChannelHandle);
436    return FALSE;
437 }
438 
439 
440 /************************************************************
441  *                WTSVirtualChannelQuery (WTSAPI32.@)
442  */
443 BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID *ppBuffer, DWORD *pBytesReturned)
444 {
445    FIXME("Stub %p %d %p %p\n", hChannelHandle, WtsVirtualClass, ppBuffer, pBytesReturned);
446    return FALSE;
447 }
448 
449 /************************************************************
450  *                WTSVirtualChannelRead (WTSAPI32.@)
451  */
452 BOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
453 {
454    FIXME("Stub %p %d %p %d %p\n", hChannelHandle, TimeOut, Buffer, BufferSize, pBytesRead);
455    return FALSE;
456 }
457 
458 /************************************************************
459  *                WTSVirtualChannelWrite (WTSAPI32.@)
460  */
461 BOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
462 {
463    FIXME("Stub %p %p %d %p\n", hChannelHandle, Buffer, Length, pBytesWritten);
464    return FALSE;
465 }
466 
467 /************************************************************
468  *                WTSWaitSystemEvent (WTSAPI32.@)
469  */
470 BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
471 {
472     /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
473     FIXME("Stub %p 0x%08x %p\n", hServer, Mask, Flags);
474     return FALSE;
475 }
476