I've been doing some development with Windows Vista and am hitting a small roadblock because of changes made to session 0. I understand why the changes were made, and I think they're a good thing, but it's causing me a headache.
In this particular case, I'm working on some code that is run by a printer driver after it is installed. One of the things the code does is launch a Setup program to install some utility applications. Since the spooler is a service, I'm running in the security context of services, so anything I launch winds up in Session 0, invisible to the user.
I understand from the White Paper at http://www.microsoft.com/whdc/system/vista/services.mspx
that I need to use either WTSSendMessage or CreateProcessAsUser (which is what I really need) to ensure that the app runs with the correct security context and is visible to the user. The problem is, how do I know *which* session or user to use?
I thought about enumerating all the sessions and finding the active session, but, because of Fast User switching and RDC, it's entirely possible that more than one person is logged in and active simultaneously. How do I know who launched Add Printer Wizard to trigger the driver install?
If it were just a status app, I could look at the job and see who sent it, but this is happening immediately after driver install, and there may or may not be a test page in the queue to look at.
So, any ideas? Thanks.