wtsapi32: Build with msvcrt.
[wine.git] / dlls / wtsapi32 / wtsapi32.c
blob2f5e73d05af6347b386b3388dcafb9416b754cd7
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
18 #include <stdarg.h>
19 #include <stdlib.h>
20 #include "windef.h"
21 #include "winbase.h"
22 #include "wtsapi32.h"
23 #include "wine/debug.h"
24 #include "wine/heap.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
29 /************************************************************
30 * WTSCloseServer (WTSAPI32.@)
32 void WINAPI WTSCloseServer(HANDLE hServer)
34 FIXME("Stub %p\n", hServer);
37 /************************************************************
38 * WTSConnectSessionA (WTSAPI32.@)
40 BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait)
42 FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_a(pPassword), bWait);
43 return TRUE;
46 /************************************************************
47 * WTSConnectSessionW (WTSAPI32.@)
49 BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
51 FIXME("Stub %d %d (%s) %d\n", LogonId, TargetLogonId, debugstr_w(pPassword), bWait);
52 return TRUE;
55 /************************************************************
56 * WTSDisconnectSession (WTSAPI32.@)
58 BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
60 FIXME("Stub %p 0x%08x %d\n", hServer, SessionId, bWait);
61 return TRUE;
64 /************************************************************
65 * WTSEnableChildSessions (WTSAPI32.@)
67 BOOL WINAPI WTSEnableChildSessions(BOOL enable)
69 FIXME("Stub %d\n", enable);
70 return TRUE;
73 /************************************************************
74 * WTSEnumerateProcessesA (WTSAPI32.@)
76 BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
77 PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
79 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
80 ppProcessInfo, pCount);
82 if (!ppProcessInfo || !pCount) return FALSE;
84 *pCount = 0;
85 *ppProcessInfo = NULL;
87 return TRUE;
90 /************************************************************
91 * WTSEnumerateProcessesW (WTSAPI32.@)
93 BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
94 PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
96 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
97 ppProcessInfo, pCount);
99 if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
101 SetLastError(ERROR_INVALID_PARAMETER);
102 return FALSE;
105 *pCount = 0;
106 *ppProcessInfo = NULL;
108 return TRUE;
111 /************************************************************
112 * WTSEnumerateServersA (WTSAPI32.@)
114 BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA *ppServerInfo, DWORD *pCount)
116 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_a(pDomainName), Reserved, Version, ppServerInfo, pCount);
117 return FALSE;
120 /************************************************************
121 * WTSEnumerateServersW (WTSAPI32.@)
123 BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW *ppServerInfo, DWORD *pCount)
125 FIXME("Stub %s 0x%08x 0x%08x %p %p\n", debugstr_w(pDomainName), Reserved, Version, ppServerInfo, pCount);
126 return FALSE;
130 /************************************************************
131 * WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
133 BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
134 PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
136 static int once;
138 if (!once++) FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
139 ppSessionInfo, pCount);
141 if (!ppSessionInfo || !pCount) return FALSE;
143 *pCount = 0;
144 *ppSessionInfo = NULL;
146 return TRUE;
149 /************************************************************
150 * WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
152 BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
153 PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
155 FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
156 ppSessionInfo, pCount);
158 if (!ppSessionInfo || !pCount) return FALSE;
160 *pCount = 0;
161 *ppSessionInfo = NULL;
163 return TRUE;
166 /************************************************************
167 * WTSFreeMemory (WTSAPI32.@)
169 void WINAPI WTSFreeMemory(PVOID pMemory)
171 heap_free(pMemory);
174 /************************************************************
175 * WTSLogoffSession (WTSAPI32.@)
177 BOOL WINAPI WTSLogoffSession(HANDLE hserver, DWORD session_id, BOOL bwait)
179 FIXME("(%p, 0x%x, %d): stub\n", hserver, session_id, bwait);
180 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
181 return FALSE;
184 /************************************************************
185 * WTSOpenServerA (WTSAPI32.@)
187 HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
189 FIXME("(%s) stub\n", debugstr_a(pServerName));
190 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
191 return NULL;
194 /************************************************************
195 * WTSOpenServerW (WTSAPI32.@)
197 HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
199 FIXME("(%s) stub\n", debugstr_w(pServerName));
200 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
201 return NULL;
204 /************************************************************
205 * WTSQuerySessionInformationA (WTSAPI32.@)
207 BOOL WINAPI WTSQuerySessionInformationA(
208 HANDLE hServer,
209 DWORD SessionId,
210 WTS_INFO_CLASS WTSInfoClass,
211 LPSTR* Buffer,
212 DWORD* BytesReturned)
214 /* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
215 FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
216 Buffer, BytesReturned);
218 return FALSE;
221 /************************************************************
222 * WTSQuerySessionInformationW (WTSAPI32.@)
224 BOOL WINAPI WTSQuerySessionInformationW(
225 HANDLE hServer,
226 DWORD SessionId,
227 WTS_INFO_CLASS WTSInfoClass,
228 LPWSTR* Buffer,
229 DWORD* BytesReturned)
231 /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
232 FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
233 Buffer, BytesReturned);
235 if (WTSInfoClass == WTSUserName)
237 WCHAR *username;
238 DWORD count = 0;
240 GetUserNameW(NULL, &count);
241 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
242 if (!(username = heap_alloc(count * sizeof(WCHAR)))) return FALSE;
243 GetUserNameW(username, &count);
244 *Buffer = username;
245 *BytesReturned = count * sizeof(WCHAR);
246 return TRUE;
248 return FALSE;
251 /************************************************************
252 * WTSQueryUserToken (WTSAPI32.@)
254 BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
256 FIXME("%u %p semi-stub!\n", session_id, token);
258 if (!token)
260 SetLastError(ERROR_INVALID_PARAMETER);
261 return FALSE;
264 return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
265 GetCurrentProcess(), token,
266 0, FALSE, DUPLICATE_SAME_ACCESS);
269 /************************************************************
270 * WTSQueryUserConfigA (WTSAPI32.@)
272 BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
274 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,
275 ppBuffer, pBytesReturned);
276 return FALSE;
279 /************************************************************
280 * WTSQueryUserConfigW (WTSAPI32.@)
282 BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
284 FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,
285 ppBuffer, pBytesReturned);
286 return FALSE;
290 /************************************************************
291 * WTSRegisterSessionNotification (WTSAPI32.@)
293 BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
295 FIXME("Stub %p 0x%08x\n", hWnd, dwFlags);
296 return TRUE;
299 /************************************************************
300 * WTSRegisterSessionNotificationEx (WTSAPI32.@)
302 BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags)
304 FIXME("Stub %p %p 0x%08x\n", hServer, hWnd, dwFlags);
305 return FALSE;
309 /************************************************************
310 * WTSSendMessageA (WTSAPI32.@)
312 BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, LPSTR pMessage,
313 DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
315 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);
316 return FALSE;
319 /************************************************************
320 * WTSSendMessageW (WTSAPI32.@)
322 BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, LPWSTR pMessage,
323 DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
325 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);
326 return FALSE;
329 /************************************************************
330 * WTSSetUserConfigA (WTSAPI32.@)
332 BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength)
334 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,pBuffer, DataLength);
335 return FALSE;
338 /************************************************************
339 * WTSSetUserConfigW (WTSAPI32.@)
341 BOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
343 FIXME("Stub (%s) (%s) 0x%08x %p %d\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,pBuffer, DataLength);
344 return FALSE;
347 /************************************************************
348 * WTSShutdownSystem (WTSAPI32.@)
350 BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
352 FIXME("Stub %p 0x%08x\n", hServer,ShutdownFlag);
353 return FALSE;
356 /************************************************************
357 * WTSStartRemoteControlSessionA (WTSAPI32.@)
359 BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
361 FIXME("Stub (%s) %d %d %d\n", debugstr_a(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
362 return FALSE;
365 /************************************************************
366 * WTSStartRemoteControlSessionW (WTSAPI32.@)
368 BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
370 FIXME("Stub (%s) %d %d %d\n", debugstr_w(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
371 return FALSE;
374 /************************************************************
375 * WTSStopRemoteControlSession (WTSAPI32.@)
377 BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId)
379 FIXME("Stub %d\n", LogonId);
380 return FALSE;
383 /************************************************************
384 * WTSTerminateProcess (WTSAPI32.@)
386 BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
388 FIXME("Stub %p %d %d\n", hServer, ProcessId, ExitCode);
389 return FALSE;
392 /************************************************************
393 * WTSUnRegisterSessionNotification (WTSAPI32.@)
395 BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
397 FIXME("Stub %p\n", hWnd);
398 return FALSE;
401 /************************************************************
402 * WTSUnRegisterSessionNotification (WTSAPI32.@)
404 BOOL WINAPI WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd)
406 FIXME("Stub %p %p\n", hServer, hWnd);
407 return FALSE;
411 /************************************************************
412 * WTSVirtualChannelClose (WTSAPI32.@)
414 BOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle)
416 FIXME("Stub %p\n", hChannelHandle);
417 return FALSE;
420 /************************************************************
421 * WTSVirtualChannelOpen (WTSAPI32.@)
423 HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
425 FIXME("Stub %p %d (%s)\n", hServer, SessionId, debugstr_a(pVirtualName));
426 return NULL;
429 /************************************************************
430 * WTSVirtualChannelOpen (WTSAPI32.@)
432 HANDLE WINAPI WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
434 FIXME("Stub %d (%s) %d\n", SessionId, debugstr_a(pVirtualName), flags);
435 return NULL;
438 /************************************************************
439 * WTSVirtualChannelPurgeInput (WTSAPI32.@)
441 BOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
443 FIXME("Stub %p\n", hChannelHandle);
444 return FALSE;
447 /************************************************************
448 * WTSVirtualChannelPurgeOutput (WTSAPI32.@)
450 BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
452 FIXME("Stub %p\n", hChannelHandle);
453 return FALSE;
457 /************************************************************
458 * WTSVirtualChannelQuery (WTSAPI32.@)
460 BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID *ppBuffer, DWORD *pBytesReturned)
462 FIXME("Stub %p %d %p %p\n", hChannelHandle, WtsVirtualClass, ppBuffer, pBytesReturned);
463 return FALSE;
466 /************************************************************
467 * WTSVirtualChannelRead (WTSAPI32.@)
469 BOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
471 FIXME("Stub %p %d %p %d %p\n", hChannelHandle, TimeOut, Buffer, BufferSize, pBytesRead);
472 return FALSE;
475 /************************************************************
476 * WTSVirtualChannelWrite (WTSAPI32.@)
478 BOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
480 FIXME("Stub %p %p %d %p\n", hChannelHandle, Buffer, Length, pBytesWritten);
481 return FALSE;
484 /************************************************************
485 * WTSWaitSystemEvent (WTSAPI32.@)
487 BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
489 /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
490 FIXME("Stub %p 0x%08x %p\n", hServer, Mask, Flags);
491 return FALSE;