Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you communicate between Windows Vista Session 0 and Desktop?

In prior versions of Windows before Vista you could have a Windows Service interact with the current logged in desktop user to easy display information on the screen from the service. In Windows Vista Session 0 was added for security to isolate the services from the desktop. What is an easy way to communicate between a service and an application running outside of Session 0? So far I have gotten around this by using TCP/IP to communicate between the two but it seems to be kind of a sloppy way to do it.

like image 796
Keith Maurino Avatar asked Sep 11 '08 01:09

Keith Maurino


People also ask

What is session 0 in Windows?

In Windows XP, Windows Server 2003, and earlier versions of the Windows operating system, all services run in the same session as the first user who logs on to the console. This session is called Session 0.

What are session 0 and session 1?

To eliminate the security risk, Session 0 is non-interactive on Windows Vista and later systems; that is, the first user logs on to Session 1. However, services still run in Session 0.

What is a Windows user session?

A session consists of all of the processes and other system objects that represent a single user's logon session. These objects include all windows, desktops and windows stations. A desktop is a session-specific paged pool area and loads in the kernel memory space.


2 Answers

You can use shared memory or named pipe to facilitate IPC as well. Conceptually this is similar to TCP/IP, but you don't have to worry about finding an unused port.

You have to make sure that the named objects you create are prefixed with "Global\" to allow them to be accessed by all sessions as described here.

AFAIK there is no way for a service to directly interact with the desktop any more.

like image 66
Rob Walker Avatar answered Sep 27 '22 18:09

Rob Walker


Indeed, for security reasons it is no longer possible to communicate directly with the "desktop". What exactly is the "desktop" anyway, when you live in a machine with multiple active users + remote sessions?

The general way to solve the problem is to use service apps which communicate via some RPC mechanism (TCP/IP, IPC, .Net Remoting Channels over one of those, etc). Its kind of a pain, but I think the benefits are worth the change.

like image 37
jsight Avatar answered Sep 27 '22 18:09

jsight