wtsapi: add WTSStartRemoteControlSessionEx
WTSStartRemoteControlSession doesn't allow to specify additional flags therefore add a new extended version WTSStartRemoteControlSessionEx with an additional "flags" parameter. The following flags are defined: REMOTECONTROL_FLAG_DISABLE_KEYBOARD - disable keyboard input REMOTECONTROL_FLAG_DISABLE_MOUSE - disable mouse input REMOTECONTROL_FLAG_DISABLE_INPUT - disable input (keyboard and mouse)
This commit is contained in:
parent
114a492a4e
commit
0b902eeb5d
@ -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)
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Server Channels
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* 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;
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Server Channels
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* 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);
|
||||
|
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
||||
* 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;
|
||||
|
@ -44,6 +44,7 @@ set(${MODULE_PREFIX}_TESTS
|
||||
TestWtsApiExtraLogoffSession.c
|
||||
TestWtsApiExtraSendMessage.c
|
||||
TestWtsApiExtraVirtualChannel.c
|
||||
TestWtsApiExtraStartRemoteSessionEx.c
|
||||
)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
|
@ -0,0 +1,29 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
#include <winpr/input.h>
|
||||
#include <winpr/environment.h>
|
||||
|
||||
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;
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
||||
* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user