xref: /reactos/dll/win32/wtsapi32/wtsapi32.c (revision 667d3934)
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 <stdarg.h>
19 #include <stdlib.h>
20 #include "ntstatus.h"
21 #define WIN32_NO_STATUS
22 #include "windef.h"
23 #include "winbase.h"
24 #include "wine/winternl.h"
25 #include "wtsapi32.h"
26 #include "wine/debug.h"
27 #include "wine/heap.h"
28 
29 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
30 
31 #ifdef __REACTOS__ /* FIXME: Inspect */
32 #define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3)
33 #endif
34 
35 /************************************************************
36  *                WTSCloseServer  (WTSAPI32.@)
37  */
WTSCloseServer(HANDLE hServer)38 void WINAPI WTSCloseServer(HANDLE hServer)
39 {
40     FIXME("Stub %p\n", hServer);
41 }
42 
43 /************************************************************
44  *                WTSConnectSessionA  (WTSAPI32.@)
45  */
WTSConnectSessionA(ULONG LogonId,ULONG TargetLogonId,PSTR pPassword,BOOL bWait)46 BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait)
47 {
48    FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_a(pPassword), bWait);
49    return TRUE;
50 }
51 
52 /************************************************************
53  *                WTSConnectSessionW  (WTSAPI32.@)
54  */
WTSConnectSessionW(ULONG LogonId,ULONG TargetLogonId,PWSTR pPassword,BOOL bWait)55 BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
56 {
57    FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_w(pPassword), bWait);
58    return TRUE;
59 }
60 
61 /************************************************************
62  *                WTSDisconnectSession  (WTSAPI32.@)
63  */
WTSDisconnectSession(HANDLE hServer,DWORD SessionId,BOOL bWait)64 BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
65 {
66     FIXME("Stub %p 0x%08x %d\n", hServer, SessionId, bWait);
67     return TRUE;
68 }
69 
70 /************************************************************
71  *                WTSEnableChildSessions  (WTSAPI32.@)
72  */
WTSEnableChildSessions(BOOL enable)73 BOOL WINAPI WTSEnableChildSessions(BOOL enable)
74 {
75     FIXME("Stub %d\n", enable);
76     return TRUE;
77 }
78 
79 
80 /************************************************************
81  *                WTSEnumerateProcessesExW  (WTSAPI32.@)
82  */
WTSEnumerateProcessesExW(HANDLE server,DWORD * level,DWORD session_id,WCHAR ** info,DWORD * count)83 BOOL WINAPI WTSEnumerateProcessesExW(HANDLE server, DWORD *level, DWORD session_id, WCHAR **info, DWORD *count)
84 {
85     FIXME("Stub %p %p %d %p %p\n", server, level, session_id, info, count);
86     if (count) *count = 0;
87     return FALSE;
88 }
89 
90 /************************************************************
91  *                WTSEnumerateProcessesExA  (WTSAPI32.@)
92  */
WTSEnumerateProcessesExA(HANDLE server,DWORD * level,DWORD session_id,char ** info,DWORD * count)93 BOOL WINAPI WTSEnumerateProcessesExA(HANDLE server, DWORD *level, DWORD session_id, char **info, DWORD *count)
94 {
95     FIXME("Stub %p %p %d %p %p\n", server, level, session_id, info, count);
96     if (count) *count = 0;
97     return FALSE;
98 }
99 
100 /************************************************************
101  *                WTSEnumerateProcessesA  (WTSAPI32.@)
102  */
WTSEnumerateProcessesA(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_PROCESS_INFOA * ppProcessInfo,DWORD * pCount)103 BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
104     PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
105 {
106     FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
107           ppProcessInfo, pCount);
108 
109     if (!ppProcessInfo || !pCount) return FALSE;
110 
111     *pCount = 0;
112     *ppProcessInfo = NULL;
113 
114     return TRUE;
115 }
116 
117 /************************************************************
118  *                WTSEnumerateProcessesW  (WTSAPI32.@)
119  */
WTSEnumerateProcessesW(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_PROCESS_INFOW * ppProcessInfo,DWORD * pCount)120 BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
121     PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
122 {
123     WTS_PROCESS_INFOW *processInfo;
124     SYSTEM_PROCESS_INFORMATION *spi;
125     ULONG size = 0x4000;
126     void *buf = NULL;
127     NTSTATUS status;
128     DWORD count;
129     WCHAR *name;
130 
131     if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
132     {
133         SetLastError(ERROR_INVALID_PARAMETER);
134         return FALSE;
135     }
136 
137     if (hServer != WTS_CURRENT_SERVER_HANDLE)
138     {
139         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
140         return FALSE;
141     }
142 
143     do
144     {
145         size *= 2;
146         HeapFree(GetProcessHeap(), 0, buf);
147         buf = HeapAlloc(GetProcessHeap(), 0, size);
148         if (!buf)
149         {
150             SetLastError(ERROR_OUTOFMEMORY);
151             return FALSE;
152         }
153         status = NtQuerySystemInformation(SystemProcessInformation, buf, size, NULL);
154     }
155     while (status == STATUS_INFO_LENGTH_MISMATCH);
156 
157     if (status != STATUS_SUCCESS)
158     {
159         HeapFree(GetProcessHeap(), 0, buf);
160         SetLastError(RtlNtStatusToDosError(status));
161         return FALSE;
162     }
163 
164     spi = buf;
165     count = size = 0;
166     for (;;)
167     {
168         size += sizeof(WTS_PROCESS_INFOW) + spi->ProcessName.Length + sizeof(WCHAR);
169         count++;
170         if (spi->NextEntryOffset == 0) break;
171         spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
172     }
173 
174     processInfo = HeapAlloc(GetProcessHeap(), 0, size);
175     if (!processInfo)
176     {
177         HeapFree(GetProcessHeap(), 0, buf);
178         SetLastError(ERROR_OUTOFMEMORY);
179         return FALSE;
180     }
181     name = (WCHAR *)&processInfo[count];
182 
183     *ppProcessInfo = processInfo;
184     *pCount = count;
185 
186     spi = buf;
187     while (count--)
188     {
189         processInfo->SessionId = 0;
190         processInfo->ProcessId = HandleToUlong(spi->UniqueProcessId);
191         processInfo->pProcessName = name;
192         processInfo->pUserSid = NULL;
193         memcpy( name, spi->ProcessName.Buffer, spi->ProcessName.Length );
194         name[ spi->ProcessName.Length/sizeof(WCHAR) ] = 0;
195 
196         processInfo++;
197         name += (spi->ProcessName.Length + sizeof(WCHAR))/sizeof(WCHAR);
198         spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
199     }
200 
201     HeapFree(GetProcessHeap(), 0, buf);
202     return TRUE;
203 }
204 
205 /************************************************************
206  *                WTSEnumerateServersA  (WTSAPI32.@)
207  */
WTSEnumerateServersA(LPSTR pDomainName,DWORD Reserved,DWORD Version,PWTS_SERVER_INFOA * ppServerInfo,DWORD * pCount)208 BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA *ppServerInfo, DWORD *pCount)
209 {
210     FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName), Reserved, Version, ppServerInfo, pCount);
211     return FALSE;
212 }
213 
214 /************************************************************
215  *                WTSEnumerateServersW  (WTSAPI32.@)
216  */
WTSEnumerateServersW(LPWSTR pDomainName,DWORD Reserved,DWORD Version,PWTS_SERVER_INFOW * ppServerInfo,DWORD * pCount)217 BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW *ppServerInfo, DWORD *pCount)
218 {
219     FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName), Reserved, Version, ppServerInfo, pCount);
220     return FALSE;
221 }
222 
223 
224 /************************************************************
225  *                WTSEnumerateEnumerateSessionsExW  (WTSAPI32.@)
226  */
WTSEnumerateSessionsExW(HANDLE server,DWORD * level,DWORD filter,WTS_SESSION_INFO_1W * info,DWORD * count)227 BOOL WINAPI WTSEnumerateSessionsExW(HANDLE server, DWORD *level, DWORD filter, WTS_SESSION_INFO_1W* info, DWORD *count)
228 {
229     FIXME("Stub %p %p %d %p %p\n", server, level, filter, info, count);
230     if (count) *count = 0;
231     return FALSE;
232 }
233 
234 /************************************************************
235  *                WTSEnumerateEnumerateSessionsExA  (WTSAPI32.@)
236  */
WTSEnumerateSessionsExA(HANDLE server,DWORD * level,DWORD filter,WTS_SESSION_INFO_1A * info,DWORD * count)237 BOOL WINAPI WTSEnumerateSessionsExA(HANDLE server, DWORD *level, DWORD filter, WTS_SESSION_INFO_1A* info, DWORD *count)
238 {
239     FIXME("Stub %p %p %d %p %p\n", server, level, filter, info, count);
240     if (count) *count = 0;
241     return FALSE;
242 }
243 
244 /************************************************************
245  *                WTSEnumerateEnumerateSessionsA  (WTSAPI32.@)
246  */
WTSEnumerateSessionsA(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_SESSION_INFOA * ppSessionInfo,DWORD * pCount)247 BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
248     PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
249 {
250     static int once;
251 
252     if (!once++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
253           ppSessionInfo, pCount);
254 
255     if (!ppSessionInfo || !pCount) return FALSE;
256 
257     *pCount = 0;
258     *ppSessionInfo = NULL;
259 
260     return TRUE;
261 }
262 
263 /************************************************************
264  *                WTSEnumerateEnumerateSessionsW  (WTSAPI32.@)
265  */
WTSEnumerateSessionsW(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_SESSION_INFOW * ppSessionInfo,DWORD * pCount)266 BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
267     PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
268 {
269     FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
270           ppSessionInfo, pCount);
271 
272     if (!ppSessionInfo || !pCount) return FALSE;
273 
274     *pCount = 0;
275     *ppSessionInfo = NULL;
276 
277     return TRUE;
278 }
279 
280 /************************************************************
281  *                WTSFreeMemory (WTSAPI32.@)
282  */
WTSFreeMemory(PVOID pMemory)283 void WINAPI WTSFreeMemory(PVOID pMemory)
284 {
285     heap_free(pMemory);
286 }
287 
288 /************************************************************
289  *                WTSFreeMemoryExA (WTSAPI32.@)
290  */
WTSFreeMemoryExA(WTS_TYPE_CLASS type,void * ptr,ULONG nmemb)291 BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
292 {
293     TRACE("%d %p %d\n", type, ptr, nmemb);
294     heap_free(ptr);
295     return TRUE;
296 }
297 
298 /************************************************************
299  *                WTSFreeMemoryExW (WTSAPI32.@)
300  */
WTSFreeMemoryExW(WTS_TYPE_CLASS type,void * ptr,ULONG nmemb)301 BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
302 {
303     TRACE("%d %p %d\n", type, ptr, nmemb);
304     heap_free(ptr);
305     return TRUE;
306 }
307 
308 
309 /************************************************************
310  *                WTSLogoffSession (WTSAPI32.@)
311  */
WTSLogoffSession(HANDLE hserver,DWORD session_id,BOOL bwait)312 BOOL WINAPI WTSLogoffSession(HANDLE hserver, DWORD session_id, BOOL bwait)
313 {
314     FIXME("(%p, 0x%x, %d): stub\n", hserver, session_id, bwait);
315     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
316     return FALSE;
317 }
318 
319 
320 /************************************************************
321  *                WTSOpenServerExW (WTSAPI32.@)
322  */
WTSOpenServerExW(WCHAR * server_name)323 HANDLE WINAPI WTSOpenServerExW(WCHAR *server_name)
324 {
325     FIXME("(%s) stub\n", debugstr_w(server_name));
326     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
327     return NULL;
328 }
329 
330 /************************************************************
331  *                WTSOpenServerExA (WTSAPI32.@)
332  */
WTSOpenServerExA(char * server_name)333 HANDLE WINAPI WTSOpenServerExA(char *server_name)
334 {
335     FIXME("(%s) stub\n", debugstr_a(server_name));
336     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
337     return NULL;
338 }
339 
340 /************************************************************
341  *                WTSOpenServerA (WTSAPI32.@)
342  */
WTSOpenServerA(LPSTR pServerName)343 HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
344 {
345     FIXME("(%s) stub\n", debugstr_a(pServerName));
346     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
347     return NULL;
348 }
349 
350 /************************************************************
351  *                WTSOpenServerW (WTSAPI32.@)
352  */
WTSOpenServerW(LPWSTR pServerName)353 HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
354 {
355     FIXME("(%s) stub\n", debugstr_w(pServerName));
356     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
357     return NULL;
358 }
359 
360 /************************************************************
361  *                WTSQuerySessionInformationA  (WTSAPI32.@)
362  */
WTSQuerySessionInformationA(HANDLE hServer,DWORD SessionId,WTS_INFO_CLASS WTSInfoClass,LPSTR * Buffer,DWORD * BytesReturned)363 BOOL WINAPI WTSQuerySessionInformationA(
364     HANDLE hServer,
365     DWORD SessionId,
366     WTS_INFO_CLASS WTSInfoClass,
367     LPSTR* Buffer,
368     DWORD* BytesReturned)
369 {
370 #ifdef __REACTOS__
371     const size_t wcsErrorCode = -1;
372     LPWSTR buffer = NULL;
373     LPSTR ansiBuffer = NULL;
374     DWORD bytesReturned = 0;
375     BOOL result = FALSE;
376     size_t len;
377 
378     if (!BytesReturned || !Buffer)
379     {
380         SetLastError(ERROR_INVALID_USER_BUFFER);
381         return FALSE;
382     }
383 
384     if (!WTSQuerySessionInformationW(hServer, SessionId, WTSInfoClass, &buffer, &bytesReturned))
385     {
386         ansiBuffer = (LPSTR)buffer;
387         *Buffer = ansiBuffer;
388         *BytesReturned = bytesReturned;
389         return FALSE;
390     }
391 
392     switch (WTSInfoClass)
393     {
394         case WTSInitialProgram:
395         case WTSApplicationName:
396         case WTSWorkingDirectory:
397         case WTSOEMId:
398         case WTSUserName:
399         case WTSWinStationName:
400         case WTSDomainName:
401         case WTSClientName:
402         case WTSClientDirectory:
403         {
404             len = wcstombs(NULL, buffer, 0);
405             if (len != wcsErrorCode)
406             {
407                 len++;
408                 ansiBuffer = heap_alloc_zero(len);
409                 if (ansiBuffer && (wcstombs(ansiBuffer, buffer, len) != wcsErrorCode))
410                 {
411                     result = TRUE;
412                     bytesReturned = len;
413                 }
414             }
415             WTSFreeMemory(buffer);
416             break;
417         }
418 
419         default:
420         {
421             result = TRUE;
422             ansiBuffer = (LPSTR)buffer;
423             break;
424         }
425     }
426 
427     *Buffer = ansiBuffer;
428     *BytesReturned = bytesReturned;
429 
430     return result;
431 #else
432     /* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
433     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
434         Buffer, BytesReturned);
435 
436     return FALSE;
437 #endif
438 }
439 
440 /************************************************************
441  *                WTSQuerySessionInformationW  (WTSAPI32.@)
442  */
WTSQuerySessionInformationW(HANDLE hServer,DWORD SessionId,WTS_INFO_CLASS WTSInfoClass,LPWSTR * Buffer,DWORD * BytesReturned)443 BOOL WINAPI WTSQuerySessionInformationW(
444     HANDLE hServer,
445     DWORD SessionId,
446     WTS_INFO_CLASS WTSInfoClass,
447     LPWSTR* Buffer,
448     DWORD* BytesReturned)
449 {
450 #ifdef __REACTOS__
451     if (!BytesReturned || !Buffer)
452     {
453         SetLastError(ERROR_INVALID_USER_BUFFER);
454         return FALSE;
455     }
456 
457 #if (NTDDI_VERSION >= NTDDI_WS08)
458     if (WTSInfoClass > WTSIsRemoteSession)
459 #else
460     if (WTSInfoClass > WTSClientProtocolType)
461 #endif
462     {
463         SetLastError(ERROR_INVALID_PARAMETER);
464         return FALSE;
465     }
466 
467     switch (WTSInfoClass)
468     {
469         case WTSSessionId:
470         {
471             const DWORD size = sizeof(ULONG);
472             ULONG* output = heap_alloc_zero(size);
473             if (!output)
474             {
475                 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
476                 return FALSE;
477             }
478 
479             *output = NtCurrentTeb()->Peb->SessionId;
480             *Buffer = (LPWSTR)output;
481             *BytesReturned = size;
482             return TRUE;
483         }
484 
485         case WTSUserName:
486         {
487             WCHAR* username;
488             DWORD count = 0;
489 
490             GetUserNameW(NULL, &count);
491             if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
492                 return FALSE;
493             username = heap_alloc(count * sizeof(WCHAR));
494             if (!username)
495             {
496                 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
497                 return FALSE;
498             }
499 
500             GetUserNameW(username, &count);
501             *Buffer = username;
502             *BytesReturned = count * sizeof(WCHAR);
503             return TRUE;
504         }
505 
506         case WTSConnectState:
507         {
508             const DWORD size = sizeof(DWORD);
509             WCHAR* output = heap_alloc_zero(size);
510             if (!output)
511             {
512                 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
513                 return FALSE;
514             }
515 
516             *Buffer = output;
517             *BytesReturned = size;
518             return TRUE;
519         }
520 
521         case WTSClientProtocolType:
522         {
523             const DWORD size = sizeof(WORD);
524             WCHAR* output = heap_alloc_zero(size);
525             if (!output)
526             {
527                 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
528                 return FALSE;
529             }
530 
531             *Buffer = output;
532             *BytesReturned = size;
533             return TRUE;
534         }
535 
536 #if (NTDDI_VERSION >= NTDDI_WS08)
537         case WTSIdleTime:
538         case WTSLogonTime:
539         case WTSIncomingBytes:
540         case WTSOutgoingBytes:
541         case WTSIncomingFrames:
542         case WTSOutgoingFrames:
543         {
544             SetLastError(ERROR_NOT_SUPPORTED);
545             return FALSE;
546         }
547 #endif /* (NTDDI_VERSION >= NTDDI_WS08) */
548 
549         default:
550         {
551             if (BytesReturned)
552                 *BytesReturned = 0;
553 
554             break;
555         }
556     }
557 
558     /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
559     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
560         Buffer, BytesReturned);
561 
562     return FALSE;
563 #else
564     /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
565     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
566         Buffer, BytesReturned);
567 
568     if (WTSInfoClass == WTSUserName)
569     {
570         WCHAR *username;
571         DWORD count = 0;
572 
573         GetUserNameW(NULL, &count);
574         if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
575         if (!(username = heap_alloc(count * sizeof(WCHAR)))) return FALSE;
576         GetUserNameW(username, &count);
577         *Buffer = username;
578         *BytesReturned = count * sizeof(WCHAR);
579         return TRUE;
580     }
581     return FALSE;
582 #endif
583 }
584 
585 /************************************************************
586  *                WTSQueryUserToken (WTSAPI32.@)
587  */
WTSQueryUserToken(ULONG session_id,PHANDLE token)588 BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
589 {
590     FIXME("%u %p semi-stub!\n", session_id, token);
591 
592     if (!token)
593     {
594         SetLastError(ERROR_INVALID_PARAMETER);
595         return FALSE;
596     }
597 
598     return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
599                            GetCurrentProcess(), token,
600                            0, FALSE, DUPLICATE_SAME_ACCESS);
601 }
602 
603 /************************************************************
604  *                WTSQueryUserConfigA (WTSAPI32.@)
605  */
WTSQueryUserConfigA(LPSTR pServerName,LPSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPSTR * ppBuffer,DWORD * pBytesReturned)606 BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
607 {
608    FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,
609         ppBuffer, pBytesReturned);
610    return FALSE;
611 }
612 
613 /************************************************************
614  *                WTSQueryUserConfigW (WTSAPI32.@)
615  */
WTSQueryUserConfigW(LPWSTR pServerName,LPWSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPWSTR * ppBuffer,DWORD * pBytesReturned)616 BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
617 {
618    FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,
619         ppBuffer, pBytesReturned);
620    return FALSE;
621 }
622 
623 
624 /************************************************************
625  *                WTSRegisterSessionNotification (WTSAPI32.@)
626  */
WTSRegisterSessionNotification(HWND hWnd,DWORD dwFlags)627 BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
628 {
629     FIXME("Stub %p 0x%08x\n", hWnd, dwFlags);
630     return TRUE;
631 }
632 
633 /************************************************************
634  *                WTSRegisterSessionNotificationEx (WTSAPI32.@)
635  */
WTSRegisterSessionNotificationEx(HANDLE hServer,HWND hWnd,DWORD dwFlags)636 BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags)
637 {
638     FIXME("Stub %p %p 0x%08x\n", hServer, hWnd, dwFlags);
639     return FALSE;
640 }
641 
642 
643 /************************************************************
644  *                WTSSendMessageA (WTSAPI32.@)
645  */
WTSSendMessageA(HANDLE hServer,DWORD SessionId,LPSTR pTitle,DWORD TitleLength,LPSTR pMessage,DWORD MessageLength,DWORD Style,DWORD Timeout,DWORD * pResponse,BOOL bWait)646 BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, LPSTR pMessage,
647    DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
648 {
649    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);
650    return FALSE;
651 }
652 
653 /************************************************************
654  *                WTSSendMessageW (WTSAPI32.@)
655  */
WTSSendMessageW(HANDLE hServer,DWORD SessionId,LPWSTR pTitle,DWORD TitleLength,LPWSTR pMessage,DWORD MessageLength,DWORD Style,DWORD Timeout,DWORD * pResponse,BOOL bWait)656 BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, LPWSTR pMessage,
657    DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
658 {
659    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);
660    return FALSE;
661 }
662 
663 /************************************************************
664  *                WTSSetUserConfigA (WTSAPI32.@)
665  */
WTSSetUserConfigA(LPSTR pServerName,LPSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPSTR pBuffer,DWORD DataLength)666 BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength)
667 {
668    FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,pBuffer, DataLength);
669    return FALSE;
670 }
671 
672 /************************************************************
673  *                WTSSetUserConfigW (WTSAPI32.@)
674  */
WTSSetUserConfigW(LPWSTR pServerName,LPWSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPWSTR pBuffer,DWORD DataLength)675 BOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
676 {
677    FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,pBuffer, DataLength);
678    return FALSE;
679 }
680 
681 /************************************************************
682  *                WTSShutdownSystem (WTSAPI32.@)
683  */
WTSShutdownSystem(HANDLE hServer,DWORD ShutdownFlag)684 BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
685 {
686    FIXME("Stub %p 0x%08x\n", hServer,ShutdownFlag);
687    return FALSE;
688 }
689 
690 /************************************************************
691  *                WTSStartRemoteControlSessionA (WTSAPI32.@)
692  */
WTSStartRemoteControlSessionA(LPSTR pTargetServerName,ULONG TargetLogonId,BYTE HotkeyVk,USHORT HotkeyModifiers)693 BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
694 {
695    FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
696    return FALSE;
697 }
698 
699 /************************************************************
700  *                WTSStartRemoteControlSessionW (WTSAPI32.@)
701  */
WTSStartRemoteControlSessionW(LPWSTR pTargetServerName,ULONG TargetLogonId,BYTE HotkeyVk,USHORT HotkeyModifiers)702 BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
703 {
704    FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
705    return FALSE;
706 }
707 
708 /************************************************************
709  *                WTSStopRemoteControlSession (WTSAPI32.@)
710  */
WTSStopRemoteControlSession(ULONG LogonId)711 BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId)
712 {
713    FIXME("Stub %d\n",  LogonId);
714    return FALSE;
715 }
716 
717 /************************************************************
718  *                WTSTerminateProcess (WTSAPI32.@)
719  */
WTSTerminateProcess(HANDLE hServer,DWORD ProcessId,DWORD ExitCode)720 BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
721 {
722    FIXME("Stub %p %d %d\n", hServer, ProcessId, ExitCode);
723    return FALSE;
724 }
725 
726 /************************************************************
727  *                WTSUnRegisterSessionNotification (WTSAPI32.@)
728  */
WTSUnRegisterSessionNotification(HWND hWnd)729 BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
730 {
731     FIXME("Stub %p\n", hWnd);
732     return FALSE;
733 }
734 
735 /************************************************************
736  *                WTSUnRegisterSessionNotification (WTSAPI32.@)
737  */
WTSUnRegisterSessionNotificationEx(HANDLE hServer,HWND hWnd)738 BOOL WINAPI WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd)
739 {
740     FIXME("Stub %p %p\n", hServer, hWnd);
741     return FALSE;
742 }
743 
744 
745 /************************************************************
746  *                WTSVirtualChannelClose (WTSAPI32.@)
747  */
WTSVirtualChannelClose(HANDLE hChannelHandle)748 BOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle)
749 {
750    FIXME("Stub %p\n", hChannelHandle);
751    return FALSE;
752 }
753 
754 /************************************************************
755  *                WTSVirtualChannelOpen (WTSAPI32.@)
756  */
WTSVirtualChannelOpen(HANDLE hServer,DWORD SessionId,LPSTR pVirtualName)757 HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
758 {
759    FIXME("Stub %p %d (%s)\n", hServer, SessionId, debugstr_a(pVirtualName));
760    return NULL;
761 }
762 
763 /************************************************************
764  *                WTSVirtualChannelOpen (WTSAPI32.@)
765  */
WTSVirtualChannelOpenEx(DWORD SessionId,LPSTR pVirtualName,DWORD flags)766 HANDLE WINAPI WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
767 {
768    FIXME("Stub %d (%s) %d\n",  SessionId, debugstr_a(pVirtualName), flags);
769    return NULL;
770 }
771 
772 /************************************************************
773  *                WTSVirtualChannelPurgeInput (WTSAPI32.@)
774  */
WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)775 BOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
776 {
777    FIXME("Stub %p\n", hChannelHandle);
778    return FALSE;
779 }
780 
781 /************************************************************
782  *                WTSVirtualChannelPurgeOutput (WTSAPI32.@)
783  */
WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)784 BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
785 {
786    FIXME("Stub %p\n", hChannelHandle);
787    return FALSE;
788 }
789 
790 
791 /************************************************************
792  *                WTSVirtualChannelQuery (WTSAPI32.@)
793  */
WTSVirtualChannelQuery(HANDLE hChannelHandle,WTS_VIRTUAL_CLASS WtsVirtualClass,PVOID * ppBuffer,DWORD * pBytesReturned)794 BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID *ppBuffer, DWORD *pBytesReturned)
795 {
796    FIXME("Stub %p %d %p %p\n", hChannelHandle, WtsVirtualClass, ppBuffer, pBytesReturned);
797    return FALSE;
798 }
799 
800 /************************************************************
801  *                WTSVirtualChannelRead (WTSAPI32.@)
802  */
WTSVirtualChannelRead(HANDLE hChannelHandle,ULONG TimeOut,PCHAR Buffer,ULONG BufferSize,PULONG pBytesRead)803 BOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
804 {
805    FIXME("Stub %p %d %p %d %p\n", hChannelHandle, TimeOut, Buffer, BufferSize, pBytesRead);
806    return FALSE;
807 }
808 
809 /************************************************************
810  *                WTSVirtualChannelWrite (WTSAPI32.@)
811  */
WTSVirtualChannelWrite(HANDLE hChannelHandle,PCHAR Buffer,ULONG Length,PULONG pBytesWritten)812 BOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
813 {
814    FIXME("Stub %p %p %d %p\n", hChannelHandle, Buffer, Length, pBytesWritten);
815    return FALSE;
816 }
817 
818 /************************************************************
819  *                WTSWaitSystemEvent (WTSAPI32.@)
820  */
WTSWaitSystemEvent(HANDLE hServer,DWORD Mask,DWORD * Flags)821 BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
822 {
823     /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
824     FIXME("Stub %p 0x%08x %p\n", hServer, Mask, Flags);
825     return FALSE;
826 }
827