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
25 #include "wine/debug.h"
26 #include "wine/heap.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi
);
31 /************************************************************
32 * WTSCloseServer (WTSAPI32.@)
34 void WINAPI
WTSCloseServer(HANDLE hServer
)
36 FIXME("Stub %p\n", hServer
);
39 /************************************************************
40 * WTSConnectSessionA (WTSAPI32.@)
42 BOOL WINAPI
WTSConnectSessionA(ULONG LogonId
, ULONG TargetLogonId
, PSTR pPassword
, BOOL bWait
)
44 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_a(pPassword
), bWait
);
48 /************************************************************
49 * WTSConnectSessionW (WTSAPI32.@)
51 BOOL WINAPI
WTSConnectSessionW(ULONG LogonId
, ULONG TargetLogonId
, PWSTR pPassword
, BOOL bWait
)
53 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_w(pPassword
), bWait
);
57 /************************************************************
58 * WTSDisconnectSession (WTSAPI32.@)
60 BOOL WINAPI
WTSDisconnectSession(HANDLE hServer
, DWORD SessionId
, BOOL bWait
)
62 FIXME("Stub %p 0x%08x %d\n", hServer
, SessionId
, bWait
);
66 /************************************************************
67 * WTSEnableChildSessions (WTSAPI32.@)
69 BOOL WINAPI
WTSEnableChildSessions(BOOL enable
)
71 FIXME("Stub %d\n", enable
);
76 /************************************************************
77 * WTSEnumerateProcessesExW (WTSAPI32.@)
79 BOOL WINAPI
WTSEnumerateProcessesExW(HANDLE server
, DWORD
*level
, DWORD session_id
, WCHAR
**info
, DWORD
*count
)
81 FIXME("Stub %p %p %d %p %p\n", server
, level
, session_id
, info
, count
);
82 if (count
) *count
= 0;
86 /************************************************************
87 * WTSEnumerateProcessesExA (WTSAPI32.@)
89 BOOL WINAPI
WTSEnumerateProcessesExA(HANDLE server
, DWORD
*level
, DWORD session_id
, char **info
, DWORD
*count
)
91 FIXME("Stub %p %p %d %p %p\n", server
, level
, session_id
, info
, count
);
92 if (count
) *count
= 0;
96 /************************************************************
97 * WTSEnumerateProcessesA (WTSAPI32.@)
99 BOOL WINAPI
WTSEnumerateProcessesA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
100 PWTS_PROCESS_INFOA
* ppProcessInfo
, DWORD
* pCount
)
102 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
103 ppProcessInfo
, pCount
);
105 if (!ppProcessInfo
|| !pCount
) return FALSE
;
108 *ppProcessInfo
= NULL
;
113 /************************************************************
114 * WTSEnumerateProcessesW (WTSAPI32.@)
116 BOOL WINAPI
WTSEnumerateProcessesW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
117 PWTS_PROCESS_INFOW
* ppProcessInfo
, DWORD
* pCount
)
119 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
120 ppProcessInfo
, pCount
);
122 if (!ppProcessInfo
|| !pCount
|| Reserved
!= 0 || Version
!= 1)
124 SetLastError(ERROR_INVALID_PARAMETER
);
129 *ppProcessInfo
= NULL
;
134 /************************************************************
135 * WTSEnumerateServersA (WTSAPI32.@)
137 BOOL WINAPI
WTSEnumerateServersA(LPSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOA
*ppServerInfo
, DWORD
*pCount
)
139 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
143 /************************************************************
144 * WTSEnumerateServersW (WTSAPI32.@)
146 BOOL WINAPI
WTSEnumerateServersW(LPWSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOW
*ppServerInfo
, DWORD
*pCount
)
148 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
153 /************************************************************
154 * WTSEnumerateEnumerateSessionsExW (WTSAPI32.@)
156 BOOL WINAPI
WTSEnumerateSessionsExW(HANDLE server
, DWORD
*level
, DWORD filter
, WTS_SESSION_INFO_1W
* info
, DWORD
*count
)
158 FIXME("Stub %p %p %d %p %p\n", server
, level
, filter
, info
, count
);
159 if (count
) *count
= 0;
163 /************************************************************
164 * WTSEnumerateEnumerateSessionsExA (WTSAPI32.@)
166 BOOL WINAPI
WTSEnumerateSessionsExA(HANDLE server
, DWORD
*level
, DWORD filter
, WTS_SESSION_INFO_1A
* info
, DWORD
*count
)
168 FIXME("Stub %p %p %d %p %p\n", server
, level
, filter
, info
, count
);
169 if (count
) *count
= 0;
173 /************************************************************
174 * WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
176 BOOL WINAPI
WTSEnumerateSessionsA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
177 PWTS_SESSION_INFOA
* ppSessionInfo
, DWORD
* pCount
)
181 if (!once
++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
182 ppSessionInfo
, pCount
);
184 if (!ppSessionInfo
|| !pCount
) return FALSE
;
187 *ppSessionInfo
= NULL
;
192 /************************************************************
193 * WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
195 BOOL WINAPI
WTSEnumerateSessionsW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
196 PWTS_SESSION_INFOW
* ppSessionInfo
, DWORD
* pCount
)
198 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
199 ppSessionInfo
, pCount
);
201 if (!ppSessionInfo
|| !pCount
) return FALSE
;
204 *ppSessionInfo
= NULL
;
209 /************************************************************
210 * WTSFreeMemory (WTSAPI32.@)
212 void WINAPI
WTSFreeMemory(PVOID pMemory
)
217 /************************************************************
218 * WTSFreeMemoryExA (WTSAPI32.@)
220 BOOL WINAPI
WTSFreeMemoryExA(WTS_TYPE_CLASS type
, void *ptr
, ULONG nmemb
)
222 TRACE("%d %p %d\n", type
, ptr
, nmemb
);
227 /************************************************************
228 * WTSFreeMemoryExW (WTSAPI32.@)
230 BOOL WINAPI
WTSFreeMemoryExW(WTS_TYPE_CLASS type
, void *ptr
, ULONG nmemb
)
232 TRACE("%d %p %d\n", type
, ptr
, nmemb
);
238 /************************************************************
239 * WTSLogoffSession (WTSAPI32.@)
241 BOOL WINAPI
WTSLogoffSession(HANDLE hserver
, DWORD session_id
, BOOL bwait
)
243 FIXME("(%p, 0x%x, %d): stub\n", hserver
, session_id
, bwait
);
244 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
249 /************************************************************
250 * WTSOpenServerExW (WTSAPI32.@)
252 HANDLE WINAPI
WTSOpenServerExW(WCHAR
*server_name
)
254 FIXME("(%s) stub\n", debugstr_w(server_name
));
255 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
259 /************************************************************
260 * WTSOpenServerExA (WTSAPI32.@)
262 HANDLE WINAPI
WTSOpenServerExA(char *server_name
)
264 FIXME("(%s) stub\n", debugstr_a(server_name
));
265 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
269 /************************************************************
270 * WTSOpenServerA (WTSAPI32.@)
272 HANDLE WINAPI
WTSOpenServerA(LPSTR pServerName
)
274 FIXME("(%s) stub\n", debugstr_a(pServerName
));
275 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
279 /************************************************************
280 * WTSOpenServerW (WTSAPI32.@)
282 HANDLE WINAPI
WTSOpenServerW(LPWSTR pServerName
)
284 FIXME("(%s) stub\n", debugstr_w(pServerName
));
285 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
289 /************************************************************
290 * WTSQuerySessionInformationA (WTSAPI32.@)
292 BOOL WINAPI
WTSQuerySessionInformationA(HANDLE server
, DWORD session_id
, WTS_INFO_CLASS
class, char **buffer
, DWORD
*count
)
294 WCHAR
*bufferW
= NULL
;
296 TRACE("%p 0x%08x %d %p %p\n", server
, session_id
, class, buffer
, count
);
298 if (!buffer
|| !count
)
300 SetLastError(ERROR_INVALID_USER_BUFFER
);
304 if (!WTSQuerySessionInformationW(server
, session_id
, class, &bufferW
, count
))
307 *count
= WideCharToMultiByte(CP_ACP
, 0, bufferW
, -1, NULL
, 0, NULL
, NULL
);
310 WTSFreeMemory(bufferW
);
314 if (!(*buffer
= heap_alloc(*count
)))
316 WTSFreeMemory(bufferW
);
320 if (!(*count
= WideCharToMultiByte(CP_ACP
, 0, bufferW
, -1, *buffer
, *count
, NULL
, NULL
)))
322 WTSFreeMemory(bufferW
);
327 WTSFreeMemory(bufferW
);
331 /************************************************************
332 * WTSQuerySessionInformationW (WTSAPI32.@)
334 BOOL WINAPI
WTSQuerySessionInformationW(HANDLE server
, DWORD session_id
, WTS_INFO_CLASS
class, WCHAR
**buffer
, DWORD
*count
)
336 TRACE("%p 0x%08x %d %p %p\n", server
, session_id
, class, buffer
, count
);
338 if (!buffer
|| !count
)
340 SetLastError(ERROR_INVALID_USER_BUFFER
);
344 if (class == WTSUserName
)
346 DWORD size
= UNLEN
+ 1;
349 if (!(username
= heap_alloc(size
* sizeof(WCHAR
)))) return FALSE
;
350 GetUserNameW(username
, &size
);
352 *count
= size
* sizeof(WCHAR
);
356 if (class == WTSDomainName
)
358 DWORD size
= MAX_COMPUTERNAME_LENGTH
+ 1;
361 if (!(computername
= heap_alloc(size
* sizeof(WCHAR
)))) return FALSE
;
362 GetComputerNameW(computername
, &size
);
363 *buffer
= computername
;
364 /* GetComputerNameW() return size doesn't include terminator */
366 *count
= size
* sizeof(WCHAR
);
370 FIXME("Unimplemented class %d\n", class);
377 /************************************************************
378 * WTSQueryUserToken (WTSAPI32.@)
380 BOOL WINAPI
WTSQueryUserToken(ULONG session_id
, PHANDLE token
)
382 FIXME("%u %p semi-stub!\n", session_id
, token
);
386 SetLastError(ERROR_INVALID_PARAMETER
);
390 return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
391 GetCurrentProcess(), token
,
392 0, FALSE
, DUPLICATE_SAME_ACCESS
);
395 /************************************************************
396 * WTSQueryUserConfigA (WTSAPI32.@)
398 BOOL WINAPI
WTSQueryUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR
*ppBuffer
, DWORD
*pBytesReturned
)
400 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,
401 ppBuffer
, pBytesReturned
);
405 /************************************************************
406 * WTSQueryUserConfigW (WTSAPI32.@)
408 BOOL WINAPI
WTSQueryUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR
*ppBuffer
, DWORD
*pBytesReturned
)
410 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,
411 ppBuffer
, pBytesReturned
);
416 /************************************************************
417 * WTSRegisterSessionNotification (WTSAPI32.@)
419 BOOL WINAPI
WTSRegisterSessionNotification(HWND hWnd
, DWORD dwFlags
)
421 FIXME("Stub %p 0x%08x\n", hWnd
, dwFlags
);
425 /************************************************************
426 * WTSRegisterSessionNotificationEx (WTSAPI32.@)
428 BOOL WINAPI
WTSRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
, DWORD dwFlags
)
430 FIXME("Stub %p %p 0x%08x\n", hServer
, hWnd
, dwFlags
);
435 /************************************************************
436 * WTSSendMessageA (WTSAPI32.@)
438 BOOL WINAPI
WTSSendMessageA(HANDLE hServer
, DWORD SessionId
, LPSTR pTitle
, DWORD TitleLength
, LPSTR pMessage
,
439 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
441 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
);
445 /************************************************************
446 * WTSSendMessageW (WTSAPI32.@)
448 BOOL WINAPI
WTSSendMessageW(HANDLE hServer
, DWORD SessionId
, LPWSTR pTitle
, DWORD TitleLength
, LPWSTR pMessage
,
449 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
451 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
);
455 /************************************************************
456 * WTSSetUserConfigA (WTSAPI32.@)
458 BOOL WINAPI
WTSSetUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR pBuffer
, DWORD DataLength
)
460 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
464 /************************************************************
465 * WTSSetUserConfigW (WTSAPI32.@)
467 BOOL WINAPI
WTSSetUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR pBuffer
, DWORD DataLength
)
469 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
473 /************************************************************
474 * WTSShutdownSystem (WTSAPI32.@)
476 BOOL WINAPI
WTSShutdownSystem(HANDLE hServer
, DWORD ShutdownFlag
)
478 FIXME("Stub %p 0x%08x\n", hServer
,ShutdownFlag
);
482 /************************************************************
483 * WTSStartRemoteControlSessionA (WTSAPI32.@)
485 BOOL WINAPI
WTSStartRemoteControlSessionA(LPSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
487 FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
491 /************************************************************
492 * WTSStartRemoteControlSessionW (WTSAPI32.@)
494 BOOL WINAPI
WTSStartRemoteControlSessionW(LPWSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
496 FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
500 /************************************************************
501 * WTSStopRemoteControlSession (WTSAPI32.@)
503 BOOL WINAPI
WTSStopRemoteControlSession(ULONG LogonId
)
505 FIXME("Stub %d\n", LogonId
);
509 /************************************************************
510 * WTSTerminateProcess (WTSAPI32.@)
512 BOOL WINAPI
WTSTerminateProcess(HANDLE hServer
, DWORD ProcessId
, DWORD ExitCode
)
514 FIXME("Stub %p %d %d\n", hServer
, ProcessId
, ExitCode
);
518 /************************************************************
519 * WTSUnRegisterSessionNotification (WTSAPI32.@)
521 BOOL WINAPI
WTSUnRegisterSessionNotification(HWND hWnd
)
523 FIXME("Stub %p\n", hWnd
);
527 /************************************************************
528 * WTSUnRegisterSessionNotification (WTSAPI32.@)
530 BOOL WINAPI
WTSUnRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
)
532 FIXME("Stub %p %p\n", hServer
, hWnd
);
537 /************************************************************
538 * WTSVirtualChannelClose (WTSAPI32.@)
540 BOOL WINAPI
WTSVirtualChannelClose(HANDLE hChannelHandle
)
542 FIXME("Stub %p\n", hChannelHandle
);
546 /************************************************************
547 * WTSVirtualChannelOpen (WTSAPI32.@)
549 HANDLE WINAPI
WTSVirtualChannelOpen(HANDLE hServer
, DWORD SessionId
, LPSTR pVirtualName
)
551 FIXME("Stub %p %d (%s)\n", hServer
, SessionId
, debugstr_a(pVirtualName
));
555 /************************************************************
556 * WTSVirtualChannelOpen (WTSAPI32.@)
558 HANDLE WINAPI
WTSVirtualChannelOpenEx(DWORD SessionId
, LPSTR pVirtualName
, DWORD flags
)
560 FIXME("Stub %d (%s) %d\n", SessionId
, debugstr_a(pVirtualName
), flags
);
564 /************************************************************
565 * WTSVirtualChannelPurgeInput (WTSAPI32.@)
567 BOOL WINAPI
WTSVirtualChannelPurgeInput(HANDLE hChannelHandle
)
569 FIXME("Stub %p\n", hChannelHandle
);
573 /************************************************************
574 * WTSVirtualChannelPurgeOutput (WTSAPI32.@)
576 BOOL WINAPI
WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle
)
578 FIXME("Stub %p\n", hChannelHandle
);
583 /************************************************************
584 * WTSVirtualChannelQuery (WTSAPI32.@)
586 BOOL WINAPI
WTSVirtualChannelQuery(HANDLE hChannelHandle
, WTS_VIRTUAL_CLASS WtsVirtualClass
, PVOID
*ppBuffer
, DWORD
*pBytesReturned
)
588 FIXME("Stub %p %d %p %p\n", hChannelHandle
, WtsVirtualClass
, ppBuffer
, pBytesReturned
);
592 /************************************************************
593 * WTSVirtualChannelRead (WTSAPI32.@)
595 BOOL WINAPI
WTSVirtualChannelRead(HANDLE hChannelHandle
, ULONG TimeOut
, PCHAR Buffer
, ULONG BufferSize
, PULONG pBytesRead
)
597 FIXME("Stub %p %d %p %d %p\n", hChannelHandle
, TimeOut
, Buffer
, BufferSize
, pBytesRead
);
601 /************************************************************
602 * WTSVirtualChannelWrite (WTSAPI32.@)
604 BOOL WINAPI
WTSVirtualChannelWrite(HANDLE hChannelHandle
, PCHAR Buffer
, ULONG Length
, PULONG pBytesWritten
)
606 FIXME("Stub %p %p %d %p\n", hChannelHandle
, Buffer
, Length
, pBytesWritten
);
610 /************************************************************
611 * WTSWaitSystemEvent (WTSAPI32.@)
613 BOOL WINAPI
WTSWaitSystemEvent(HANDLE hServer
, DWORD Mask
, DWORD
* Flags
)
615 /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
616 FIXME("Stub %p 0x%08x %p\n", hServer
, Mask
, Flags
);