Copy and Paste through RDP/Internet

1

1

I understand how something can be copied and pasted on a machine, or over a network.

But how does copying and pasting through an RDP session work, where you are not connected to the other machines network?

I know how to do it, but what are the mechanics behind this?

KidCode

Posted 2014-10-22T13:09:46.423

Reputation: 113

Answers

4

Windows has APIs that allow you to view what's on the clipboard (and receive notifications when the contents change). It also has APIs that allow you to place items on the clipboard.

RDP interacts with the clipboard on both the server and client. When you copy something, RDP will synchronise the item across on the clipboards of both machines, allowing you to paste it on either (I'm not sure if it transfers data at the time of copying, or time of pasting; either is possible).

Also, you are "connected to the other machine's network". Not as directly as a local network, but you must have a network connection of some sort for RDP to work at all. The internet is just one giant network, after all.

See also (note that the APIs mentioned in those blog posts are the older ones; Vista introduced newer clipboard APIs but the basic principle is similar):

http://blogs.msdn.com/b/oldnewthing/archive/2008/06/04/8572362.aspx
http://blogs.msdn.com/b/rds/archive/2006/11/16/why-does-my-shared-clipboard-not-work-part-1.aspx

In the local session the TS client is in the clipboard viewer chain and in the remote session the RDPCLIP virtual channel application is in the viewer chain. When a clipboard update happens in the local session, the TS client is notified and informs RDPCLIP of the changes so it can propagate them to the remote session. Similarly, when a clipboard update happens in the remote session, RDPCLIP is notified and informs the TS client of the changes.

Bob

Posted 2014-10-22T13:09:46.423

Reputation: 51 526