3.3.4.1.3 RpcConnect (Opnum 2)
The RpcConnect method reconnects a session handle returned by RpcOpenSession to another specified session on the terminal server. This method MUST be called after RpcOpenSession. If the method succeeds, the state of the session is State_Active as defined in the WINSTATIONSTATECLASS enumeration (section 2.2.1.9).
The caller MUST have WINSTATION_CONNECT permission to connect the current session and the caller MUST have WINSTATION_DISCONNECT permission to disconnect the target session. For each aforementioned required permission, the method checks whether the caller has the permission (section 3.1.1) by setting the Access Request mask to the specific permission, and fails if the caller does not have the permission.
-
HRESULT RpcConnect( [in] SESSION_HANDLE hSession, [in] LONG TargetSessionId, [in, string] WCHAR* szPassword );
hSession: The handle to a session returned by RpcOpenSession. This is of type SESSION_HANDLE.
TargetSessionId: The identifier of the session on the terminal server to which to reconnect the session handle. This session MUST be present on the terminal server or this call will fail.
szPassword: The password of the user connected to the current session. This is an optional field. If not specified, the terminal server will impersonate the current user, making the call and checking whether it has permission to disconnect the current session.
Return Values: The method MUST return S_OK (0x00000000) on success; otherwise, it MUST return an implementation-specific negative value.
-
Return value/code
Description
0x00000000
S_OK
Successful completion.