From f21faf80eea679179876b33e463988f8b0de7d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 16 Feb 2014 21:19:25 -0500 Subject: [PATCH] libfreerdp-core: add more server-side WTSAPI stubs --- libfreerdp/core/channels.c | 112 +++++----- libfreerdp/core/server.c | 443 ++++++++++++++++++++++++++++++------- libfreerdp/core/server.h | 74 ++++++- 3 files changed, 493 insertions(+), 136 deletions(-) diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index 1ba65fde0..54cfa99cf 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -151,69 +151,69 @@ static WtsApiFunctionTable FreeRDP_WtsApiFunctionTable = 0, /* dwVersion */ 0, /* dwFlags */ - NULL, /* StopRemoteControlSession */ - NULL, /* StartRemoteControlSessionW */ - NULL, /* StartRemoteControlSessionA */ - NULL, /* ConnectSessionW */ - NULL, /* ConnectSessionA */ - NULL, /* EnumerateServersW */ - NULL, /* EnumerateServersA */ - NULL, /* OpenServerW */ - NULL, /* OpenServerA */ - NULL, /* OpenServerExW */ - NULL, /* OpenServerExA */ - NULL, /* CloseServer */ - NULL, /* EnumerateSessionsW */ - NULL, /* EnumerateSessionsA */ - NULL, /* EnumerateSessionsExW */ - NULL, /* EnumerateSessionsExA */ - NULL, /* EnumerateProcessesW */ - NULL, /* EnumerateProcessesA */ - NULL, /* TerminateProcess */ - NULL, /* QuerySessionInformationW */ - NULL, /* QuerySessionInformationA */ - NULL, /* QueryUserConfigW */ - NULL, /* QueryUserConfigA */ - NULL, /* SetUserConfigW */ - NULL, /* SetUserConfigA */ - NULL, /* SendMessageW */ - NULL, /* SendMessageA */ - NULL, /* DisconnectSession */ - NULL, /* LogoffSession */ - NULL, /* ShutdownSystem */ - NULL, /* WaitSystemEvent */ + FreeRDP_WTSStopRemoteControlSession, /* StopRemoteControlSession */ + FreeRDP_WTSStartRemoteControlSessionW, /* StartRemoteControlSessionW */ + FreeRDP_WTSStartRemoteControlSessionA, /* StartRemoteControlSessionA */ + FreeRDP_WTSConnectSessionW, /* ConnectSessionW */ + FreeRDP_WTSConnectSessionA, /* ConnectSessionA */ + FreeRDP_WTSEnumerateServersW, /* EnumerateServersW */ + FreeRDP_WTSEnumerateServersA, /* EnumerateServersA */ + FreeRDP_WTSOpenServerW, /* OpenServerW */ + FreeRDP_WTSOpenServerA, /* OpenServerA */ + FreeRDP_WTSOpenServerExW, /* OpenServerExW */ + FreeRDP_WTSOpenServerExA, /* OpenServerExA */ + FreeRDP_WTSCloseServer, /* CloseServer */ + FreeRDP_WTSEnumerateSessionsW, /* EnumerateSessionsW */ + FreeRDP_WTSEnumerateSessionsA, /* EnumerateSessionsA */ + FreeRDP_WTSEnumerateSessionsExW, /* EnumerateSessionsExW */ + FreeRDP_WTSEnumerateSessionsExA, /* EnumerateSessionsExA */ + FreeRDP_WTSEnumerateProcessesW, /* EnumerateProcessesW */ + FreeRDP_WTSEnumerateProcessesA, /* EnumerateProcessesA */ + FreeRDP_WTSTerminateProcess, /* TerminateProcess */ + FreeRDP_WTSQuerySessionInformationW, /* QuerySessionInformationW */ + FreeRDP_WTSQuerySessionInformationA, /* QuerySessionInformationA */ + FreeRDP_WTSQueryUserConfigW, /* QueryUserConfigW */ + FreeRDP_WTSQueryUserConfigA, /* QueryUserConfigA */ + FreeRDP_WTSSetUserConfigW, /* SetUserConfigW */ + FreeRDP_WTSSetUserConfigA, /* SetUserConfigA */ + FreeRDP_WTSSendMessageW, /* SendMessageW */ + FreeRDP_WTSSendMessageA, /* SendMessageA */ + FreeRDP_WTSDisconnectSession, /* DisconnectSession */ + FreeRDP_WTSLogoffSession, /* LogoffSession */ + FreeRDP_WTSShutdownSystem, /* ShutdownSystem */ + FreeRDP_WTSWaitSystemEvent, /* WaitSystemEvent */ FreeRDP_WTSVirtualChannelOpen, /* VirtualChannelOpen */ FreeRDP_WTSVirtualChannelOpenEx, /* VirtualChannelOpenEx */ FreeRDP_WTSVirtualChannelClose, /* VirtualChannelClose */ FreeRDP_WTSVirtualChannelRead, /* VirtualChannelRead */ FreeRDP_WTSVirtualChannelWrite, /* VirtualChannelWrite */ - NULL, /* VirtualChannelPurgeInput */ - NULL, /* VirtualChannelPurgeOutput */ + FreeRDP_WTSVirtualChannelPurgeInput, /* VirtualChannelPurgeInput */ + FreeRDP_WTSVirtualChannelPurgeOutput, /* VirtualChannelPurgeOutput */ FreeRDP_WTSVirtualChannelQuery, /* VirtualChannelQuery */ FreeRDP_WTSFreeMemory, /* FreeMemory */ - NULL, /* RegisterSessionNotification */ - NULL, /* UnRegisterSessionNotification */ - NULL, /* RegisterSessionNotificationEx */ - NULL, /* UnRegisterSessionNotificationEx */ - NULL, /* QueryUserToken */ - NULL, /* FreeMemoryExW */ - NULL, /* FreeMemoryExA */ - NULL, /* EnumerateProcessesExW */ - NULL, /* EnumerateProcessesExA */ - NULL, /* EnumerateListenersW */ - NULL, /* EnumerateListenersA */ - NULL, /* QueryListenerConfigW */ - NULL, /* QueryListenerConfigA */ - NULL, /* CreateListenerW */ - NULL, /* CreateListenerA */ - NULL, /* SetListenerSecurityW */ - NULL, /* SetListenerSecurityA */ - NULL, /* GetListenerSecurityW */ - NULL, /* GetListenerSecurityA */ - NULL, /* EnableChildSessions */ - NULL, /* IsChildSessionsEnabled */ - NULL, /* GetChildSessionId */ - NULL /* GetActiveConsoleSessionId */ + FreeRDP_WTSRegisterSessionNotification, /* RegisterSessionNotification */ + FreeRDP_WTSUnRegisterSessionNotification, /* UnRegisterSessionNotification */ + FreeRDP_WTSRegisterSessionNotificationEx, /* RegisterSessionNotificationEx */ + FreeRDP_WTSUnRegisterSessionNotificationEx, /* UnRegisterSessionNotificationEx */ + FreeRDP_WTSQueryUserToken, /* QueryUserToken */ + FreeRDP_WTSFreeMemoryExW, /* FreeMemoryExW */ + FreeRDP_WTSFreeMemoryExA, /* FreeMemoryExA */ + FreeRDP_WTSEnumerateProcessesExW, /* EnumerateProcessesExW */ + FreeRDP_WTSEnumerateProcessesExA, /* EnumerateProcessesExA */ + FreeRDP_WTSEnumerateListenersW, /* EnumerateListenersW */ + FreeRDP_WTSEnumerateListenersA, /* EnumerateListenersA */ + FreeRDP_WTSQueryListenerConfigW, /* QueryListenerConfigW */ + FreeRDP_WTSQueryListenerConfigA, /* QueryListenerConfigA */ + FreeRDP_WTSCreateListenerW, /* CreateListenerW */ + FreeRDP_WTSCreateListenerA, /* CreateListenerA */ + FreeRDP_WTSSetListenerSecurityW, /* SetListenerSecurityW */ + FreeRDP_WTSSetListenerSecurityA, /* SetListenerSecurityA */ + FreeRDP_WTSGetListenerSecurityW, /* GetListenerSecurityW */ + FreeRDP_WTSGetListenerSecurityA, /* GetListenerSecurityA */ + FreeRDP_WTSEnableChildSessions, /* EnableChildSessions */ + FreeRDP_WTSIsChildSessionsEnabled, /* IsChildSessionsEnabled */ + FreeRDP_WTSGetChildSessionId, /* GetChildSessionId */ + FreeRDP_WTSGetActiveConsoleSessionId /* GetActiveConsoleSessionId */ }; PWtsApiFunctionTable FreeRDP_InitWtsApi(void) diff --git a/libfreerdp/core/server.c b/libfreerdp/core/server.c index 7940030c6..a7f62066e 100644 --- a/libfreerdp/core/server.c +++ b/libfreerdp/core/server.c @@ -631,85 +631,161 @@ HANDLE WTSVirtualChannelManagerOpenEx(WTSVirtualChannelManager* vcm, LPSTR pVirt return channel; } -BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned) +BOOL FreeRDP_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers) { - void* pfd; - BOOL bval; - void* fds[10]; - HANDLE hEvent; - int fds_count = 0; - BOOL status = FALSE; - rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle; - ZeroMemory(fds, sizeof(fds)); - - hEvent = MessageQueue_Event(channel->queue); - - switch (WtsVirtualClass) - { - case WTSVirtualFileHandle: - - pfd = GetEventWaitObject(hEvent); - - if (pfd) - { - fds[fds_count] = pfd; - (fds_count)++; - } - - *ppBuffer = malloc(sizeof(void*)); - CopyMemory(*ppBuffer, &fds[0], sizeof(void*)); - *pBytesReturned = sizeof(void*); - status = TRUE; - break; - - case WTSVirtualEventHandle: - *ppBuffer = malloc(sizeof(HANDLE)); - CopyMemory(*ppBuffer, &(hEvent), sizeof(HANDLE)); - *pBytesReturned = sizeof(void*); - status = TRUE; - break; - - case WTSVirtualChannelReady: - if (channel->channelType == RDP_PEER_CHANNEL_TYPE_SVC) - { - bval = TRUE; - status = TRUE; - } - else - { - switch (channel->dvc_open_state) - { - case DVC_OPEN_STATE_NONE: - bval = FALSE; - status = TRUE; - break; - - case DVC_OPEN_STATE_SUCCEEDED: - bval = TRUE; - status = TRUE; - break; - - default: - bval = FALSE; - status = FALSE; - break; - } - } - - *ppBuffer = malloc(sizeof(BOOL)); - CopyMemory(*ppBuffer, &bval, sizeof(BOOL)); - *pBytesReturned = sizeof(BOOL); - break; - - default: - break; - } - return status; + return FALSE; } -VOID FreeRDP_WTSFreeMemory(PVOID pMemory) +BOOL FreeRDP_WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers) { - free(pMemory); + return FALSE; +} + +BOOL FreeRDP_WTSStopRemoteControlSession(ULONG LogonId) +{ + return FALSE; +} + +BOOL FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount) +{ + return FALSE; +} + +HANDLE FreeRDP_WTSOpenServerW(LPWSTR pServerName) +{ + return INVALID_HANDLE_VALUE; +} + +HANDLE FreeRDP_WTSOpenServerA(LPSTR pServerName) +{ + return INVALID_HANDLE_VALUE; +} + +HANDLE FreeRDP_WTSOpenServerExW(LPWSTR pServerName) +{ + return INVALID_HANDLE_VALUE; +} + +HANDLE FreeRDP_WTSOpenServerExA(LPSTR pServerName) +{ + return INVALID_HANDLE_VALUE; +} + +VOID FreeRDP_WTSCloseServer(HANDLE hServer) +{ + return; +} + +BOOL FreeRDP_WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1A* ppSessionInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPSTR* ppBuffer, DWORD* pBytesReturned) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, + LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, + LPSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSLogoffSession(HANDLE hServer, DWORD SessionId, BOOL bWait) +{ + return FALSE; +} + +BOOL FreeRDP_WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag) +{ + return FALSE; +} + +BOOL FreeRDP_WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags) +{ + return FALSE; } HANDLE FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName) @@ -767,7 +843,6 @@ BOOL FreeRDP_WTSVirtualChannelClose(HANDLE hChannelHandle) return TRUE; } - BOOL FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead) { BYTE* buffer; @@ -868,3 +943,219 @@ BOOL FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG L return TRUE; } + +BOOL FreeRDP_WTSVirtualChannelPurgeInput(HANDLE hChannelHandle) +{ + return TRUE; +} + +BOOL FreeRDP_WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle) +{ + return TRUE; +} + +BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned) +{ + void* pfd; + BOOL bval; + void* fds[10]; + HANDLE hEvent; + int fds_count = 0; + BOOL status = FALSE; + rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle; + ZeroMemory(fds, sizeof(fds)); + + hEvent = MessageQueue_Event(channel->queue); + + switch (WtsVirtualClass) + { + case WTSVirtualFileHandle: + + pfd = GetEventWaitObject(hEvent); + + if (pfd) + { + fds[fds_count] = pfd; + (fds_count)++; + } + + *ppBuffer = malloc(sizeof(void*)); + CopyMemory(*ppBuffer, &fds[0], sizeof(void*)); + *pBytesReturned = sizeof(void*); + status = TRUE; + break; + + case WTSVirtualEventHandle: + *ppBuffer = malloc(sizeof(HANDLE)); + CopyMemory(*ppBuffer, &(hEvent), sizeof(HANDLE)); + *pBytesReturned = sizeof(void*); + status = TRUE; + break; + + case WTSVirtualChannelReady: + if (channel->channelType == RDP_PEER_CHANNEL_TYPE_SVC) + { + bval = TRUE; + status = TRUE; + } + else + { + switch (channel->dvc_open_state) + { + case DVC_OPEN_STATE_NONE: + bval = FALSE; + status = TRUE; + break; + + case DVC_OPEN_STATE_SUCCEEDED: + bval = TRUE; + status = TRUE; + break; + + default: + bval = FALSE; + status = FALSE; + break; + } + } + + *ppBuffer = malloc(sizeof(BOOL)); + CopyMemory(*ppBuffer, &bval, sizeof(BOOL)); + *pBytesReturned = sizeof(BOOL); + break; + + default: + break; + } + return status; +} + +VOID FreeRDP_WTSFreeMemory(PVOID pMemory) +{ + free(pMemory); +} + +BOOL FreeRDP_WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries) +{ + return FALSE; +} + +BOOL FreeRDP_WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries) +{ + return FALSE; +} + +BOOL FreeRDP_WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags) +{ + return FALSE; +} + +BOOL FreeRDP_WTSUnRegisterSessionNotification(HWND hWnd) +{ + return FALSE; +} + +BOOL FreeRDP_WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags) +{ + return FALSE; +} + +BOOL FreeRDP_WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQueryUserToken(ULONG SessionId, PHANDLE phToken) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPWSTR* ppProcessInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPSTR* ppProcessInfo, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEW pListeners, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEA pListeners, DWORD* pCount) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer) +{ + return FALSE; +} + +BOOL FreeRDP_WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer) +{ + return FALSE; +} + +BOOL FreeRDP_WTSCreateListenerW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer, DWORD flag) +{ + return FALSE; +} + +BOOL FreeRDP_WTSCreateListenerA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer, DWORD flag) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor) +{ + return FALSE; +} + +BOOL FreeRDP_WTSSetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor) +{ + return FALSE; +} + +BOOL FreeRDP_WTSGetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded) +{ + return FALSE; +} + +BOOL FreeRDP_WTSGetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded) +{ + return FALSE; +} + +BOOL FreeRDP_WTSEnableChildSessions(BOOL bEnable) +{ + return FALSE; +} + +BOOL FreeRDP_WTSIsChildSessionsEnabled(PBOOL pbEnabled) +{ + return FALSE; +} + +BOOL FreeRDP_WTSGetChildSessionId(PULONG pSessionId) +{ + return FALSE; +} + +DWORD FreeRDP_WTSGetActiveConsoleSessionId(void) +{ + return 0xFFFFFFFF; +} diff --git a/libfreerdp/core/server.h b/libfreerdp/core/server.h index e643d9462..e15d7933d 100644 --- a/libfreerdp/core/server.h +++ b/libfreerdp/core/server.h @@ -90,14 +90,80 @@ struct WTSVirtualChannelManager wArrayList* dynamicVirtualChannels; }; -BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned); -VOID FreeRDP_WTSFreeMemory(PVOID pMemory); - +BOOL FreeRDP_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); +BOOL FreeRDP_WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); +BOOL FreeRDP_WTSStopRemoteControlSession(ULONG LogonId); +BOOL FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait); +BOOL FreeRDP_WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait); +BOOL FreeRDP_WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount); +HANDLE FreeRDP_WTSOpenServerW(LPWSTR pServerName); +HANDLE FreeRDP_WTSOpenServerA(LPSTR pServerName); +HANDLE FreeRDP_WTSOpenServerExW(LPWSTR pServerName); +HANDLE FreeRDP_WTSOpenServerExA(LPSTR pServerName); +VOID FreeRDP_WTSCloseServer(HANDLE hServer); +BOOL FreeRDP_WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1A* ppSessionInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount); +BOOL FreeRDP_WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode); +BOOL FreeRDP_WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned); +BOOL FreeRDP_WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPSTR* ppBuffer, DWORD* pBytesReturned); +BOOL FreeRDP_WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned); +BOOL FreeRDP_WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned); +BOOL FreeRDP_WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength); +BOOL FreeRDP_WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer, DWORD DataLength); +BOOL FreeRDP_WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength, + LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait); +BOOL FreeRDP_WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength, + LPSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait); +BOOL FreeRDP_WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait); +BOOL FreeRDP_WTSLogoffSession(HANDLE hServer, DWORD SessionId, BOOL bWait); +BOOL FreeRDP_WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag); +BOOL FreeRDP_WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags); HANDLE FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName); HANDLE FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags); BOOL FreeRDP_WTSVirtualChannelClose(HANDLE hChannelHandle); - BOOL FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead); BOOL FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten); +BOOL FreeRDP_WTSVirtualChannelPurgeInput(HANDLE hChannelHandle); +BOOL FreeRDP_WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle); +BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned); +VOID FreeRDP_WTSFreeMemory(PVOID pMemory); +BOOL FreeRDP_WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries); +BOOL FreeRDP_WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries); +BOOL FreeRDP_WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags); +BOOL FreeRDP_WTSUnRegisterSessionNotification(HWND hWnd); +BOOL FreeRDP_WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags); +BOOL FreeRDP_WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd); +BOOL FreeRDP_WTSQueryUserToken(ULONG SessionId, PHANDLE phToken); +BOOL FreeRDP_WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPWSTR* ppProcessInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPSTR* ppProcessInfo, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEW pListeners, DWORD* pCount); +BOOL FreeRDP_WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEA pListeners, DWORD* pCount); +BOOL FreeRDP_WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer); +BOOL FreeRDP_WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved, DWORD Reserved, LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer); +BOOL FreeRDP_WTSCreateListenerW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, PWTSLISTENERCONFIGW pBuffer, DWORD flag); +BOOL FreeRDP_WTSCreateListenerA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, PWTSLISTENERCONFIGA pBuffer, DWORD flag); +BOOL FreeRDP_WTSSetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor); +BOOL FreeRDP_WTSSetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor); +BOOL FreeRDP_WTSGetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPWSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded); +BOOL FreeRDP_WTSGetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved, + LPSTR pListenerName, SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded); +BOOL FreeRDP_WTSEnableChildSessions(BOOL bEnable); +BOOL FreeRDP_WTSIsChildSessionsEnabled(PBOOL pbEnabled); +BOOL FreeRDP_WTSGetChildSessionId(PULONG pSessionId); +DWORD FreeRDP_WTSGetActiveConsoleSessionId(void); #endif /* FREERDP_CORE_SERVER_H */