FreeRDP
Loading...
Searching...
No Matches
TestWtsApiExtraStartRemoteSessionEx.c
1
2#include <winpr/crt.h>
3#include <winpr/error.h>
4#include <winpr/wtsapi.h>
5#include <winpr/input.h>
6#include <winpr/environment.h>
7
8int TestWtsApiExtraStartRemoteSessionEx(int argc, char* argv[])
9{
10 WINPR_UNUSED(argc);
11 WINPR_UNUSED(argv);
12
13 ULONG logonId = 0;
14 char logonIdStr[10] = { 0 };
15
16 DWORD bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
17 if (bSuccess > 0)
18 {
19 errno = 0;
20 logonId = strtoul(logonIdStr, NULL, 0);
21 if (errno != 0)
22 return -1;
23 }
24
25 bSuccess = WTSStartRemoteControlSessionEx(
26 NULL, logonId, VK_F10, REMOTECONTROL_KBDSHIFT_HOTKEY | REMOTECONTROL_KBDCTRL_HOTKEY,
27 REMOTECONTROL_FLAG_DISABLE_INPUT);
28
29 if (!bSuccess)
30 {
31 printf("WTSStartRemoteControlSessionEx failed: %" PRIu32 "\n", GetLastError());
32 return -1;
33 }
34
35 return 0;
36}