Merge pull request #2401 from bmiklautz/extend_wtsapi
Extend wtsapi with WTSStartRemoteControlSessionEx
This commit is contained in:
commit
b93f627f9e
3
.gitignore
vendored
3
.gitignore
vendored
@ -132,3 +132,6 @@ TAGS
|
|||||||
|
|
||||||
# packaging related files
|
# packaging related files
|
||||||
!packaging/scripts/prepare_deb_freerdp-nightly.sh
|
!packaging/scripts/prepare_deb_freerdp-nightly.sh
|
||||||
|
|
||||||
|
#
|
||||||
|
.idea
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* Virtual Channels
|
* Virtual Channels
|
||||||
*
|
*
|
||||||
* Copyright 2011 Vic Lee
|
* Copyright 2011 Vic Lee
|
||||||
|
* Copyright 2015 Copyright 2015 Thincast Technologies GmbH
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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_WTSGetChildSessionId, /* GetChildSessionId */
|
||||||
FreeRDP_WTSGetActiveConsoleSessionId, /* GetActiveConsoleSessionId */
|
FreeRDP_WTSGetActiveConsoleSessionId, /* GetActiveConsoleSessionId */
|
||||||
FreeRDP_WTSLogonUser,
|
FreeRDP_WTSLogonUser,
|
||||||
FreeRDP_WTSLogoffUser
|
FreeRDP_WTSLogoffUser,
|
||||||
|
FreeRDP_WTSStartRemoteControlSessionExW,
|
||||||
|
FreeRDP_WTSStartRemoteControlSessionExA
|
||||||
};
|
};
|
||||||
|
|
||||||
PWtsApiFunctionTable FreeRDP_InitWtsApi(void)
|
PWtsApiFunctionTable FreeRDP_InitWtsApi(void)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* Server Channels
|
* Server Channels
|
||||||
*
|
*
|
||||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
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)
|
BOOL WINAPI FreeRDP_WTSStopRemoteControlSession(ULONG LogonId)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* Server Channels
|
* Server Channels
|
||||||
*
|
*
|
||||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers);
|
||||||
BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionA(LPSTR 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_WTSStopRemoteControlSession(ULONG LogonId);
|
||||||
BOOL WINAPI FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait);
|
BOOL WINAPI FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait);
|
||||||
BOOL WINAPI FreeRDP_WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR 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 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
UINT32 flags;
|
||||||
} CHANNEL_PDU_HEADER, *PCHANNEL_PDU_HEADER;
|
} CHANNEL_PDU_HEADER, *PCHANNEL_PDU_HEADER;
|
||||||
|
|
||||||
#endif
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These channel flags are defined in some versions of pchannel.h only
|
* These channel flags are defined in some versions of pchannel.h only
|
||||||
@ -952,6 +953,10 @@ typedef struct _WTSLISTENERCONFIGA
|
|||||||
#define PWTSLISTENERCONFIG PWTSLISTENERCONFIGA
|
#define PWTSLISTENERCONFIG PWTSLISTENERCONFIGA
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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 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 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 WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword, BOOL bWait);
|
||||||
WINPR_API BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR 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
|
#ifdef UNICODE
|
||||||
#define WTSStartRemoteControlSession WTSStartRemoteControlSessionW
|
#define WTSStartRemoteControlSession WTSStartRemoteControlSessionW
|
||||||
|
#define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExW
|
||||||
#define WTSConnectSession WTSConnectSessionW
|
#define WTSConnectSession WTSConnectSessionW
|
||||||
#define WTSEnumerateServers WTSEnumerateServersW
|
#define WTSEnumerateServers WTSEnumerateServersW
|
||||||
#define WTSOpenServer WTSOpenServerW
|
#define WTSOpenServer WTSOpenServerW
|
||||||
@ -1111,6 +1120,7 @@ WINPR_API BOOL CDECL WTSLogoffUser(HANDLE hServer);
|
|||||||
#define WTSGetListenerSecurity WTSGetListenerSecurityW
|
#define WTSGetListenerSecurity WTSGetListenerSecurityW
|
||||||
#else
|
#else
|
||||||
#define WTSStartRemoteControlSession WTSStartRemoteControlSessionA
|
#define WTSStartRemoteControlSession WTSStartRemoteControlSessionA
|
||||||
|
#define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExA
|
||||||
#define WTSConnectSession WTSConnectSessionA
|
#define WTSConnectSession WTSConnectSessionA
|
||||||
#define WTSEnumerateServers WTSEnumerateServersA
|
#define WTSEnumerateServers WTSEnumerateServersA
|
||||||
#define WTSOpenServer WTSOpenServerA
|
#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,
|
typedef BOOL (WINAPI * WTS_START_REMOTE_CONTROL_SESSION_FN_A)(LPSTR pTargetServerName,
|
||||||
ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers);
|
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_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);
|
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_GET_ACTIVE_CONSOLE_SESSION_ID_FN pGetActiveConsoleSessionId;
|
||||||
WTS_LOGON_USER_FN pLogonUser;
|
WTS_LOGON_USER_FN pLogonUser;
|
||||||
WTS_LOGOFF_USER_FN pLogoffUser;
|
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 struct _WtsApiFunctionTable WtsApiFunctionTable;
|
||||||
typedef WtsApiFunctionTable* PWtsApiFunctionTable;
|
typedef WtsApiFunctionTable* PWtsApiFunctionTable;
|
||||||
|
@ -44,6 +44,7 @@ set(${MODULE_PREFIX}_TESTS
|
|||||||
TestWtsApiExtraLogoffSession.c
|
TestWtsApiExtraLogoffSession.c
|
||||||
TestWtsApiExtraSendMessage.c
|
TestWtsApiExtraSendMessage.c
|
||||||
TestWtsApiExtraVirtualChannel.c
|
TestWtsApiExtraVirtualChannel.c
|
||||||
|
TestWtsApiExtraStartRemoteSessionEx.c
|
||||||
)
|
)
|
||||||
|
|
||||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
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 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
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)
|
BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId)
|
||||||
{
|
{
|
||||||
WTSAPI_STUB_CALL_BOOL(StopRemoteControlSession, LogonId);
|
WTSAPI_STUB_CALL_BOOL(StopRemoteControlSession, LogonId);
|
||||||
|
Loading…
Reference in New Issue
Block a user