TS-Teleport: Sample Instructions

  • Comments 34


To install the sample the user needs to register both client plug-in and shell extension on the TS client and server machines respectively.

NOTE: The VS support DLLs need to be copied to the same path as the sample DLLs.  Please choose the right VS support DLLS for the architecture (x86/x64) and binary type (debug/release); e.g.:

"%programfiles(x86)%\Microsoft Visual Studio 9.0\vc\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT\*"

Client Installation (on the TS client machine)

1.       Copy the right VS support DLL files to the same directory as TsTelePlgn.dll

2.       Register the Plug-in COM object: “RegSvr32 TsTelePlgn.dll”, this will:

a.       Register the COM object

b.      Add the following TS specific key/value to load the plug-in

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default\AddIns\TsTelePlgn

Name    REG_SZ    {0350DF61-30CF-451B-B292-3CE3A330F958}

Server Installation (on the TS server machine)

3.       Copy the right VS support DLL files to the same directory as TsTeleport.dll

4.       Register the shell extension COM object: “RegSvr32 TsTeleport.dll”, this will

a.       Register the COM object

b.      Add the shell extension keys/values

5.       Manually create the following empty file to trigger loading the COM object by Shell

a.       Locate the SendTo folder (for the current user or all users); e.g.:


b.      Create an empty file with the following name: “RDP Client Desktop.tsteleport


1.       Use the machine with the client plug-in to establish a TS connection

2.       TS to the server with the shell extension

3.       Highlight a group of files and/or directories and right-click

4.       Select the send-to menu and then “RDP Client Desktop”

Debugging and Troubleshooting

Attach a debugger to the running instance of mstsc.exe hosting the client side plug-in, or explorer.exe hosting the shell extension and watch messages in the debugger output area in case of errors.

Sample Assumptions

This section outlines assumptions made to simplify the sample and focus on demonstrating the DVC API usage.  The reader is advised to go through it if basing an application on the provided sample.  If the intent is just familiarity with DVCs, this section can be skipped.

Protecting State and State Sensitive Protocol

The TS client serializes calls to the plug-in so we don’t use a lock to protect state changes.  Moreover, we are guaranteed to have only a single DVC connection from our server which allows for a state-ful protocol.  On the server side explorer calls our methods synchronously and doesn’t allow a new “Send to RDP Client Desktop” invocation while one is in progress.  The whole scheme does not require the use of any locks on the client or the server.  In real-life applications most of these assumptions are invalidated, which requires caution when using this code as core for other implementations.

One COM Object

Another simplification is the use of the same COM object as the client plug-in, listener and channel callbacks.  This might or might not be the case in more complex protocols depending on the problem addressed and the assumptions.

Error Reporting and Verbosity

Again TS-Teleport is far from an application with a fully furnished UI.  The UI consists of a single dialog box that echoes the success or failure of transporting the requested set of files.  More verbose output for debugging and understanding is provided through the debugger spew.

Shell Blocking

Again this is another limitation since we do all the teleportation on a synchronous shell call, certain shell features are blocked during the whole operation which can take a significant time depending on the cumulative size of the transported files.

Sample Code

The sample code is attached to this article.  Windows Server 2008 SDK is needed to get the DVC definitions.  Also attached is the VS2008 Beta-2 solution file for the sample (Visual Studio 2008 Beta2 is needed from the microsoft.com website to compile the sample).

Build FAQ:

Why can’t I open the .sln or .vcproj files with Visual Studio 2005?

Because you need Visual Studio 2008 (or VS 2008 Beta 2) as previously stated (link below).

Why am I getting one or more of the following erros?

fatal error C1083: Cannot open include file: 'TsVirtualChannels.h': No such file or directory

error C2065: 'WTS_CHANNEL_OPTION_DYNAMIC' : undeclared identifier

error C3861: 'WTSVirtualChannelOpenEx': identifier not found


Since Windows Server 2008 SDK in the link below needs to be installed and configured with Visual Studio (i.e. add the new SDK include and lib directories to VS – Tools->Options->Projects and Solutions->VC++ directories).


Windows Server 2008 SDK:


VS2008 Beta2:


More information about Dynamic Virtual Channels can be found on MSDN:



Leave a Comment
  • Please add 3 and 7 and type the answer here:
  • Post
  • An important goal of the Terminal Services (TS) team is to provide a product that can easily be extended

  • thanks for this excellent article.

  • can u give some explanation on TS DVC example.

  • how do we add shellextn key values. We are getting WTSVirtualChannelOpenex() failed  error NO. 80070002. Are there any security settings to be done. Please reply ASAP.



  • Ravi,

    Please follow the instructions in the main post to register the DVC plugin with the client.  0x80070002 is 'file not found' so I'm pretty sure the DVC client plugin is not loaded properly or doesn't create the right listener.

  • TsTelePlugin.dll is correctly registered on the client

    Below are the trace staments in the debugger

    [hr=0x80070057]WTSVirtualChannelOpenEx failed

    [hr=0x80070057]GetVirtualChannelHandle failed

    [hr=0x80070057]TeleportFiles failed

    CallStack which is failing

    02b8eeb0 759a38dc 00000008 759a394c 02b8f040 WINSTA+0x1556

    02b8eed0 74d63b94 00000000 ffffffff 6e61ede8 WINSTA!WinStationVirtualOpenEx+0x1b

    02b8eef4 74d63f67 00000000 ffffffff 6e61ede8 WTSAPI32!WTSEnumerateProcessesA+0x1ec

    02b8ef0c 6e602dc6 ffffffff 6e61ede8 00000000 WTSAPI32!WTSVirtualChannelOpenEx+0x15

    02b8f040 6e601d14 02c83328 8cefc753 02b8f2b0 TsTeleport!DllGetClassObject+0xec28

    02b8f19c 6e601584 02b8f28c 02b8f2b4 02b8f4e4 TsTeleport!DllGetClassObject+0xdb76

    02b8f2b0 75b65bbf 02c83320 0294bbdc 00000009 TsTeleport!DllGetClassObject+0xd3e6

    Above mentioned is the stack trace. Any clue are we missing any security settings on server side.

    File version of wtsapi32.dll is

    6.0.6001.16526. I suppose this is the correct RDP we are using

  • For Ts-teleport to work fine, do we need to have Remote Desktop Connection 6.1 or using Remote Desktop Connection 6.0 will be sufficient? Please reply.

    I am unable to find Remote Desktop Connection 6.1 download site,please help me in this regard also.



  • The error 0x80070057 indicates an incorrect parameter.  Most probably you are not running this on Vista SP1 or a Windows Server 2008.  If you are then maybe not on a recent enough build although I doubt it.

    - Ahmed [MS]

  • It appears that my post from the morning didn't go through; so sorry Sabry.

    YES, you need the 6.1 client, which I believe isn't available as a stand-alone from MS.  It's the client that ships with Vista SP1 and Windows Server 2008.  You can download pre-release versions of those OS'es from the MS website.

    - Ahmed [MS]

  • The application is working fine on using Remote Desktop Connection 6.1,thanks for the guidance.



  • I'm really interested in this mechanism and I've tried to compile it up.

    I am using Visual Studio 2008 on top of Vista and I get the errors below. I've added in the 2008 SDK (on top of VS2008) and added in the paths as detailed above, but still no differrence.

    tsclientplgn.h(127) : error C2065: 'IWTSListener' : undeclared identifier

    tsclientplgn.h(27) : error C2512: 'ATL::CComPtr' : no appropriate default constructor available

    tsclientplgn.cpp(50) : error C2664: 'IWTSVirtualChannelManager::CreateListener' : cannot convert parameter 4 from 'T **' to 'IUnknown **'

    Any pointers would be welcome.

  • Can this be done with VS2005 between Windows XP Client and Windows Server 2003 Terminal Server?

  • As described in the requirements above the client has to be 6.1 which *can run* on XP but the server has to be WS08.

    - Ahmed.

  • The link of the Sample code is not working, Can any body reactivate it, or send it on


    I need it badly and would be very gratefull

  • When I tried to register the COM Object, I get the following error :


    Debug Error!

    Program: c:\WINDEOS\system32\regsvr32.exe


    An application has made an attempt to load the C runtime library without using a manifest.

    This is an unsupported way to load Visual C++ DLLs. You need to modify your application to build with a manifest.

    For more information, see the "Visual C++ Libraries as Shared Side-by-Side Assemblies" topic in the product decumentation.


Page 1 of 3 (34 items) 123

TS-Teleport: Sample Instructions