3.4 Example 4: Redirecting Clipboard Data

This example demonstrates the process of redirecting clipboard data on a remote application running on an RD Session Host server as described in section 2.5.2.2.

Prerequisites

The RDP client is connected to the RD Session Host. The RDP connection supports clipboard redirection. The remote desktop or remote application is running on the RD Session Host. The RD Session Host has permission to access the clipboard on the RDP client.

Initial System State

The RDP client and RD Session Host are connected but no clipboard operations between the client applications are possible.

Final System State

The RDP client application will be able to do clipboard operations between client applications.

Sequence of Events

The clipboard initialization sequence and the clipboard data transfer sequence is illustrated in the following diagrams.

Clipboard initialization sequence

Figure 11: Clipboard initialization sequence

Data transfer sequence

Figure 12: Data transfer sequence

The steps of the clipboard initialization sequence and data transfer sequence are as follows:

  1. The RDP client establishes a Remote Desktop Protocol (RDP) connection with the RD Session Host.

  2. The RD Session Host sends a Clipboard Capabilities protocol data unit (PDU) to the RDP client to advertise the capabilities that it supports.

  3. The RD Session Host sends a Monitor Ready PDU to the RDP client.

  4. Upon receiving the Monitor Ready PDU, the RDP client transmits its capabilities to the RD Session Host by using a Clipboard Capabilities PDU. For more details on steps 2, 3, and 4, see [MS-RDPECLIP] section 2.2.2.

  5. The final stage of the Initialization Sequence involves synchronizing the clipboard formats on the RD Session Host clipboard and the RDP client. This is accomplished by effectively mimicking a copy operation on the RDP client by forcing it to send a Format List PDU to the RD Session Host.

  6. The RD Session Host responds with a Format List Response PDU.

  7. To copy the data, the RDP client sends a Format List PDU to the RD Session Host.

  8. The RD Session Host responds with a Format List Response PDU. For more details on steps 5 through 8, see [MS-RDPECLIP] section 2.2.3.

  9. The RD Session Host sends a Lock Clipboard Data PDU to retain data on the clipboard until Unlock Clipboard Data PDU, as described in [MS-RDPECLIP] section 2.2.4, is received<5>.

  10. The RD Session Host sends a Format Data Request PDU in cases of generic or metafile data or a File Contents Request PDU in cases of file stream data, as described in [MS-RDPECLIP] section 2.2.5.

  11. The client sends a Format Data Response PDU/File Contents Response PDU (with the data) accordingly, in response to the request sent by the RD Session Host, as described in [MS-RDPECLIP] section 2.2.5.

  12. The RD Session Host sends an Unlock Clipboard Data PDU to release data on the clipboard that was locked by the Lock Clipboard Data PDU, as described in [MS-RDPECLIP] section 2.2.4<6>.

The Lock Clipboard Data PDU can be sent at any point in time after the Format list PDU message of the Clipboard Initialization Sequence, and the Unlock Clipboard Data PDU can be sent only after the Lock Clipboard Data PDU is sent.