set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
- MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-handle winpr-crt)
+ MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-wtsapi winpr-handle winpr-crt)
if(MONOLITHIC_BUILD)
set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)
#include "rdp.h"
#include "client.h"
+#include "server.h"
#include "channels.h"
BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, BYTE* data, int size)
NULL, /* LogoffSession */
NULL, /* ShutdownSystem */
NULL, /* WaitSystemEvent */
- NULL, /* VirtualChannelOpen */
- NULL, /* VirtualChannelOpenEx */
- NULL, /* VirtualChannelClose */
- NULL, /* VirtualChannelRead */
- NULL, /* VirtualChannelWrite */
+ FreeRDP_WTSVirtualChannelOpen, /* VirtualChannelOpen */
+ FreeRDP_WTSVirtualChannelOpenEx, /* VirtualChannelOpenEx */
+ FreeRDP_WTSVirtualChannelClose, /* VirtualChannelClose */
+ FreeRDP_WTSVirtualChannelRead, /* VirtualChannelRead */
+ FreeRDP_WTSVirtualChannelWrite, /* VirtualChannelWrite */
NULL, /* VirtualChannelPurgeInput */
NULL, /* VirtualChannelPurgeOutput */
- NULL, /* VirtualChannelQuery */
- NULL, /* FreeMemory */
+ FreeRDP_WTSVirtualChannelQuery, /* VirtualChannelQuery */
+ FreeRDP_WTSFreeMemory, /* FreeMemory */
NULL, /* RegisterSessionNotification */
NULL, /* UnRegisterSessionNotification */
NULL, /* RegisterSessionNotificationEx */
#include <winpr/crt.h>
#include <winpr/stream.h>
+#include <winpr/wtsapi.h>
#include <freerdp/freerdp.h>
#include <freerdp/error.h>
return channel;
}
-BOOL WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned)
+BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned)
{
void* pfd;
BOOL bval;
return status;
}
-VOID WTSFreeMemory(PVOID pMemory)
+VOID FreeRDP_WTSFreeMemory(PVOID pMemory)
{
free(pMemory);
}
-BOOL WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
+HANDLE FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
+{
+ return INVALID_HANDLE_VALUE;
+}
+
+HANDLE FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
+{
+ return INVALID_HANDLE_VALUE;
+}
+
+BOOL FreeRDP_WTSVirtualChannelClose(HANDLE hChannelHandle)
+{
+ wStream* s;
+ rdpMcs* mcs;
+ WTSVirtualChannelManager* vcm;
+ rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
+
+ if (channel)
+ {
+ vcm = channel->vcm;
+ mcs = vcm->client->context->rdp->mcs;
+
+ if (channel->channelType == RDP_PEER_CHANNEL_TYPE_SVC)
+ {
+ if (channel->index < mcs->channelCount)
+ mcs->channels[channel->index].handle = NULL;
+ }
+ else
+ {
+ ArrayList_Remove(vcm->dynamicVirtualChannels, channel);
+
+ if (channel->dvc_open_state == DVC_OPEN_STATE_SUCCEEDED)
+ {
+ s = Stream_New(NULL, 8);
+ wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channelId);
+ WTSVirtualChannelWrite(vcm->drdynvc_channel, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), NULL);
+ Stream_Free(s, TRUE);
+ }
+ }
+
+ if (channel->receiveData)
+ Stream_Free(channel->receiveData, TRUE);
+
+ if (channel->queue)
+ {
+ MessageQueue_Free(channel->queue);
+ channel->queue = NULL;
+ }
+
+ free(channel);
+ }
+
+ return TRUE;
+}
+
+
+BOOL FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead)
{
BYTE* buffer;
UINT32 length;
return TRUE;
}
-BOOL WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
+BOOL FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten)
{
wStream* s;
int cbLen;
return TRUE;
}
-
-BOOL WTSVirtualChannelClose(HANDLE hChannelHandle)
-{
- wStream* s;
- rdpMcs* mcs;
- WTSVirtualChannelManager* vcm;
- rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
-
- if (channel)
- {
- vcm = channel->vcm;
- mcs = vcm->client->context->rdp->mcs;
-
- if (channel->channelType == RDP_PEER_CHANNEL_TYPE_SVC)
- {
- if (channel->index < mcs->channelCount)
- mcs->channels[channel->index].handle = NULL;
- }
- else
- {
- ArrayList_Remove(vcm->dynamicVirtualChannels, channel);
-
- if (channel->dvc_open_state == DVC_OPEN_STATE_SUCCEEDED)
- {
- s = Stream_New(NULL, 8);
- wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channelId);
- WTSVirtualChannelWrite(vcm->drdynvc_channel, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), NULL);
- Stream_Free(s, TRUE);
- }
- }
-
- if (channel->receiveData)
- Stream_Free(channel->receiveData, TRUE);
-
- if (channel->queue)
- {
- MessageQueue_Free(channel->queue);
- channel->queue = NULL;
- }
-
- free(channel);
- }
-
- return TRUE;
-}
-
wArrayList* dynamicVirtualChannels;
};
+BOOL FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned);
+VOID FreeRDP_WTSFreeMemory(PVOID pMemory);
+
+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);
+
#endif /* FREERDP_CORE_SERVER_H */
if (!winpr_Handle_GetInfo(lpHandles[index], &Type, &Object))
{
fprintf(stderr, "WaitForMultipleObjects: invalid handle\n");
+
return WAIT_FAILED;
}
set(MODULE_PREFIX "WINPR_WTSAPI")
set(${MODULE_PREFIX}_SRCS
- wtsapi.c
- wtsrpc_c.c
- wtsrpc_c.h)
+ wtsapi.c)
if(MSVC AND (NOT MONOLITHIC_BUILD))
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464/
*/
-static PWtsApiFunctionTable g_WtsApi;
+static PWtsApiFunctionTable g_WtsApi = NULL;
#ifndef _WIN32
-#include "wtsrpc_c.h"
-
BOOL WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
{
if (!g_WtsApi || !g_WtsApi->StartRemoteControlSessionW)
+++ /dev/null
-/**
- * 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>
-
-#include <winpr/wtsapi.h>
-
-#ifndef _WIN32
-
-#include "wtsrpc_c.h"
-
-/**
- * RPC Client Stubs
- */
-
-BOOL RpcStartRemoteControlSession(void* context, LPWSTR pTargetServerName,
- ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
-{
- return TRUE;
-}
-
-BOOL RpcStopRemoteControlSession(void* context, ULONG LogonId)
-{
- return TRUE;
-}
-
-BOOL RpcConnectSession(void* context, ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait)
-{
- return TRUE;
-}
-
-BOOL RpcEnumerateServers(void* context, LPWSTR pDomainName, DWORD Reserved,
- DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
-{
- return TRUE;
-}
-
-HANDLE RpcOpenServer(void* context, LPWSTR pServerName)
-{
- return NULL;
-}
-
-HANDLE RpcOpenServerEx(void* context, LPWSTR pServerName)
-{
- return NULL;
-}
-
-VOID RpcCloseServer(void* context, HANDLE hServer)
-{
-
-}
-
-BOOL RpcEnumerateSessions(void* context, HANDLE hServer, DWORD Reserved,
- DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
-{
- return TRUE;
-}
-
-BOOL RpcEnumerateSessionsEx(void* context, HANDLE hServer, DWORD* pLevel,
- DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount)
-{
- return TRUE;
-}
-
-BOOL RpcEnumerateProcesses(void* context, HANDLE hServer, DWORD Reserved,
- DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
-{
- return TRUE;
-}
-
-BOOL RpcTerminateProcess(void* context, HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
-{
- return TRUE;
-}
-
-BOOL RpcQuerySessionInformation(void* context, HANDLE hServer, DWORD SessionId,
- WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
-{
- return TRUE;
-}
-
-BOOL RpcQueryUserConfig(void* context, LPWSTR pServerName, LPWSTR pUserName,
- WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
-{
- return TRUE;
-}
-
-BOOL RpcSetUserConfig(void* context, LPWSTR pServerName, LPWSTR pUserName,
- WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength)
-{
- return TRUE;
-}
-
-BOOL RpcSendMessage(void* context, HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength,
- LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait)
-{
- return TRUE;
-}
-
-BOOL RpcDisconnectSession(void* context, HANDLE hServer, DWORD SessionId, BOOL bWait)
-{
- return TRUE;
-}
-
-BOOL RpcLogoffSession(void* context, HANDLE hServer, DWORD SessionId, BOOL bWait)
-{
- return TRUE;
-}
-
-BOOL RpcShutdownSystem(void* context, HANDLE hServer, DWORD ShutdownFlag)
-{
- return TRUE;
-}
-
-BOOL RpcRegisterSessionNotification(void* context, HWND hWnd, DWORD dwFlags)
-{
- return TRUE;
-}
-
-BOOL RpcUnRegisterSessionNotification(void* context, HWND hWnd)
-{
- return TRUE;
-}
-
-BOOL RpcRegisterSessionNotificationEx(void* context, HANDLE hServer, HWND hWnd, DWORD dwFlags)
-{
- return TRUE;
-}
-
-BOOL RpcUnRegisterSessionNotificationEx(void* context, HANDLE hServer, HWND hWnd)
-{
- return TRUE;
-}
-
-BOOL RpcEnableChildSessions(void* context, BOOL bEnable)
-{
- return TRUE;
-}
-
-BOOL RpcIsChildSessionsEnabled(void* context, PBOOL pbEnabled)
-{
- return TRUE;
-}
-
-BOOL RpcGetChildSessionId(void* context, PULONG pSessionId)
-{
- return TRUE;
-}
-
-#endif
+++ /dev/null
-/**
- * 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.
- */
-
-#ifndef WINPR_WTSAPI_RPC_CLIENT_STUBS_H
-#define WINPR_WTSAPI_RPC_CLIENT_STUBS_H
-
-/**
- * RPC Client Stubs
- */
-
-BOOL RpcStartRemoteControlSession(void* context, LPWSTR pTargetServerName,
- ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers);
-BOOL RpcStopRemoteControlSession(void* context, ULONG LogonId);
-
-BOOL RpcConnectSession(void* context, ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait);
-
-BOOL RpcEnumerateServers(void* context, LPWSTR pDomainName, DWORD Reserved,
- DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount);
-
-HANDLE RpcOpenServer(void* context, LPWSTR pServerName);
-HANDLE RpcOpenServerEx(void* context, LPWSTR pServerName);
-VOID RpcCloseServer(void* context, HANDLE hServer);
-
-BOOL RpcEnumerateSessions(void* context, HANDLE hServer, DWORD Reserved,
- DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount);
-BOOL RpcEnumerateSessionsEx(void* context, HANDLE hServer, DWORD* pLevel,
- DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount);
-
-BOOL RpcEnumerateProcesses(void* context, HANDLE hServer, DWORD Reserved,
- DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount);
-BOOL RpcTerminateProcess(void* context, HANDLE hServer, DWORD ProcessId, DWORD ExitCode);
-
-BOOL RpcQuerySessionInformation(void* context, HANDLE hServer, DWORD SessionId,
- WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned);
-
-BOOL RpcQueryUserConfig(void* context, LPWSTR pServerName, LPWSTR pUserName,
- WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned);
-BOOL RpcSetUserConfig(void* context, LPWSTR pServerName, LPWSTR pUserName,
- WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer, DWORD DataLength);
-
-BOOL RpcSendMessage(void* context, HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength,
- LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait);
-
-BOOL RpcDisconnectSession(void* context, HANDLE hServer, DWORD SessionId, BOOL bWait);
-
-BOOL RpcLogoffSession(void* context, HANDLE hServer, DWORD SessionId, BOOL bWait);
-
-BOOL RpcShutdownSystem(void* context, HANDLE hServer, DWORD ShutdownFlag);
-
-BOOL RpcRegisterSessionNotification(void* context, HWND hWnd, DWORD dwFlags);
-BOOL RpcUnRegisterSessionNotification(void* context, HWND hWnd);
-
-BOOL RpcRegisterSessionNotificationEx(void* context, HANDLE hServer, HWND hWnd, DWORD dwFlags);
-BOOL RpcUnRegisterSessionNotificationEx(void* context, HANDLE hServer, HWND hWnd);
-
-BOOL RpcEnableChildSessions(void* context, BOOL bEnable);
-BOOL RpcIsChildSessionsEnabled(void* context, PBOOL pbEnabled);
-BOOL RpcGetChildSessionId(void* context, PULONG pSessionId);
-
-#endif /* WINPR_WTSAPI_RPC_CLIENT_STUBS_H */