2013-08-20 03:18:31 +04:00
|
|
|
/**
|
|
|
|
* WinPR: Windows Portable Runtime
|
|
|
|
* Windows Terminal Services API
|
|
|
|
*
|
|
|
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
2013-09-17 01:10:27 +04:00
|
|
|
#include <winpr/synch.h>
|
2013-08-20 03:18:31 +04:00
|
|
|
|
|
|
|
#include <winpr/wtsapi.h>
|
|
|
|
|
2013-08-20 23:22:31 +04:00
|
|
|
/**
|
|
|
|
* Remote Desktop Services API Functions:
|
|
|
|
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464/
|
|
|
|
*/
|
|
|
|
|
2013-08-20 03:18:31 +04:00
|
|
|
#ifndef _WIN32
|
|
|
|
|
2013-08-23 08:06:22 +04:00
|
|
|
#include "wtsrpc_c.h"
|
|
|
|
|
2013-08-23 06:36:37 +04:00
|
|
|
BOOL WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcStartRemoteControlSession(NULL, pTargetServerName, TargetLogonId, HotkeyVk, HotkeyModifiers);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
2013-08-20 03:18:31 +04:00
|
|
|
|
2013-08-23 06:36:37 +04:00
|
|
|
BOOL WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-08-23 06:36:37 +04:00
|
|
|
BOOL WTSStopRemoteControlSession(ULONG LogonId)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcStopRemoteControlSession(NULL, LogonId);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
2013-08-23 08:06:22 +04:00
|
|
|
BOOL WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcConnectSession(NULL, LogonId, TargetLogonId, pPassword, bWait);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
2013-08-23 08:06:22 +04:00
|
|
|
BOOL WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcEnumerateServers(NULL, pDomainName, Reserved, Version, ppServerInfo, pCount);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSOpenServerW(LPWSTR pServerName)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcOpenServer(NULL, pServerName);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSOpenServerA(LPSTR pServerName)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSOpenServerExW(LPWSTR pServerName)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcOpenServerEx(NULL, pServerName);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSOpenServerExA(LPSTR pServerName)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID WTSCloseServer(HANDLE hServer)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
RpcCloseServer(NULL, hServer);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcEnumerateSessions(NULL, hServer, Reserved, Version, ppSessionInfo, pCount);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcEnumerateSessionsEx(NULL, hServer, pLevel, Filter, ppSessionInfo, pCount);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1A* ppSessionInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcEnumerateProcesses(NULL, hServer, Reserved, Version, ppProcessInfo, pCount);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcTerminateProcess(NULL, hServer, ProcessId, ExitCode);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcQuerySessionInformation(NULL, hServer, SessionId, WTSInfoClass, ppBuffer, pBytesReturned);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcQueryUserConfig(NULL, pServerName, pUserName, WTSConfigClass, ppBuffer, pBytesReturned);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcSetUserConfig(NULL, pServerName, pUserName, WTSConfigClass, pBuffer, DataLength);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength,
|
|
|
|
LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcSendMessage(NULL, hServer, SessionId, pTitle, TitleLength,
|
|
|
|
pMessage, MessageLength, Style, Timeout, pResponse, bWait);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength,
|
|
|
|
LPSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcDisconnectSession(NULL, hServer, SessionId, bWait);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSLogoffSession(HANDLE hServer, DWORD SessionId, BOOL bWait)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcLogoffSession(NULL, hServer, SessionId, bWait);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcShutdownSystem(NULL, hServer, ShutdownFlag);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
|
|
|
|
{
|
2013-08-23 06:36:37 +04:00
|
|
|
HANDLE handle = NULL;
|
|
|
|
|
|
|
|
if (hServer != WTS_CURRENT_SERVER_HANDLE)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return handle;
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
|
|
|
|
{
|
2013-08-23 06:36:37 +04:00
|
|
|
HANDLE handle = NULL;
|
|
|
|
|
|
|
|
if (!flags)
|
2013-09-17 01:10:27 +04:00
|
|
|
handle = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, SessionId, pVirtualName);
|
2013-08-23 06:36:37 +04:00
|
|
|
|
2013-09-17 01:10:27 +04:00
|
|
|
return handle;
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSVirtualChannelClose(HANDLE hChannelHandle)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
if (!hChannelHandle || (hChannelHandle == INVALID_HANDLE_VALUE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: properly close handle */
|
|
|
|
|
2013-08-20 04:38:43 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
OVERLAPPED overlapped;
|
|
|
|
|
|
|
|
if (!hChannelHandle || (hChannelHandle == INVALID_HANDLE_VALUE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
overlapped.hEvent = 0;
|
|
|
|
overlapped.Offset = 0;
|
|
|
|
overlapped.OffsetHigh = 0;
|
|
|
|
|
|
|
|
if (ReadFile(hChannelHandle, Buffer, BufferSize, pBytesRead, &overlapped))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (GetLastError() != ERROR_IO_PENDING)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!TimeOut)
|
|
|
|
{
|
|
|
|
CancelIo(hChannelHandle);
|
|
|
|
*pBytesRead = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (WaitForSingleObject(hChannelHandle, TimeOut) == WAIT_TIMEOUT)
|
|
|
|
{
|
|
|
|
CancelIo(hChannelHandle);
|
|
|
|
SetLastError(ERROR_IO_INCOMPLETE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetOverlappedResult(hChannelHandle, &overlapped, pBytesRead, 0);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
OVERLAPPED overlapped;
|
|
|
|
|
|
|
|
if (!hChannelHandle || (hChannelHandle == INVALID_HANDLE_VALUE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
overlapped.hEvent = 0;
|
|
|
|
overlapped.Offset = 0;
|
|
|
|
overlapped.OffsetHigh = 0;
|
|
|
|
|
|
|
|
if (WriteFile(hChannelHandle, Buffer, Length, pBytesWritten, &overlapped))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (GetLastError() == ERROR_IO_PENDING)
|
|
|
|
return GetOverlappedResult(hChannelHandle, &overlapped, pBytesWritten, 1);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL VirtualChannelIoctl(HANDLE hChannelHandle, ULONG IoControlCode)
|
|
|
|
{
|
|
|
|
DWORD error;
|
|
|
|
NTSTATUS ntstatus;
|
|
|
|
IO_STATUS_BLOCK ioStatusBlock;
|
|
|
|
|
|
|
|
if (!hChannelHandle || (hChannelHandle == INVALID_HANDLE_VALUE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-10-23 05:43:59 +04:00
|
|
|
ntstatus = _NtDeviceIoControlFile(hChannelHandle, 0, 0, 0, &ioStatusBlock, IoControlCode, 0, 0, 0, 0);
|
2013-08-23 03:20:59 +04:00
|
|
|
|
|
|
|
if (ntstatus == STATUS_PENDING)
|
|
|
|
{
|
2013-10-23 05:43:59 +04:00
|
|
|
ntstatus = _NtWaitForSingleObject(hChannelHandle, 0, 0);
|
2013-08-23 03:20:59 +04:00
|
|
|
|
|
|
|
if (ntstatus >= 0)
|
|
|
|
ntstatus = ioStatusBlock.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ntstatus == STATUS_BUFFER_OVERFLOW)
|
|
|
|
{
|
|
|
|
ntstatus = STATUS_BUFFER_TOO_SMALL;
|
2013-10-23 05:43:59 +04:00
|
|
|
error = _RtlNtStatusToDosError(ntstatus);
|
2013-08-23 03:20:59 +04:00
|
|
|
SetLastError(error);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ntstatus < 0)
|
|
|
|
{
|
2013-10-23 05:43:59 +04:00
|
|
|
error = _RtlNtStatusToDosError(ntstatus);
|
2013-08-23 03:20:59 +04:00
|
|
|
SetLastError(error);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-08-20 04:38:43 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-08-23 03:20:59 +04:00
|
|
|
#define FILE_DEVICE_TERMSRV 0x00000038
|
|
|
|
|
2013-08-20 04:38:43 +04:00
|
|
|
BOOL WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
return VirtualChannelIoctl(hChannelHandle, (FILE_DEVICE_TERMSRV << 16) | 0x0107);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
return VirtualChannelIoctl(hChannelHandle, (FILE_DEVICE_TERMSRV << 16) | 0x010B);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
if (!hChannelHandle || (hChannelHandle == INVALID_HANDLE_VALUE))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (WtsVirtualClass == WTSVirtualFileHandle)
|
|
|
|
{
|
|
|
|
*ppBuffer = malloc(sizeof(void*));
|
|
|
|
CopyMemory(*ppBuffer, &hChannelHandle, sizeof(void*));
|
|
|
|
*pBytesReturned = sizeof(void*);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID WTSFreeMemory(PVOID pMemory)
|
|
|
|
{
|
2013-08-23 03:20:59 +04:00
|
|
|
free(pMemory);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries)
|
|
|
|
{
|
2013-08-23 06:36:37 +04:00
|
|
|
BOOL status = TRUE;
|
|
|
|
|
|
|
|
switch (WTSTypeClass)
|
|
|
|
{
|
|
|
|
case WTSTypeProcessInfoLevel0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WTSTypeProcessInfoLevel1:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WTSTypeSessionInfoLevel1:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries)
|
|
|
|
{
|
2013-08-23 06:36:37 +04:00
|
|
|
BOOL status = TRUE;
|
|
|
|
|
|
|
|
switch (WTSTypeClass)
|
|
|
|
{
|
|
|
|
case WTSTypeProcessInfoLevel0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WTSTypeProcessInfoLevel1:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WTSTypeSessionInfoLevel1:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
2013-08-23 08:06:22 +04:00
|
|
|
BOOL WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
return RpcRegisterSessionNotification(NULL, hWnd, dwFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSUnRegisterSessionNotification(HWND hWnd)
|
|
|
|
{
|
|
|
|
return RpcUnRegisterSessionNotification(NULL, hWnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
return RpcRegisterSessionNotificationEx(NULL, hServer, hWnd, dwFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd)
|
|
|
|
{
|
|
|
|
return RpcUnRegisterSessionNotificationEx(NULL, hServer, hWnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQueryUserToken(ULONG SessionId, PHANDLE phToken)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-08-20 04:38:43 +04:00
|
|
|
BOOL WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPWSTR* ppProcessInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPSTR* ppProcessInfo, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEW pListeners, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEA pListeners, DWORD* pCount)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-08-20 04:58:42 +04:00
|
|
|
BOOL WTSCreateListenerW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer, DWORD flag)
|
2013-08-20 04:38:43 +04:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSCreateListenerA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer, DWORD flag)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSSetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSGetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSGetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
|
|
|
|
LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation,
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSEnableChildSessions(BOOL bEnable)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcEnableChildSessions(NULL, bEnable);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSIsChildSessionsEnabled(PBOOL pbEnabled)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcIsChildSessionsEnabled(NULL, pbEnabled);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WTSGetChildSessionId(PULONG pSessionId)
|
|
|
|
{
|
2013-08-23 08:06:22 +04:00
|
|
|
return RpcGetChildSessionId(NULL, pSessionId);
|
2013-08-20 04:38:43 +04:00
|
|
|
}
|
2013-08-20 03:18:31 +04:00
|
|
|
|
|
|
|
#endif
|