Debian Codegraph @

winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c

raw
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
8 int TestWtsApiExtraStartRemoteSessionEx(int argc, char* argv[])
9 {
10 WINPR_UNUSED(argc);
11 WINPR_UNUSED(argv);
12
13 ULONG logonId = 0;
14 char logonIdStr[10] = WINPR_C_ARRAY_INIT;
15
16 DWORD bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
17 if (bSuccess > 0)
18 {
19 errno = 0;
20 logonId = strtoul(logonIdStr, nullptr, 0);
21 if (errno != 0)
22 return -1;
23 }
24
25 bSuccess = WTSStartRemoteControlSessionEx(
26 nullptr, 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 }