1 /* Copyright 2005 Ulrich Czekalla
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.
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.
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
24 #include "wine/debug.h"
25 #include "wine/heap.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi
);
30 /************************************************************
31 * WTSCloseServer (WTSAPI32.@)
33 void WINAPI
WTSCloseServer(HANDLE hServer
)
35 FIXME("Stub %p\n", hServer
);
38 /************************************************************
39 * WTSConnectSessionA (WTSAPI32.@)
41 BOOL WINAPI
WTSConnectSessionA(ULONG LogonId
, ULONG TargetLogonId
, PSTR pPassword
, BOOL bWait
)
43 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_a(pPassword
), bWait
);
47 /************************************************************
48 * WTSConnectSessionW (WTSAPI32.@)
50 BOOL WINAPI
WTSConnectSessionW(ULONG LogonId
, ULONG TargetLogonId
, PWSTR pPassword
, BOOL bWait
)
52 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_w(pPassword
), bWait
);
56 /************************************************************
57 * WTSDisconnectSession (WTSAPI32.@)
59 BOOL WINAPI
WTSDisconnectSession(HANDLE hServer
, DWORD SessionId
, BOOL bWait
)
61 FIXME("Stub %p 0x%08x %d\n", hServer
, SessionId
, bWait
);
65 /************************************************************
66 * WTSEnableChildSessions (WTSAPI32.@)
68 BOOL WINAPI
WTSEnableChildSessions(BOOL enable
)
70 FIXME("Stub %d\n", enable
);
75 /************************************************************
76 * WTSEnumerateProcessesExW (WTSAPI32.@)
78 BOOL WINAPI
WTSEnumerateProcessesExW(HANDLE server
, DWORD
*level
, DWORD session_id
, WCHAR
**info
, DWORD
*count
)
80 FIXME("Stub %p %p %d %p %p\n", server
, level
, session_id
, info
, count
);
81 if (count
) *count
= 0;
85 /************************************************************
86 * WTSEnumerateProcessesExA (WTSAPI32.@)
88 BOOL WINAPI
WTSEnumerateProcessesExA(HANDLE server
, DWORD
*level
, DWORD session_id
, char **info
, DWORD
*count
)
90 FIXME("Stub %p %p %d %p %p\n", server
, level
, session_id
, info
, count
);
91 if (count
) *count
= 0;
95 /************************************************************
96 * WTSEnumerateProcessesA (WTSAPI32.@)
98 BOOL WINAPI
WTSEnumerateProcessesA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
99 PWTS_PROCESS_INFOA
* ppProcessInfo
, DWORD
* pCount
)
101 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
102 ppProcessInfo
, pCount
);
104 if (!ppProcessInfo
|| !pCount
) return FALSE
;
107 *ppProcessInfo
= NULL
;
112 /************************************************************
113 * WTSEnumerateProcessesW (WTSAPI32.@)
115 BOOL WINAPI
WTSEnumerateProcessesW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
116 PWTS_PROCESS_INFOW
* ppProcessInfo
, DWORD
* pCount
)
118 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
119 ppProcessInfo
, pCount
);
121 if (!ppProcessInfo
|| !pCount
|| Reserved
!= 0 || Version
!= 1)
123 SetLastError(ERROR_INVALID_PARAMETER
);
128 *ppProcessInfo
= NULL
;
133 /************************************************************
134 * WTSEnumerateServersA (WTSAPI32.@)
136 BOOL WINAPI
WTSEnumerateServersA(LPSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOA
*ppServerInfo
, DWORD
*pCount
)
138 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
142 /************************************************************
143 * WTSEnumerateServersW (WTSAPI32.@)
145 BOOL WINAPI
WTSEnumerateServersW(LPWSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOW
*ppServerInfo
, DWORD
*pCount
)
147 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
152 /************************************************************
153 * WTSEnumerateEnumerateSessionsExW (WTSAPI32.@)
155 BOOL WINAPI
WTSEnumerateSessionsExW(HANDLE server
, DWORD
*level
, DWORD filter
, WTS_SESSION_INFO_1W
* info
, DWORD
*count
)
157 FIXME("Stub %p %p %d %p %p\n", server
, level
, filter
, info
, count
);
158 if (count
) *count
= 0;
162 /************************************************************
163 * WTSEnumerateEnumerateSessionsExA (WTSAPI32.@)
165 BOOL WINAPI
WTSEnumerateSessionsExA(HANDLE server
, DWORD
*level
, DWORD filter
, WTS_SESSION_INFO_1A
* info
, DWORD
*count
)
167 FIXME("Stub %p %p %d %p %p\n", server
, level
, filter
, info
, count
);
168 if (count
) *count
= 0;
172 /************************************************************
173 * WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
175 BOOL WINAPI
WTSEnumerateSessionsA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
176 PWTS_SESSION_INFOA
* ppSessionInfo
, DWORD
* pCount
)
180 if (!once
++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
181 ppSessionInfo
, pCount
);
183 if (!ppSessionInfo
|| !pCount
) return FALSE
;
186 *ppSessionInfo
= NULL
;
191 /************************************************************
192 * WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
194 BOOL WINAPI
WTSEnumerateSessionsW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
195 PWTS_SESSION_INFOW
* ppSessionInfo
, DWORD
* pCount
)
197 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
198 ppSessionInfo
, pCount
);
200 if (!ppSessionInfo
|| !pCount
) return FALSE
;
203 *ppSessionInfo
= NULL
;
208 /************************************************************
209 * WTSFreeMemory (WTSAPI32.@)
211 void WINAPI
WTSFreeMemory(PVOID pMemory
)
216 /************************************************************
217 * WTSFreeMemoryExA (WTSAPI32.@)
219 BOOL WINAPI
WTSFreeMemoryExA(WTS_TYPE_CLASS type
, void *ptr
, ULONG nmemb
)
221 TRACE("%d %p %d\n", type
, ptr
, nmemb
);
226 /************************************************************
227 * WTSFreeMemoryExW (WTSAPI32.@)
229 BOOL WINAPI
WTSFreeMemoryExW(WTS_TYPE_CLASS type
, void *ptr
, ULONG nmemb
)
231 TRACE("%d %p %d\n", type
, ptr
, nmemb
);
237 /************************************************************
238 * WTSLogoffSession (WTSAPI32.@)
240 BOOL WINAPI
WTSLogoffSession(HANDLE hserver
, DWORD session_id
, BOOL bwait
)
242 FIXME("(%p, 0x%x, %d): stub\n", hserver
, session_id
, bwait
);
243 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
248 /************************************************************
249 * WTSOpenServerExW (WTSAPI32.@)
251 HANDLE WINAPI
WTSOpenServerExW(WCHAR
*server_name
)
253 FIXME("(%s) stub\n", debugstr_w(server_name
));
254 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
258 /************************************************************
259 * WTSOpenServerExA (WTSAPI32.@)
261 HANDLE WINAPI
WTSOpenServerExA(char *server_name
)
263 FIXME("(%s) stub\n", debugstr_a(server_name
));
264 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
268 /************************************************************
269 * WTSOpenServerA (WTSAPI32.@)
271 HANDLE WINAPI
WTSOpenServerA(LPSTR pServerName
)
273 FIXME("(%s) stub\n", debugstr_a(pServerName
));
274 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
278 /************************************************************
279 * WTSOpenServerW (WTSAPI32.@)
281 HANDLE WINAPI
WTSOpenServerW(LPWSTR pServerName
)
283 FIXME("(%s) stub\n", debugstr_w(pServerName
));
284 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
288 /************************************************************
289 * WTSQuerySessionInformationA (WTSAPI32.@)
291 BOOL WINAPI
WTSQuerySessionInformationA(HANDLE server
, DWORD session_id
, WTS_INFO_CLASS
class, char **buffer
, DWORD
*count
)
293 WCHAR
*bufferW
= NULL
;
295 TRACE("%p 0x%08x %d %p %p\n", server
, session_id
, class, buffer
, count
);
297 if (!buffer
|| !count
)
299 SetLastError(ERROR_INVALID_USER_BUFFER
);
303 if (!WTSQuerySessionInformationW(server
, session_id
, class, &bufferW
, count
))
306 *count
= WideCharToMultiByte(CP_ACP
, 0, bufferW
, -1, NULL
, 0, NULL
, NULL
);
309 WTSFreeMemory(bufferW
);
313 if (!(*buffer
= heap_alloc(*count
)))
315 WTSFreeMemory(bufferW
);
319 if (!(*count
= WideCharToMultiByte(CP_ACP
, 0, bufferW
, -1, *buffer
, *count
, NULL
, NULL
)))
321 WTSFreeMemory(bufferW
);
326 WTSFreeMemory(bufferW
);
330 /************************************************************
331 * WTSQuerySessionInformationW (WTSAPI32.@)
333 BOOL WINAPI
WTSQuerySessionInformationW(
336 WTS_INFO_CLASS WTSInfoClass
,
338 DWORD
* BytesReturned
)
340 /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
341 FIXME("Stub %p 0x%08x %d %p %p\n", hServer
, SessionId
, WTSInfoClass
,
342 Buffer
, BytesReturned
);
344 if (!Buffer
|| !BytesReturned
)
346 SetLastError(ERROR_INVALID_USER_BUFFER
);
350 if (WTSInfoClass
== WTSUserName
)
355 GetUserNameW(NULL
, &count
);
356 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) return FALSE
;
357 if (!(username
= heap_alloc(count
* sizeof(WCHAR
)))) return FALSE
;
358 GetUserNameW(username
, &count
);
360 *BytesReturned
= count
* sizeof(WCHAR
);
371 /************************************************************
372 * WTSQueryUserToken (WTSAPI32.@)
374 BOOL WINAPI
WTSQueryUserToken(ULONG session_id
, PHANDLE token
)
376 FIXME("%u %p semi-stub!\n", session_id
, token
);
380 SetLastError(ERROR_INVALID_PARAMETER
);
384 return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
385 GetCurrentProcess(), token
,
386 0, FALSE
, DUPLICATE_SAME_ACCESS
);
389 /************************************************************
390 * WTSQueryUserConfigA (WTSAPI32.@)
392 BOOL WINAPI
WTSQueryUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR
*ppBuffer
, DWORD
*pBytesReturned
)
394 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,
395 ppBuffer
, pBytesReturned
);
399 /************************************************************
400 * WTSQueryUserConfigW (WTSAPI32.@)
402 BOOL WINAPI
WTSQueryUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR
*ppBuffer
, DWORD
*pBytesReturned
)
404 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,
405 ppBuffer
, pBytesReturned
);
410 /************************************************************
411 * WTSRegisterSessionNotification (WTSAPI32.@)
413 BOOL WINAPI
WTSRegisterSessionNotification(HWND hWnd
, DWORD dwFlags
)
415 FIXME("Stub %p 0x%08x\n", hWnd
, dwFlags
);
419 /************************************************************
420 * WTSRegisterSessionNotificationEx (WTSAPI32.@)
422 BOOL WINAPI
WTSRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
, DWORD dwFlags
)
424 FIXME("Stub %p %p 0x%08x\n", hServer
, hWnd
, dwFlags
);
429 /************************************************************
430 * WTSSendMessageA (WTSAPI32.@)
432 BOOL WINAPI
WTSSendMessageA(HANDLE hServer
, DWORD SessionId
, LPSTR pTitle
, DWORD TitleLength
, LPSTR pMessage
,
433 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
435 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
);
439 /************************************************************
440 * WTSSendMessageW (WTSAPI32.@)
442 BOOL WINAPI
WTSSendMessageW(HANDLE hServer
, DWORD SessionId
, LPWSTR pTitle
, DWORD TitleLength
, LPWSTR pMessage
,
443 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
445 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
);
449 /************************************************************
450 * WTSSetUserConfigA (WTSAPI32.@)
452 BOOL WINAPI
WTSSetUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR pBuffer
, DWORD DataLength
)
454 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
458 /************************************************************
459 * WTSSetUserConfigW (WTSAPI32.@)
461 BOOL WINAPI
WTSSetUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR pBuffer
, DWORD DataLength
)
463 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
467 /************************************************************
468 * WTSShutdownSystem (WTSAPI32.@)
470 BOOL WINAPI
WTSShutdownSystem(HANDLE hServer
, DWORD ShutdownFlag
)
472 FIXME("Stub %p 0x%08x\n", hServer
,ShutdownFlag
);
476 /************************************************************
477 * WTSStartRemoteControlSessionA (WTSAPI32.@)
479 BOOL WINAPI
WTSStartRemoteControlSessionA(LPSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
481 FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
485 /************************************************************
486 * WTSStartRemoteControlSessionW (WTSAPI32.@)
488 BOOL WINAPI
WTSStartRemoteControlSessionW(LPWSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
490 FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
494 /************************************************************
495 * WTSStopRemoteControlSession (WTSAPI32.@)
497 BOOL WINAPI
WTSStopRemoteControlSession(ULONG LogonId
)
499 FIXME("Stub %d\n", LogonId
);
503 /************************************************************
504 * WTSTerminateProcess (WTSAPI32.@)
506 BOOL WINAPI
WTSTerminateProcess(HANDLE hServer
, DWORD ProcessId
, DWORD ExitCode
)
508 FIXME("Stub %p %d %d\n", hServer
, ProcessId
, ExitCode
);
512 /************************************************************
513 * WTSUnRegisterSessionNotification (WTSAPI32.@)
515 BOOL WINAPI
WTSUnRegisterSessionNotification(HWND hWnd
)
517 FIXME("Stub %p\n", hWnd
);
521 /************************************************************
522 * WTSUnRegisterSessionNotification (WTSAPI32.@)
524 BOOL WINAPI
WTSUnRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
)
526 FIXME("Stub %p %p\n", hServer
, hWnd
);
531 /************************************************************
532 * WTSVirtualChannelClose (WTSAPI32.@)
534 BOOL WINAPI
WTSVirtualChannelClose(HANDLE hChannelHandle
)
536 FIXME("Stub %p\n", hChannelHandle
);
540 /************************************************************
541 * WTSVirtualChannelOpen (WTSAPI32.@)
543 HANDLE WINAPI
WTSVirtualChannelOpen(HANDLE hServer
, DWORD SessionId
, LPSTR pVirtualName
)
545 FIXME("Stub %p %d (%s)\n", hServer
, SessionId
, debugstr_a(pVirtualName
));
549 /************************************************************
550 * WTSVirtualChannelOpen (WTSAPI32.@)
552 HANDLE WINAPI
WTSVirtualChannelOpenEx(DWORD SessionId
, LPSTR pVirtualName
, DWORD flags
)
554 FIXME("Stub %d (%s) %d\n", SessionId
, debugstr_a(pVirtualName
), flags
);
558 /************************************************************
559 * WTSVirtualChannelPurgeInput (WTSAPI32.@)
561 BOOL WINAPI
WTSVirtualChannelPurgeInput(HANDLE hChannelHandle
)
563 FIXME("Stub %p\n", hChannelHandle
);
567 /************************************************************
568 * WTSVirtualChannelPurgeOutput (WTSAPI32.@)
570 BOOL WINAPI
WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle
)
572 FIXME("Stub %p\n", hChannelHandle
);
577 /************************************************************
578 * WTSVirtualChannelQuery (WTSAPI32.@)
580 BOOL WINAPI
WTSVirtualChannelQuery(HANDLE hChannelHandle
, WTS_VIRTUAL_CLASS WtsVirtualClass
, PVOID
*ppBuffer
, DWORD
*pBytesReturned
)
582 FIXME("Stub %p %d %p %p\n", hChannelHandle
, WtsVirtualClass
, ppBuffer
, pBytesReturned
);
586 /************************************************************
587 * WTSVirtualChannelRead (WTSAPI32.@)
589 BOOL WINAPI
WTSVirtualChannelRead(HANDLE hChannelHandle
, ULONG TimeOut
, PCHAR Buffer
, ULONG BufferSize
, PULONG pBytesRead
)
591 FIXME("Stub %p %d %p %d %p\n", hChannelHandle
, TimeOut
, Buffer
, BufferSize
, pBytesRead
);
595 /************************************************************
596 * WTSVirtualChannelWrite (WTSAPI32.@)
598 BOOL WINAPI
WTSVirtualChannelWrite(HANDLE hChannelHandle
, PCHAR Buffer
, ULONG Length
, PULONG pBytesWritten
)
600 FIXME("Stub %p %p %d %p\n", hChannelHandle
, Buffer
, Length
, pBytesWritten
);
604 /************************************************************
605 * WTSWaitSystemEvent (WTSAPI32.@)
607 BOOL WINAPI
WTSWaitSystemEvent(HANDLE hServer
, DWORD Mask
, DWORD
* Flags
)
609 /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
610 FIXME("Stub %p 0x%08x %p\n", hServer
, Mask
, Flags
);