Blog Post

Security, Compliance, and Identity Blog
4 MIN READ

TS-Teleport: Sample Instructions

MicrosoftSecurityandComplianceTeam's avatar
Sep 08, 2018
First published on CloudBlogs on Sep, 19 2007

Installation

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.0vcredistDebug_NonRedistx86Microsoft.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_USERSoftwareMicrosoftTerminal Server ClientDefaultAddInsTsTelePlgn

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.:

C:Users<User>AppDataRoamingMicrosoftWindowsSendTo

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

Usage

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).

Links:

Windows Server 2008 SDK:

http://www.microsoft.com/downloads/details.aspx?FamilyId=58726ACA-8D84-4683-8959-BE0038DA7084&displaylang=en

VS2008 Beta2:

http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx

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

http://msdn.microsoft.com/en-us/library/windows/desktop/bb540855(v=vs.85).aspx

Published Sep 08, 2018
Version 1.0
  • anujjain52's avatar
    anujjain52
    Copper Contributor

    Hello,

     

    I am the beginner and trying to learn Dynamic Virtual Channel. For learning, I go through the TS 

    Teleport Sample Code.

     

    Problem: At server side, I registered the dll and Create an empty file with the following name: “ RDP Client Desktop.tsteleport ” as suggested in the instructions

    Location:-  C:Users<User>AppDataRoamingMicrosoftWindowsSendTo 

     

    Unfortunately, I am unable to see the menu option in "SendTo" menu. Can somebody help me out for adding the "RDP Client Desktop.tsteleport" menu in "SendTo" Menu

     

    Thanks

    Anuj