summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c
blob: 179d33b2a8816e1673a86c36724952c2a571ee35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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 = GetEnvironmentVariableA("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: %" PRIu32 "\n", GetLastError());
		return -1;
	}

	return 0;
}