3.3.4.2.1 RpcWaitForSessionState (Opnum 0)

The RpcWaitForSessionState method blocks until the state of the specified session running on a terminal server changes to the desired state. The caller MUST have WINSTATION_QUERY permission for the session. The method checks whether the caller has WINSTATION_QUERY permission (section 3.1.1) by setting it as the Access Request mask, and fails if the caller does not have the permission.

 HRESULT RpcWaitForSessionState(
   [in] handle_t hBinding,
   [in] LONG SessionId,
   [in] LONG State,
   [in] ULONG Timeout
 );

hBinding:  The RPC binding handle. For more information, see [MSDN-RPCBIND].

SessionId:  The ID of the session for which to await state change. This MUST NOT be the session ID of any of the listener sessions.

State:  The desired state of the session, as specified in WINSTATIONSTATECLASS (section 2.2.1.9) with the exception of State_Idle and State_Listen, for which to wait. The call will return when the session changes to this state.

Timeout:  Maximum time, in milliseconds, to wait for the call to return.

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.