18.104.22.168.1 User-Initiated on Client
The user can initiate a client-side disconnect by closing the RDP client application. To implement this type of disconnection the client can initiate an immediate disconnect by sending the MCS Disconnect Provider Ultimatum PDU (with the reason code set to "user requested") and then closing the connection. Alternatively, the client can first notify the server of the intent to disconnect by sending the Shutdown Request PDU and then waiting for a response. The server response to this PDU is determined by whether the session is associated with a logged-on user account.
If a logged-on user account is associated with the session, the server always denies the shutdown request and sends the client a Shutdown Request Denied PDU. At this point the client behavior is implementation-dependent (the client can, for example, choose to display a dialog box specifying that the session will be disconnected). If the decision is made to proceed with the disconnection, the client sends the server an MCS Disconnect Provider Ultimatum PDU (with the reason code set to "user requested") and closes the connection.
If a logged-on user account is not associated with the session, the server closes the connection immediately after receiving the Shutdown Request PDU.
The sending and processing of the Shutdown Request PDU is described in sections 22.214.171.124.1 and 126.96.36.199.1 respectively. The sending and processing of the Shutdown Request Denied PDU is described in sections 188.8.131.52.2 and 184.108.40.206.2 respectively.