3.7.4.1.12 RpcWinStationDisconnect (Opnum 13)

The RpcWinStationDisconnect method disconnects, on the server, the terminal server client from a session. If the method succeeds, the state of the session is State_Disconnected as defined in the WINSTATIONSTATECLASS enumeration (section 2.2.1.9).

The caller of this method MUST have WINSTATION_DISCONNECT permission on the session to disconnect. The method checks whether the caller has WINSTATION_DISCONNECT permission (section 3.1.1) by setting it as the Access Request mask, and fails if the caller does not have the permission.<180>

 BOOLEAN RpcWinStationDisconnect(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in] DWORD LogonId,
   [in] BOOLEAN bWait
 );

hServer: Handle to the server object. This is of type SERVER_HANDLE. hServer MUST be obtained from a previous call to RpcWinStationOpenServer.

pResult:  Failure error code if the call to RpcWinStationDisconnect failed. If the call was successful, this parameter MUST be STATUS_SUCCESS (0x00000000).

Value

Meaning

STATUS_SUCCESS

0x00000000

The call succeeded.

STATUS_ACCESS_DENIED

0xC0000022

The caller does not have permission to disconnect the session.

LogonId:  The ID of the session to disconnect. Can be LOGONID_CURRENT to indicate the current session.

bWait:  TRUE to wait for the disconnect to complete before returning, FALSE otherwise.<181>

Return Values:  Returns TRUE if the call succeeded, or FALSE if the method failed. On failure, pResult indicates the failure status code.

Return value/code

Description

0x01

TRUE

Successful completion.

0x00

FALSE

Method call failed.