Terminal Services Client/Server Support

Client/server applications can use the Terminal Services API to enhance their functionality when running in a Terminal Services environment.

The component of a client/server application that acts as a client can call the ProcessIdToSessionId function to retrieve the identifier of its Terminal Services session. The client then uses some form of interprocess communication to pass its session identifier to the server component. The client and server components can then use the session identifier to set up a private communication channel. For example, the server can use a session identifier to access objects in the session's namespace for kernel objects. For more information, see Kernel Object Namespaces.

The server component of a client/server application can use the session identifier in a WTSQuerySessionInformation call to retrieve additional information about the client. The server component can also use the session identifier in a WTSSendMessage call to display a message on the client terminal. The server application can also create two events to monitor client connection to and disconnection from a session. However, it must be registered on the terminal server to do this. Refer to Monitoring Session Connections and Disconnections for more information.

Processes spawned from multiple sessions can send data to and receive data from each other through the use of shared memory blocks. This is done by calling CreateFileMapping. If you do this, keep in mind that shared memory cannot be used in situations where both of the following conditions exist:

  • All of the processes using the shared memory block were not spawned by one session.
  • All of the sessions share the same user authentication credential.

Send comments about this topic to Microsoft

Build date: 5/29/2008