2015-02-16 14:16:54 +03:00
|
|
|
|
|
|
|
#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];
|
|
|
|
|
2016-08-10 13:49:36 +03:00
|
|
|
bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
|
2019-11-06 17:24:51 +03:00
|
|
|
if (bSuccess)
|
2015-02-16 14:16:54 +03:00
|
|
|
{
|
|
|
|
sscanf(logonIdStr, "%u\n", &logonId);
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
bSuccess = WTSStartRemoteControlSessionEx(
|
|
|
|
NULL, logonId, VK_F10, REMOTECONTROL_KBDSHIFT_HOTKEY | REMOTECONTROL_KBDCTRL_HOTKEY,
|
|
|
|
REMOTECONTROL_FLAG_DISABLE_INPUT);
|
2015-02-16 14:16:54 +03:00
|
|
|
|
|
|
|
if (!bSuccess)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("WTSStartRemoteControlSessionEx failed: %" PRIu32 "\n", GetLastError());
|
2015-02-16 14:16:54 +03:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|