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
22 #define WIN32_NO_STATUS
25 #include <wine/winternl.h>
27 #include <wine/debug.h>
29 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi
);
32 /************************************************************
33 * WTSCloseServer (WTSAPI32.@)
35 void WINAPI
WTSCloseServer(HANDLE hServer
)
37 FIXME("Stub %p\n", hServer
);
40 /************************************************************
41 * WTSConnectSessionA (WTSAPI32.@)
43 BOOL WINAPI
WTSConnectSessionA(ULONG LogonId
, ULONG TargetLogonId
, PSTR pPassword
, BOOL bWait
)
45 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_a(pPassword
), bWait
);
49 /************************************************************
50 * WTSConnectSessionW (WTSAPI32.@)
52 BOOL WINAPI
WTSConnectSessionW(ULONG LogonId
, ULONG TargetLogonId
, PWSTR pPassword
, BOOL bWait
)
54 FIXME("Stub %d %d (%s) %d\n", LogonId
, TargetLogonId
, debugstr_w(pPassword
), bWait
);
58 /************************************************************
59 * WTSDisconnectSession (WTSAPI32.@)
61 BOOL WINAPI
WTSDisconnectSession(HANDLE hServer
, DWORD SessionId
, BOOL bWait
)
63 FIXME("Stub %p 0x%08x %d\n", hServer
, SessionId
, bWait
);
67 /************************************************************
68 * WTSEnableChildSessions (WTSAPI32.@)
70 BOOL WINAPI
WTSEnableChildSessions(BOOL enable
)
72 FIXME("Stub %d\n", enable
);
76 /************************************************************
77 * WTSEnumerateProcessesA (WTSAPI32.@)
79 BOOL WINAPI
WTSEnumerateProcessesA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
80 PWTS_PROCESS_INFOA
* ppProcessInfo
, DWORD
* pCount
)
82 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
83 ppProcessInfo
, pCount
);
85 if (!ppProcessInfo
|| !pCount
) return FALSE
;
88 *ppProcessInfo
= NULL
;
93 /************************************************************
94 * WTSEnumerateProcessesW (WTSAPI32.@)
96 BOOL WINAPI
WTSEnumerateProcessesW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
97 PWTS_PROCESS_INFOW
* ppProcessInfo
, DWORD
* pCount
)
99 WTS_PROCESS_INFOW
*processInfo
;
100 SYSTEM_PROCESS_INFORMATION
*spi
;
107 if (!ppProcessInfo
|| !pCount
|| Reserved
!= 0 || Version
!= 1)
109 SetLastError(ERROR_INVALID_PARAMETER
);
113 if (hServer
!= WTS_CURRENT_SERVER_HANDLE
)
115 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
122 HeapFree(GetProcessHeap(), 0, buf
);
123 buf
= HeapAlloc(GetProcessHeap(), 0, size
);
126 SetLastError(ERROR_OUTOFMEMORY
);
129 status
= NtQuerySystemInformation(SystemProcessInformation
, buf
, size
, NULL
);
131 while (status
== STATUS_INFO_LENGTH_MISMATCH
);
133 if (status
!= STATUS_SUCCESS
)
135 HeapFree(GetProcessHeap(), 0, buf
);
136 SetLastError(RtlNtStatusToDosError(status
));
144 size
+= sizeof(WTS_PROCESS_INFOW
) + spi
->ProcessName
.Length
+ sizeof(WCHAR
);
146 if (spi
->NextEntryOffset
== 0) break;
147 spi
= (SYSTEM_PROCESS_INFORMATION
*)(((PCHAR
)spi
) + spi
->NextEntryOffset
);
150 processInfo
= HeapAlloc(GetProcessHeap(), 0, size
);
153 HeapFree(GetProcessHeap(), 0, buf
);
154 SetLastError(ERROR_OUTOFMEMORY
);
157 name
= (WCHAR
*)&processInfo
[count
];
159 *ppProcessInfo
= processInfo
;
165 processInfo
->SessionId
= 0;
166 processInfo
->ProcessId
= HandleToUlong(spi
->UniqueProcessId
);
167 processInfo
->pProcessName
= name
;
168 processInfo
->pUserSid
= NULL
;
169 memcpy( name
, spi
->ProcessName
.Buffer
, spi
->ProcessName
.Length
);
170 name
[ spi
->ProcessName
.Length
/sizeof(WCHAR
) ] = 0;
173 name
+= (spi
->ProcessName
.Length
+ sizeof(WCHAR
))/sizeof(WCHAR
);
174 spi
= (SYSTEM_PROCESS_INFORMATION
*)(((PCHAR
)spi
) + spi
->NextEntryOffset
);
177 HeapFree(GetProcessHeap(), 0, buf
);
181 /************************************************************
182 * WTSEnumerateServersA (WTSAPI32.@)
184 BOOL WINAPI
WTSEnumerateServersA(LPSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOA
*ppServerInfo
, DWORD
*pCount
)
186 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
190 /************************************************************
191 * WTSEnumerateServersW (WTSAPI32.@)
193 BOOL WINAPI
WTSEnumerateServersW(LPWSTR pDomainName
, DWORD Reserved
, DWORD Version
, PWTS_SERVER_INFOW
*ppServerInfo
, DWORD
*pCount
)
195 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName
), Reserved
, Version
, ppServerInfo
, pCount
);
200 /************************************************************
201 * WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
203 BOOL WINAPI
WTSEnumerateSessionsA(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
204 PWTS_SESSION_INFOA
* ppSessionInfo
, DWORD
* pCount
)
208 if (!once
++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
209 ppSessionInfo
, pCount
);
211 if (!ppSessionInfo
|| !pCount
) return FALSE
;
214 *ppSessionInfo
= NULL
;
219 /************************************************************
220 * WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
222 BOOL WINAPI
WTSEnumerateSessionsW(HANDLE hServer
, DWORD Reserved
, DWORD Version
,
223 PWTS_SESSION_INFOW
* ppSessionInfo
, DWORD
* pCount
)
225 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer
, Reserved
, Version
,
226 ppSessionInfo
, pCount
);
228 if (!ppSessionInfo
|| !pCount
) return FALSE
;
231 *ppSessionInfo
= NULL
;
236 /************************************************************
237 * WTSFreeMemory (WTSAPI32.@)
239 void WINAPI
WTSFreeMemory(PVOID pMemory
)
241 HeapFree(GetProcessHeap(), 0, pMemory
);
244 /************************************************************
245 * WTSLogoffSession (WTSAPI32.@)
247 BOOL WINAPI
WTSLogoffSession(HANDLE hserver
, DWORD session_id
, BOOL bwait
)
249 FIXME("(%p, 0x%x, %d): stub\n", hserver
, session_id
, bwait
);
250 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
254 /************************************************************
255 * WTSOpenServerA (WTSAPI32.@)
257 HANDLE WINAPI
WTSOpenServerA(LPSTR pServerName
)
259 FIXME("(%s) stub\n", debugstr_a(pServerName
));
260 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
264 /************************************************************
265 * WTSOpenServerW (WTSAPI32.@)
267 HANDLE WINAPI
WTSOpenServerW(LPWSTR pServerName
)
269 FIXME("(%s) stub\n", debugstr_w(pServerName
));
270 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
274 /************************************************************
275 * WTSQuerySessionInformationA (WTSAPI32.@)
277 BOOL WINAPI
WTSQuerySessionInformationA(
280 WTS_INFO_CLASS WTSInfoClass
,
282 DWORD
* BytesReturned
)
284 /* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
285 FIXME("Stub %p 0x%08x %d %p %p\n", hServer
, SessionId
, WTSInfoClass
,
286 Buffer
, BytesReturned
);
291 /************************************************************
292 * WTSQuerySessionInformationW (WTSAPI32.@)
294 BOOL WINAPI
WTSQuerySessionInformationW(
297 WTS_INFO_CLASS WTSInfoClass
,
299 DWORD
* BytesReturned
)
301 /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
302 FIXME("Stub %p 0x%08x %d %p %p\n", hServer
, SessionId
, WTSInfoClass
,
303 Buffer
, BytesReturned
);
308 /************************************************************
309 * WTSQueryUserToken (WTSAPI32.@)
311 BOOL WINAPI
WTSQueryUserToken(ULONG session_id
, PHANDLE token
)
313 FIXME("%u %p\n", session_id
, token
);
317 /************************************************************
318 * WTSQueryUserConfigA (WTSAPI32.@)
320 BOOL WINAPI
WTSQueryUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR
*ppBuffer
, DWORD
*pBytesReturned
)
322 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,
323 ppBuffer
, pBytesReturned
);
327 /************************************************************
328 * WTSQueryUserConfigW (WTSAPI32.@)
330 BOOL WINAPI
WTSQueryUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR
*ppBuffer
, DWORD
*pBytesReturned
)
332 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,
333 ppBuffer
, pBytesReturned
);
338 /************************************************************
339 * WTSRegisterSessionNotification (WTSAPI32.@)
341 BOOL WINAPI
WTSRegisterSessionNotification(HWND hWnd
, DWORD dwFlags
)
343 FIXME("Stub %p 0x%08x\n", hWnd
, dwFlags
);
347 /************************************************************
348 * WTSRegisterSessionNotification (WTSAPI32.@)
350 BOOL WINAPI
WTSRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
, DWORD dwFlags
)
352 FIXME("Stub %p %p 0x%08x\n", hServer
, hWnd
, dwFlags
);
357 /************************************************************
358 * WTSSendMessageA (WTSAPI32.@)
360 BOOL WINAPI
WTSSendMessageA(HANDLE hServer
, DWORD SessionId
, LPSTR pTitle
, DWORD TitleLength
, LPSTR pMessage
,
361 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
363 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
);
367 /************************************************************
368 * WTSSendMessageW (WTSAPI32.@)
370 BOOL WINAPI
WTSSendMessageW(HANDLE hServer
, DWORD SessionId
, LPWSTR pTitle
, DWORD TitleLength
, LPWSTR pMessage
,
371 DWORD MessageLength
, DWORD Style
, DWORD Timeout
, DWORD
*pResponse
, BOOL bWait
)
373 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
);
377 /************************************************************
378 * WTSSetUserConfigA (WTSAPI32.@)
380 BOOL WINAPI
WTSSetUserConfigA(LPSTR pServerName
, LPSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPSTR pBuffer
, DWORD DataLength
)
382 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName
), debugstr_a(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
386 /************************************************************
387 * WTSSetUserConfigW (WTSAPI32.@)
389 BOOL WINAPI
WTSSetUserConfigW(LPWSTR pServerName
, LPWSTR pUserName
, WTS_CONFIG_CLASS WTSConfigClass
, LPWSTR pBuffer
, DWORD DataLength
)
391 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName
), debugstr_w(pUserName
), WTSConfigClass
,pBuffer
, DataLength
);
395 /************************************************************
396 * WTSShutdownSystem (WTSAPI32.@)
398 BOOL WINAPI
WTSShutdownSystem(HANDLE hServer
, DWORD ShutdownFlag
)
400 FIXME("Stub %p 0x%08x\n", hServer
,ShutdownFlag
);
404 /************************************************************
405 * WTSStartRemoteControlSessionA (WTSAPI32.@)
407 BOOL WINAPI
WTSStartRemoteControlSessionA(LPSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
409 FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
413 /************************************************************
414 * WTSStartRemoteControlSessionW (WTSAPI32.@)
416 BOOL WINAPI
WTSStartRemoteControlSessionW(LPWSTR pTargetServerName
, ULONG TargetLogonId
, BYTE HotkeyVk
, USHORT HotkeyModifiers
)
418 FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName
), TargetLogonId
, HotkeyVk
, HotkeyModifiers
);
422 /************************************************************
423 * WTSStopRemoteControlSession (WTSAPI32.@)
425 BOOL WINAPI
WTSStopRemoteControlSession(ULONG LogonId
)
427 FIXME("Stub %d\n", LogonId
);
431 /************************************************************
432 * WTSTerminateProcess (WTSAPI32.@)
434 BOOL WINAPI
WTSTerminateProcess(HANDLE hServer
, DWORD ProcessId
, DWORD ExitCode
)
436 FIXME("Stub %p %d %d\n", hServer
, ProcessId
, ExitCode
);
440 /************************************************************
441 * WTSUnRegisterSessionNotification (WTSAPI32.@)
443 BOOL WINAPI
WTSUnRegisterSessionNotification(HWND hWnd
)
445 FIXME("Stub %p\n", hWnd
);
449 /************************************************************
450 * WTSUnRegisterSessionNotification (WTSAPI32.@)
452 BOOL WINAPI
WTSUnRegisterSessionNotificationEx(HANDLE hServer
, HWND hWnd
)
454 FIXME("Stub %p %p\n", hServer
, hWnd
);
459 /************************************************************
460 * WTSVirtualChannelClose (WTSAPI32.@)
462 BOOL WINAPI
WTSVirtualChannelClose(HANDLE hChannelHandle
)
464 FIXME("Stub %p\n", hChannelHandle
);
468 /************************************************************
469 * WTSVirtualChannelOpen (WTSAPI32.@)
471 HANDLE WINAPI
WTSVirtualChannelOpen(HANDLE hServer
, DWORD SessionId
, LPSTR pVirtualName
)
473 FIXME("Stub %p %d (%s)\n", hServer
, SessionId
, debugstr_a(pVirtualName
));
477 /************************************************************
478 * WTSVirtualChannelOpen (WTSAPI32.@)
480 HANDLE WINAPI
WTSVirtualChannelOpenEx(DWORD SessionId
, LPSTR pVirtualName
, DWORD flags
)
482 FIXME("Stub %d (%s) %d\n", SessionId
, debugstr_a(pVirtualName
), flags
);
486 /************************************************************
487 * WTSVirtualChannelPurgeInput (WTSAPI32.@)
489 BOOL WINAPI
WTSVirtualChannelPurgeInput(HANDLE hChannelHandle
)
491 FIXME("Stub %p\n", hChannelHandle
);
495 /************************************************************
496 * WTSVirtualChannelPurgeOutput (WTSAPI32.@)
498 BOOL WINAPI
WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle
)
500 FIXME("Stub %p\n", hChannelHandle
);
505 /************************************************************
506 * WTSVirtualChannelQuery (WTSAPI32.@)
508 BOOL WINAPI
WTSVirtualChannelQuery(HANDLE hChannelHandle
, WTS_VIRTUAL_CLASS WtsVirtualClass
, PVOID
*ppBuffer
, DWORD
*pBytesReturned
)
510 FIXME("Stub %p %d %p %p\n", hChannelHandle
, WtsVirtualClass
, ppBuffer
, pBytesReturned
);
514 /************************************************************
515 * WTSVirtualChannelRead (WTSAPI32.@)
517 BOOL WINAPI
WTSVirtualChannelRead(HANDLE hChannelHandle
, ULONG TimeOut
, PCHAR Buffer
, ULONG BufferSize
, PULONG pBytesRead
)
519 FIXME("Stub %p %d %p %d %p\n", hChannelHandle
, TimeOut
, Buffer
, BufferSize
, pBytesRead
);
523 /************************************************************
524 * WTSVirtualChannelWrite (WTSAPI32.@)
526 BOOL WINAPI
WTSVirtualChannelWrite(HANDLE hChannelHandle
, PCHAR Buffer
, ULONG Length
, PULONG pBytesWritten
)
528 FIXME("Stub %p %p %d %p\n", hChannelHandle
, Buffer
, Length
, pBytesWritten
);
532 /************************************************************
533 * WTSWaitSystemEvent (WTSAPI32.@)
535 BOOL WINAPI
WTSWaitSystemEvent(HANDLE hServer
, DWORD Mask
, DWORD
* Flags
)
537 /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
538 FIXME("Stub %p 0x%08x %p\n", hServer
, Mask
, Flags
);