wtsapi32.c 22.7 KB
Newer Older
Ulrich Czekalla's avatar
Ulrich Czekalla committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* Copyright 2005 Ulrich Czekalla
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Ulrich Czekalla's avatar
Ulrich Czekalla committed
16 17
 */

18 19
#include "ntstatus.h"
#define WIN32_NO_STATUS
Ulrich Czekalla's avatar
Ulrich Czekalla committed
20 21 22 23
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
24
#include "winternl.h"
25
#include "winnls.h"
26
#include "lmcons.h"
Ulrich Czekalla's avatar
Ulrich Czekalla committed
27 28
#include "wtsapi32.h"
#include "wine/debug.h"
29
#include "wine/heap.h"
Ulrich Czekalla's avatar
Ulrich Czekalla committed
30 31 32 33

WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);


34 35 36 37 38 39 40 41
/************************************************************
 *                WTSCloseServer  (WTSAPI32.@)
 */
void WINAPI WTSCloseServer(HANDLE hServer)
{
    FIXME("Stub %p\n", hServer);
}

42 43 44 45 46
/************************************************************
 *                WTSConnectSessionA  (WTSAPI32.@)
 */
BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait)
{
47
   FIXME("Stub %ld %ld (%s) %d\n", LogonId, TargetLogonId, debugstr_a(pPassword), bWait);
48 49 50 51 52 53 54 55
   return TRUE;
}

/************************************************************
 *                WTSConnectSessionW  (WTSAPI32.@)
 */
BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
{
56
   FIXME("Stub %ld %ld (%s) %d\n", LogonId, TargetLogonId, debugstr_w(pPassword), bWait);
57 58 59
   return TRUE;
}

60 61 62 63 64
/************************************************************
 *                WTSDisconnectSession  (WTSAPI32.@)
 */
BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
{
65
    FIXME("Stub %p 0x%08lx %d\n", hServer, SessionId, bWait);
66
    return TRUE;
67 68
}

69 70 71 72 73 74 75 76 77
/************************************************************
 *                WTSEnableChildSessions  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnableChildSessions(BOOL enable)
{
    FIXME("Stub %d\n", enable);
    return TRUE;
}

78 79 80 81

/************************************************************
 *                WTSEnumerateProcessesExW  (WTSAPI32.@)
 */
82 83
BOOL WINAPI WTSEnumerateProcessesExW(HANDLE server, DWORD *level, DWORD session_id,
        WCHAR **ret_info, DWORD *ret_count)
84
{
85 86 87 88 89 90 91
    SYSTEM_PROCESS_INFORMATION *nt_info, *nt_process;
    WTS_PROCESS_INFOW *info;
    ULONG nt_size = 4096;
    DWORD count, size;
    NTSTATUS status;
    char *p;

92
    TRACE("server %p, level %lu, session_id %#lx, ret_info %p, ret_count %p\n",
93 94 95 96 97 98 99 100 101
            server, *level, session_id, ret_info, ret_count);

    if (!ret_info || !ret_count)
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    if (session_id != WTS_ANY_SESSION)
102
        FIXME("ignoring session id %#lx\n", session_id);
103 104 105

    if (*level)
    {
106
        FIXME("unhandled level %lu\n", *level);
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
        return FALSE;
    }

    if (!(nt_info = malloc(nt_size)))
    {
        SetLastError(ERROR_OUTOFMEMORY);
        return FALSE;
    }

    while ((status = NtQuerySystemInformation(SystemProcessInformation, nt_info,
            nt_size, NULL)) == STATUS_INFO_LENGTH_MISMATCH)
    {
        SYSTEM_PROCESS_INFORMATION *new_info;

        nt_size *= 2;
        if (!(new_info = realloc(nt_info, nt_size)))
        {
            free(nt_info);
            SetLastError(ERROR_OUTOFMEMORY);
            return FALSE;
        }
        nt_info = new_info;
    }
    if (status)
    {
        free(nt_info);
        SetLastError(RtlNtStatusToDosError(status));
        return FALSE;
    }

    size = 0;
    count = 0;
    nt_process = nt_info;
    for (;;)
    {
        size += sizeof(WTS_PROCESS_INFOW) + nt_process->ProcessName.Length + sizeof(WCHAR);
        size += offsetof(SID, SubAuthority[SID_MAX_SUB_AUTHORITIES]);
        ++count;

        if (!nt_process->NextEntryOffset)
            break;
        nt_process = (SYSTEM_PROCESS_INFORMATION *)((char *)nt_process + nt_process->NextEntryOffset);
    }

    if (!(info = heap_alloc(size)))
    {
        free(nt_info);
        SetLastError(ERROR_OUTOFMEMORY);
        return FALSE;
    }
    p = (char *)(info + count);

    count = 0;
    nt_process = nt_info;
    for (;;)
    {
        HANDLE process, token;

        info[count].SessionId = nt_process->SessionId;
        info[count].ProcessId = (DWORD_PTR)nt_process->UniqueProcessId;

        info[count].pProcessName = (WCHAR *)p;
        memcpy(p, nt_process->ProcessName.Buffer, nt_process->ProcessName.Length);
        info[count].pProcessName[nt_process->ProcessName.Length / sizeof(WCHAR)] = 0;
        p += nt_process->ProcessName.Length + sizeof(WCHAR);

        info[count].pUserSid = NULL;
        if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, info[count].ProcessId)))
        {
            if (OpenProcessToken(process, TOKEN_QUERY, &token))
            {
                char buffer[sizeof(TOKEN_USER) + offsetof(SID, SubAuthority[SID_MAX_SUB_AUTHORITIES])];
                TOKEN_USER *user = (TOKEN_USER *)buffer;
                DWORD size;

                GetTokenInformation(token, TokenUser, buffer, sizeof(buffer), &size);
                info[count].pUserSid = p;
                size = GetLengthSid(user->User.Sid);
                memcpy(p, user->User.Sid, size);
                p += size;
                CloseHandle(token);
            }
            CloseHandle(process);
        }

        ++count;
        if (!nt_process->NextEntryOffset)
            break;
        nt_process = (SYSTEM_PROCESS_INFORMATION *)((char *)nt_process + nt_process->NextEntryOffset);
    }

    *ret_info = (WCHAR *)info;
    *ret_count = count;
    SetLastError(0);
    return TRUE;
203 204 205 206 207 208 209
}

/************************************************************
 *                WTSEnumerateProcessesExA  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateProcessesExA(HANDLE server, DWORD *level, DWORD session_id, char **info, DWORD *count)
{
210
    FIXME("Stub %p %p %ld %p %p\n", server, level, session_id, info, count);
211 212 213 214
    if (count) *count = 0;
    return FALSE;
}

215 216 217 218 219 220
/************************************************************
 *                WTSEnumerateProcessesA  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
    PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
{
221
    FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
222
          ppProcessInfo, pCount);
223 224 225 226 227 228 229

    if (!ppProcessInfo || !pCount) return FALSE;

    *pCount = 0;
    *ppProcessInfo = NULL;

    return TRUE;
230 231 232 233 234
}

/************************************************************
 *                WTSEnumerateProcessesW  (WTSAPI32.@)
 */
235 236
BOOL WINAPI WTSEnumerateProcessesW(HANDLE server, DWORD reserved, DWORD version,
        WTS_PROCESS_INFOW **info, DWORD *count)
237
{
238
    DWORD level = 0;
239

240
    TRACE("server %p, reserved %#lx, version %lu, info %p, count %p\n", server, reserved, version, info, count);
241 242

    if (reserved || version != 1)
243 244 245 246
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }
247

248
    return WTSEnumerateProcessesExW(server, &level, WTS_ANY_SESSION, (WCHAR **)info, count);
249 250
}

251 252 253 254 255
/************************************************************
 *                WTSEnumerateServersA  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA *ppServerInfo, DWORD *pCount)
{
256
    FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_a(pDomainName), Reserved, Version, ppServerInfo, pCount);
257 258 259 260 261 262 263 264
    return FALSE;
}

/************************************************************
 *                WTSEnumerateServersW  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW *ppServerInfo, DWORD *pCount)
{
265
    FIXME("Stub %s 0x%08lx 0x%08lx %p %p\n", debugstr_w(pDomainName), Reserved, Version, ppServerInfo, pCount);
266 267 268 269
    return FALSE;
}


270 271 272 273 274
/************************************************************
 *                WTSEnumerateEnumerateSessionsExW  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateSessionsExW(HANDLE server, DWORD *level, DWORD filter, WTS_SESSION_INFO_1W* info, DWORD *count)
{
275
    FIXME("Stub %p %p %ld %p %p\n", server, level, filter, info, count);
276 277 278 279 280 281 282 283 284
    if (count) *count = 0;
    return FALSE;
}

/************************************************************
 *                WTSEnumerateEnumerateSessionsExA  (WTSAPI32.@)
 */
BOOL WINAPI WTSEnumerateSessionsExA(HANDLE server, DWORD *level, DWORD filter, WTS_SESSION_INFO_1A* info, DWORD *count)
{
285
    FIXME("Stub %p %p %ld %p %p\n", server, level, filter, info, count);
286 287 288 289
    if (count) *count = 0;
    return FALSE;
}

290 291 292
/************************************************************
 *                WTSEnumerateEnumerateSessionsA  (WTSAPI32.@)
 */
293
BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
294 295
    PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
{
296 297
    static int once;

298
    if (!once++) FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
299
          ppSessionInfo, pCount);
300 301 302 303 304 305 306

    if (!ppSessionInfo || !pCount) return FALSE;

    *pCount = 0;
    *ppSessionInfo = NULL;

    return TRUE;
307 308 309 310 311
}

/************************************************************
 *                WTSEnumerateEnumerateSessionsW  (WTSAPI32.@)
 */
312
BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
313 314
    PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
{
315
    FIXME("Stub %p 0x%08lx 0x%08lx %p %p\n", hServer, Reserved, Version,
316
          ppSessionInfo, pCount);
317 318 319 320 321 322 323

    if (!ppSessionInfo || !pCount) return FALSE;

    *pCount = 0;
    *ppSessionInfo = NULL;

    return TRUE;
324 325
}

Huw Davies's avatar
Huw Davies committed
326 327 328 329 330
/************************************************************
 *                WTSFreeMemory (WTSAPI32.@)
 */
void WINAPI WTSFreeMemory(PVOID pMemory)
{
331
    heap_free(pMemory);
Huw Davies's avatar
Huw Davies committed
332 333
}

334 335 336 337 338
/************************************************************
 *                WTSFreeMemoryExA (WTSAPI32.@)
 */
BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
{
339
    TRACE("%d %p %ld\n", type, ptr, nmemb);
340 341 342 343 344 345 346 347 348
    heap_free(ptr);
    return TRUE;
}

/************************************************************
 *                WTSFreeMemoryExW (WTSAPI32.@)
 */
BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
{
349
    TRACE("%d %p %ld\n", type, ptr, nmemb);
350 351 352 353 354
    heap_free(ptr);
    return TRUE;
}


355 356 357 358 359
/************************************************************
 *                WTSLogoffSession (WTSAPI32.@)
 */
BOOL WINAPI WTSLogoffSession(HANDLE hserver, DWORD session_id, BOOL bwait)
{
360
    FIXME("(%p, 0x%lx, %d): stub\n", hserver, session_id, bwait);
361 362 363 364
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return FALSE;
}

365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385

/************************************************************
 *                WTSOpenServerExW (WTSAPI32.@)
 */
HANDLE WINAPI WTSOpenServerExW(WCHAR *server_name)
{
    FIXME("(%s) stub\n", debugstr_w(server_name));
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return NULL;
}

/************************************************************
 *                WTSOpenServerExA (WTSAPI32.@)
 */
HANDLE WINAPI WTSOpenServerExA(char *server_name)
{
    FIXME("(%s) stub\n", debugstr_a(server_name));
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return NULL;
}

Robert Reif's avatar
Robert Reif committed
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
/************************************************************
 *                WTSOpenServerA (WTSAPI32.@)
 */
HANDLE WINAPI WTSOpenServerA(LPSTR pServerName)
{
    FIXME("(%s) stub\n", debugstr_a(pServerName));
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return NULL;
}

/************************************************************
 *                WTSOpenServerW (WTSAPI32.@)
 */
HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName)
{
    FIXME("(%s) stub\n", debugstr_w(pServerName));
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return NULL;
}

406 407 408
/************************************************************
 *                WTSQuerySessionInformationA  (WTSAPI32.@)
 */
409
BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INFO_CLASS class, char **buffer, DWORD *count)
410
{
411
    WCHAR *bufferW = NULL;
412

413
    TRACE("%p 0x%08lx %d %p %p\n", server, session_id, class, buffer, count);
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445

    if (!buffer || !count)
    {
        SetLastError(ERROR_INVALID_USER_BUFFER);
        return FALSE;
    }

    if (!WTSQuerySessionInformationW(server, session_id, class, &bufferW, count))
        return FALSE;

    *count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
    if (!*count)
    {
        WTSFreeMemory(bufferW);
        return FALSE;
    }

    if (!(*buffer = heap_alloc(*count)))
    {
        WTSFreeMemory(bufferW);
        return FALSE;
    }

    if (!(*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, *buffer, *count, NULL, NULL)))
    {
        WTSFreeMemory(bufferW);
        heap_free(*buffer);
        return FALSE;
    }

    WTSFreeMemory(bufferW);
    return TRUE;
446
}
Ulrich Czekalla's avatar
Ulrich Czekalla committed
447 448 449 450

/************************************************************
 *                WTSQuerySessionInformationW  (WTSAPI32.@)
 */
451
BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INFO_CLASS class, WCHAR **buffer, DWORD *count)
Ulrich Czekalla's avatar
Ulrich Czekalla committed
452
{
453
    TRACE("%p 0x%08lx %d %p %p\n", server, session_id, class, buffer, count);
Ulrich Czekalla's avatar
Ulrich Czekalla committed
454

455
    if (!buffer || !count)
456 457 458 459 460
    {
        SetLastError(ERROR_INVALID_USER_BUFFER);
        return FALSE;
    }

461
    if (class == WTSUserName)
462
    {
463
        DWORD size = UNLEN + 1;
464
        WCHAR *username;
465 466 467 468 469

        if (!(username = heap_alloc(size * sizeof(WCHAR)))) return FALSE;
        GetUserNameW(username, &size);
        *buffer = username;
        *count = size * sizeof(WCHAR);
470 471
        return TRUE;
    }
472

473 474 475 476 477 478 479 480 481 482 483 484 485 486
    if (class ==  WTSDomainName)
    {
        DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
        WCHAR *computername;

        if (!(computername = heap_alloc(size * sizeof(WCHAR)))) return FALSE;
        GetComputerNameW(computername, &size);
        *buffer = computername;
        /* GetComputerNameW() return size doesn't include terminator */
        size++;
        *count = size * sizeof(WCHAR);
        return TRUE;
    }

487 488 489 490
    FIXME("Unimplemented class %d\n", class);

    *buffer = NULL;
    *count = 0;
Ulrich Czekalla's avatar
Ulrich Czekalla committed
491 492 493 494
    return FALSE;
}

/************************************************************
495
 *                WTSQueryUserToken (WTSAPI32.@)
Ulrich Czekalla's avatar
Ulrich Czekalla committed
496
 */
497
BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
Ulrich Czekalla's avatar
Ulrich Czekalla committed
498
{
499
    FIXME("%lu %p semi-stub!\n", session_id, token);
500 501 502 503 504 505 506 507 508 509

    if (!token)
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
                           GetCurrentProcess(), token,
                           0, FALSE, DUPLICATE_SAME_ACCESS);
Ulrich Czekalla's avatar
Ulrich Czekalla committed
510
}
511

512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
/************************************************************
 *                WTSQueryUserConfigA (WTSAPI32.@)
 */
BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
{
   FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,
        ppBuffer, pBytesReturned);
   return FALSE;
}

/************************************************************
 *                WTSQueryUserConfigW (WTSAPI32.@)
 */
BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
{
   FIXME("Stub (%s) (%s) 0x%08x %p %p\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,
        ppBuffer, pBytesReturned);
   return FALSE;
}


533 534 535 536 537
/************************************************************
 *                WTSRegisterSessionNotification (WTSAPI32.@)
 */
BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
{
538
    FIXME("Stub %p 0x%08lx\n", hWnd, dwFlags);
539
    return TRUE;
540
}
541

542
/************************************************************
543
 *                WTSRegisterSessionNotificationEx (WTSAPI32.@)
544 545 546
 */
BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags)
{
547
    FIXME("Stub %p %p 0x%08lx\n", hServer, hWnd, dwFlags);
548
    return TRUE;
549 550 551 552 553 554 555 556 557
}


/************************************************************
 *                WTSSendMessageA (WTSAPI32.@)
 */
BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, LPSTR pMessage,
   DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
{
558
   FIXME("Stub %p 0x%08lx (%s) %ld (%s) %ld 0x%08lx %ld %p %d\n", hServer, SessionId, debugstr_a(pTitle), TitleLength, debugstr_a(pMessage), MessageLength, Style, Timeout, pResponse, bWait);
559 560 561 562 563 564 565 566 567
   return FALSE;
}

/************************************************************
 *                WTSSendMessageW (WTSAPI32.@)
 */
BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, LPWSTR pMessage,
   DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
{
568
   FIXME("Stub %p 0x%08lx (%s) %ld (%s) %ld 0x%08lx %ld %p %d\n", hServer, SessionId, debugstr_w(pTitle), TitleLength, debugstr_w(pMessage), MessageLength, Style, Timeout, pResponse, bWait);
569 570 571 572 573 574 575 576
   return FALSE;
}

/************************************************************
 *                WTSSetUserConfigA (WTSAPI32.@)
 */
BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength)
{
577
   FIXME("Stub (%s) (%s) 0x%08x %p %ld\n", debugstr_a(pServerName), debugstr_a(pUserName), WTSConfigClass,pBuffer, DataLength);
578 579 580 581 582 583 584 585
   return FALSE;
}

/************************************************************
 *                WTSSetUserConfigW (WTSAPI32.@)
 */
BOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
{
586
   FIXME("Stub (%s) (%s) 0x%08x %p %ld\n", debugstr_w(pServerName), debugstr_w(pUserName), WTSConfigClass,pBuffer, DataLength);
587 588 589 590 591 592 593 594
   return FALSE;
}

/************************************************************
 *                WTSShutdownSystem (WTSAPI32.@)
 */
BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
{
595
   FIXME("Stub %p 0x%08lx\n", hServer,ShutdownFlag);
596 597 598 599 600 601 602 603
   return FALSE;
}

/************************************************************
 *                WTSStartRemoteControlSessionA (WTSAPI32.@)
 */
BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
{
604
   FIXME("Stub (%s) %ld %d %d\n", debugstr_a(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
605 606 607 608 609 610 611 612
   return FALSE;
}

/************************************************************
 *                WTSStartRemoteControlSessionW (WTSAPI32.@)
 */
BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
{
613
   FIXME("Stub (%s) %ld %d %d\n", debugstr_w(pTargetServerName), TargetLogonId, HotkeyVk, HotkeyModifiers);
614 615 616 617 618 619 620 621
   return FALSE;
}

/************************************************************
 *                WTSStopRemoteControlSession (WTSAPI32.@)
 */
BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId)
{
622
   FIXME("Stub %ld\n",  LogonId);
623 624 625 626 627 628 629 630
   return FALSE;
}

/************************************************************
 *                WTSTerminateProcess (WTSAPI32.@)
 */
BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
{
631
   FIXME("Stub %p %ld %ld\n", hServer, ProcessId, ExitCode);
632 633 634
   return FALSE;
}

635 636 637 638 639 640 641 642
/************************************************************
 *                WTSUnRegisterSessionNotification (WTSAPI32.@)
 */
BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd)
{
    FIXME("Stub %p\n", hWnd);
    return FALSE;
}
643 644

/************************************************************
645
 *                WTSUnRegisterSessionNotification (WTSAPI32.@)
646
 */
647
BOOL WINAPI WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd)
648
{
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667
    FIXME("Stub %p %p\n", hServer, hWnd);
    return FALSE;
}


/************************************************************
 *                WTSVirtualChannelClose (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle)
{
   FIXME("Stub %p\n", hChannelHandle);
   return FALSE;
}

/************************************************************
 *                WTSVirtualChannelOpen (WTSAPI32.@)
 */
HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
{
668
   FIXME("Stub %p %ld (%s)\n", hServer, SessionId, debugstr_a(pVirtualName));
669 670 671 672 673 674 675 676
   return NULL;
}

/************************************************************
 *                WTSVirtualChannelOpen (WTSAPI32.@)
 */
HANDLE WINAPI WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
{
677
   FIXME("Stub %ld (%s) %ld\n",  SessionId, debugstr_a(pVirtualName), flags);
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713
   return NULL;
}

/************************************************************
 *                WTSVirtualChannelPurgeInput (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
{
   FIXME("Stub %p\n", hChannelHandle);
   return FALSE;
}

/************************************************************
 *                WTSVirtualChannelPurgeOutput (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
{
   FIXME("Stub %p\n", hChannelHandle);
   return FALSE;
}


/************************************************************
 *                WTSVirtualChannelQuery (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID *ppBuffer, DWORD *pBytesReturned)
{
   FIXME("Stub %p %d %p %p\n", hChannelHandle, WtsVirtualClass, ppBuffer, pBytesReturned);
   return FALSE;
}

/************************************************************
 *                WTSVirtualChannelRead (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
{
714
   FIXME("Stub %p %ld %p %ld %p\n", hChannelHandle, TimeOut, Buffer, BufferSize, pBytesRead);
715 716 717 718 719 720 721 722
   return FALSE;
}

/************************************************************
 *                WTSVirtualChannelWrite (WTSAPI32.@)
 */
BOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
{
723
   FIXME("Stub %p %p %ld %p\n", hChannelHandle, Buffer, Length, pBytesWritten);
724 725 726 727 728 729 730 731 732
   return FALSE;
}

/************************************************************
 *                WTSWaitSystemEvent (WTSAPI32.@)
 */
BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
{
    /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
733
    FIXME("Stub %p 0x%08lx %p\n", hServer, Mask, Flags);
734 735
    return FALSE;
}