diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index 9bc8ee0c7..39f8697d8 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -3,6 +3,7 @@ * Virtual Channels * * Copyright 2011 Vic Lee + * Copyright 2015 Copyright 2015 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -245,7 +246,9 @@ static WtsApiFunctionTable FreeRDP_WtsApiFunctionTable = FreeRDP_WTSGetChildSessionId, /* GetChildSessionId */ FreeRDP_WTSGetActiveConsoleSessionId, /* GetActiveConsoleSessionId */ FreeRDP_WTSLogonUser, - FreeRDP_WTSLogoffUser + FreeRDP_WTSLogoffUser, + FreeRDP_WTSStartRemoteControlSessionExW, + FreeRDP_WTSStartRemoteControlSessionExA }; PWtsApiFunctionTable FreeRDP_InitWtsApi(void) diff --git a/libfreerdp/core/server.c b/libfreerdp/core/server.c index a9406e4af..b99e3f06c 100644 --- a/libfreerdp/core/server.c +++ b/libfreerdp/core/server.c @@ -3,6 +3,7 @@ * Server Channels * * Copyright 2014 Marc-Andre Moreau + * Copyright 2015 Copyright 2015 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -628,6 +629,16 @@ BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG return FALSE; } +BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags) +{ + return FALSE; +} + +BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags) +{ + return FALSE; +} + BOOL WINAPI FreeRDP_WTSStopRemoteControlSession(ULONG LogonId) { return FALSE; diff --git a/libfreerdp/core/server.h b/libfreerdp/core/server.h index 7d53cc9b4..aa165557e 100644 --- a/libfreerdp/core/server.h +++ b/libfreerdp/core/server.h @@ -3,6 +3,7 @@ * Server Channels * * Copyright 2014 Marc-Andre Moreau + * Copyright 2015 Copyright 2015 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,6 +98,8 @@ struct WTSVirtualChannelManager BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); +BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); +BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); BOOL WINAPI FreeRDP_WTSStopRemoteControlSession(ULONG LogonId); BOOL WINAPI FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait); BOOL WINAPI FreeRDP_WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait); diff --git a/winpr/include/winpr/wtsapi.h b/winpr/include/winpr/wtsapi.h index 376a8518c..4b83c5e44 100644 --- a/winpr/include/winpr/wtsapi.h +++ b/winpr/include/winpr/wtsapi.h @@ -4,6 +4,7 @@ * * Copyright 2013 Marc-Andre Moreau * Copyright 2015 DI (FH) Martin Haimberger + * Copyright 2015 Copyright 2015 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +83,7 @@ typedef struct tagCHANNEL_PDU_HEADER UINT32 flags; } CHANNEL_PDU_HEADER, *PCHANNEL_PDU_HEADER; -#endif +#endif /* _WIN32 */ /** * These channel flags are defined in some versions of pchannel.h only @@ -952,6 +953,10 @@ typedef struct _WTSLISTENERCONFIGA #define PWTSLISTENERCONFIG PWTSLISTENERCONFIGA #endif +#define REMOTECONTROL_FLAG_DISABLE_KEYBOARD 0x00000001 +#define REMOTECONTROL_FLAG_DISABLE_MOUSE 0x00000002 +#define REMOTECONTROL_FLAG_DISABLE_INPUT REMOTECONTROL_FLAG_DISABLE_KEYBOARD | REMOTECONTROL_FLAG_DISABLE_MOUSE + #ifdef __cplusplus extern "C" { #endif @@ -961,6 +966,9 @@ WINPR_API BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId); WINPR_API BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); WINPR_API BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); +WINPR_API BOOL WINAPI WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); +WINPR_API BOOL WINAPI WTSStartRemoteControlSessionExA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); + WINPR_API BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait); WINPR_API BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait); @@ -1091,6 +1099,7 @@ WINPR_API BOOL CDECL WTSLogoffUser(HANDLE hServer); #ifdef UNICODE #define WTSStartRemoteControlSession WTSStartRemoteControlSessionW +#define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExW #define WTSConnectSession WTSConnectSessionW #define WTSEnumerateServers WTSEnumerateServersW #define WTSOpenServer WTSOpenServerW @@ -1111,6 +1120,7 @@ WINPR_API BOOL CDECL WTSLogoffUser(HANDLE hServer); #define WTSGetListenerSecurity WTSGetListenerSecurityW #else #define WTSStartRemoteControlSession WTSStartRemoteControlSessionA +#define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExA #define WTSConnectSession WTSConnectSessionA #define WTSEnumerateServers WTSEnumerateServersA #define WTSOpenServer WTSOpenServerA @@ -1151,6 +1161,11 @@ typedef BOOL (WINAPI * WTS_START_REMOTE_CONTROL_SESSION_FN_W)(LPWSTR pTargetServ typedef BOOL (WINAPI * WTS_START_REMOTE_CONTROL_SESSION_FN_A)(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers); +typedef BOOL (WINAPI * WTS_START_REMOTE_CONTROL_SESSION_EX_FN_W)(LPWSTR pTargetServerName, + ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); +typedef BOOL (WINAPI * WTS_START_REMOTE_CONTROL_SESSION_EX_FN_A)(LPSTR pTargetServerName, + ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags); + typedef BOOL (WINAPI * WTS_CONNECT_SESSION_FN_W)(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait); typedef BOOL (WINAPI * WTS_CONNECT_SESSION_FN_A)(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword, BOOL bWait); @@ -1360,6 +1375,8 @@ struct _WtsApiFunctionTable WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN pGetActiveConsoleSessionId; WTS_LOGON_USER_FN pLogonUser; WTS_LOGOFF_USER_FN pLogoffUser; + WTS_START_REMOTE_CONTROL_SESSION_EX_FN_W pStartRemoteControlSessionExW; + WTS_START_REMOTE_CONTROL_SESSION_EX_FN_A pStartRemoteControlSessionExA; }; typedef struct _WtsApiFunctionTable WtsApiFunctionTable; typedef WtsApiFunctionTable* PWtsApiFunctionTable; diff --git a/winpr/libwinpr/wtsapi/test/CMakeLists.txt b/winpr/libwinpr/wtsapi/test/CMakeLists.txt index c79d823f6..3e7e955a8 100644 --- a/winpr/libwinpr/wtsapi/test/CMakeLists.txt +++ b/winpr/libwinpr/wtsapi/test/CMakeLists.txt @@ -44,6 +44,7 @@ set(${MODULE_PREFIX}_TESTS TestWtsApiExtraLogoffSession.c TestWtsApiExtraSendMessage.c TestWtsApiExtraVirtualChannel.c + TestWtsApiExtraStartRemoteSessionEx.c ) create_test_sourcelist(${MODULE_PREFIX}_SRCS diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c b/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c new file mode 100644 index 000000000..a1d1f67f2 --- /dev/null +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c @@ -0,0 +1,29 @@ + +#include +#include +#include +#include +#include + +int TestWtsApiExtraStartRemoteSessionEx(int argc, char* argv[]) +{ + BOOL bSuccess; + ULONG logonId = 0; + char logonIdStr[10]; + + bSuccess = GetEnvironmentVariable("TEST_SESSION_LOGON_ID", logonIdStr, 10); + if(bSuccess) + { + sscanf(logonIdStr, "%u\n", &logonId); + } + + bSuccess = WTSStartRemoteControlSessionEx(NULL, logonId, VK_F10, REMOTECONTROL_KBDSHIFT_HOTKEY|REMOTECONTROL_KBDCTRL_HOTKEY, REMOTECONTROL_FLAG_DISABLE_INPUT); + + if (!bSuccess) + { + printf("WTSStartRemoteControlSessionEx failed: %d\n", (int) GetLastError()); + return -1; + } + + return 0; +} diff --git a/winpr/libwinpr/wtsapi/wtsapi.c b/winpr/libwinpr/wtsapi/wtsapi.c index 8001fffcc..9062e723d 100644 --- a/winpr/libwinpr/wtsapi/wtsapi.c +++ b/winpr/libwinpr/wtsapi/wtsapi.c @@ -4,6 +4,7 @@ * * Copyright 2013 Marc-Andre Moreau * Copyright 2015 DI (FH) Martin Haimberger + * Copyright 2015 Copyright 2015 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -219,6 +220,16 @@ BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName, ULONG TargetL WTSAPI_STUB_CALL_BOOL(StartRemoteControlSessionA, pTargetServerName, TargetLogonId, HotkeyVk, HotkeyModifiers); } +BOOL WINAPI WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags) +{ + WTSAPI_STUB_CALL_BOOL(StartRemoteControlSessionExW, pTargetServerName, TargetLogonId, HotkeyVk, HotkeyModifiers, flags); +} + +BOOL WINAPI WTSStartRemoteControlSessionExA(LPSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers, DWORD flags) +{ + WTSAPI_STUB_CALL_BOOL(StartRemoteControlSessionExA, pTargetServerName, TargetLogonId, HotkeyVk, HotkeyModifiers, flags); +} + BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId) { WTSAPI_STUB_CALL_BOOL(StopRemoteControlSession, LogonId);