c++pluginsrdpvirtual-channel

How to use Virtual Channels with two RemoteApps located on two different Servers?


I made a 64 bits c++ Virtual Channel Client DLL

I updated my registry, using Virtual Channel Client Registration (I chose the Default\Addins way)

If I start a Remote Dekstop connection, everything goes fine: my DLL is loaded in a process named mstsc.exe, my exported VirtualChannelEntry callback is called, and, skipping details, I am able to send/receive bytes (with a little help from a process of my own, running in the server session, and which opens the Virtual Channel).

I am also able to open a second Remote Desktop connection to another Server. A second mstsc.exe process is started, it loads my DLL, all is OK.

My problems begin when I replace my two remote Desktops by two "RemoteApps" (one RemoteApp on the first Server, the other on the second Server).

When I launch the first RemoteApp, all is fine (a mstsc.exe starts, and load my DLL).

When I launch the second RemoteApp, there is NO new mstsc.exe, so no way for my DLL to be loaded again, but the existing mstsc.exe does NOT call my exported VirtualChannelEntry. I am not able to establish the Virtual Channel with the second Server.

The order does matter, not the RemoteApps. Only the first RemoteApp launched will give a Virtual Channel with its Server.

If I launch only one RemoteApp, and then launch a full Remote Desktop connection to the other Server, all is OK: two mstsc.exe loading my DLL, two Virtual Channel established.

Questions:

How to use Virtual Channels with two RemoteApps located on two different Servers?

Why is there only one mstsc.exe when I launch two RemoteApps, from two Servers, and why that single mstsc.exe does not call VirtualChannelEntry for the second connection?

My client OS is Windows 2012. Problem reproduced with Windows 10 Pro as client.


Solution

  • I got an answer on Microsoft Technet. I reproduce it here, maybe helping future reader.

    Add the following line to your RemoteApps RDP files:

    disableconnectionsharing:i:1
    

    Then, there will be one instance of mstsc.exe for each RemoteApps launched, and all of them will call your exported VirtualChannelEntry callback.

    Beware, this an answer to the question asked, which states "two RemoteApps located on two different Servers".

    The above configuration option may have some bad consequences if you are not in this case.

    If you are an expert on that matter, feel free to improve this answer.