Export (0) Print
Expand All
Expand Minimize

WTSConnectSession function

Connects a Remote Desktop Services session to an existing session on the local computer.

Syntax


BOOL WINAPI WTSConnectSession(
  _In_  ULONG LogonId,
  _In_  ULONG TargetLogonId,
  _In_  PTSTR pPassword,
  _In_  BOOL bWait
);

Parameters

LogonId [in]

The logon ID of the session to connect to. The user of that session must have permissions to connect to an existing session. The output of this session will be routed to the session identified by the TargetLogonId parameter.

This can be LOGONID_CURRENT to use the current session.

TargetLogonId [in]

The logon ID of the session to receive the output of the session represented by the LogonId parameter. The output of the session identified by the LogonId parameter will be routed to this session.

This can be LOGONID_CURRENT to use the current session.

pPassword [in]

A pointer to the password for the user account that is specified in the LogonId parameter. The value of pPassword can be an empty string if the caller is logged on using the same domain name and user name as the logon ID. The value of pPassword cannot be NULL.

bWait [in]

Indicates whether the operation is synchronous. Specify TRUE to wait for the operation to complete, or FALSE to return immediately.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Either the LogonId or TargetLogonId parameter can be LOGONID_CURRENT, but not both.

Requirements

Minimum supported client

Windows Vista with SP1

Minimum supported server

Windows Server 2008

Header

Wtsapi32.h

Library

Wtsapi32.lib

DLL

Wtsapi32.dll

Unicode and ANSI names

WTSConnectSessionW (Unicode) and WTSConnectSessionA (ANSI)

 

 

Show:
© 2014 Microsoft