Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
36
third_party/FreeRDP/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c
vendored
Normal file
36
third_party/FreeRDP/winpr/libwinpr/wtsapi/test/TestWtsApiExtraStartRemoteSessionEx.c
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
#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[])
|
||||
{
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
ULONG logonId = 0;
|
||||
char logonIdStr[10] = WINPR_C_ARRAY_INIT;
|
||||
|
||||
DWORD bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
|
||||
if (bSuccess > 0)
|
||||
{
|
||||
errno = 0;
|
||||
logonId = strtoul(logonIdStr, nullptr, 0);
|
||||
if (errno != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bSuccess = WTSStartRemoteControlSessionEx(
|
||||
nullptr, 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;
|
||||
}
|
||||
Reference in New Issue
Block a user