1 Reply Latest reply on Oct 1, 2020 11:32 PM by JainRahul

    "VMware Horizon 7 Session Enhancement SDK" malfunctions when used with Windows Service instead of Windows Console Application on Remote Desktop

    JainRahul Novice

      I am building an application using "VMWare Horizon 7 Session Enhancement SDK" however in my case I am building the remote application as a Windows service instead of Console Application. While testing it when I fetch the channel state, the channel state should be CONNECTED, but the GetChannelState() is returning disconnected.

       

      The issue does not occur in case I convert the Windows Service in to a console application.

       

      Can someone help whether SDK can be used for Windows Service?

       

       

      This design approach is very similar to "VMWare Printer Redirection Service", if someone can point me to the design pattern and sample code of "VMWare Printer Redirection Service"?

        • 1. Re: "VMware Horizon 7 Session Enhancement SDK" malfunctions when used with Windows Service instead of Windows Console Application on Remote Desktop
          JainRahul Novice

          I am able to solve this problem and will like to share my findings so as for the others to consider. 

           

          Samples provided in "VMWare Horizon 7 Session Enhancement SDK" are applications. An application when executed on a remote desktop, runs in the user context/session. So when we invoke VDPService_ServerInit( ) in the application, the SDK is able to recognize the user session (session associated with application) and therefore when we fetch the connection state using GetConnectionState() it provides us the correct status of the connection of the current user.

           

          In contrast to above; a Windows Service does not run in user context. It is a system level daemon. So when VDPService_ServerInit( ) is executed in a service it is not able to identify the correct user session (may be it picks up the first available user session). Therefore in as Windows Service, the service should first enumerate all the users correctly connected or disconnected to the remote desktop using the windows API WTSEnumerateSessionsA(). Then it should use the session ID returned by this API and invoke VDPService_ServerInit2( ) along with the session ID to get the state of the connection.

           

          So, the basic finding is the fact that VDP framework accepts the session IDs from the Window's APIs. 

          1 person found this helpful