I have a NT server application running in background on Windows Vista, and I want the server to lanuch Notepad.exe when server received a specific command, BUT it doesn't work, I have tried with shellexec, winexec and createprocess functions, all are failed. Notepad always runs on the server desktop, Vista will show a message to ask me to switch it. is there a way to launch it correctly?
A:
Have you tried calling CreateProcess
with the name of the desktop you want to open it in in the lpDesktop
member of the STARTUPINFO
structure? See here.
1800 INFORMATION
2009-05-11 08:43:05
Yes, I tried it, but it still doesn't work.
Yigang Wu
2009-05-11 09:14:21
A:
This is because of Vista Session 0 isolation. Your service is running in Terminal Services Session 0, your user is logged on to Session 1 or above, and interaction between the two is strictly limited.
The officially supported way of doing what you want is to have a helper application already running on the users desktop, talking to your service via some kind of IPC (e.g. pipes, sockets). Then, when your service wants to interact with the users desktop, it asks the helper application to do it for you.
snowcrash09
2009-05-11 12:02:28
Due to the UAC issue, I would like my NT server to avoid it. It means the AP what I want NT server to lanuch need the full Administrator permission. If a helper application is already running on the users desktop, it still need to show the UAC dialog.
Yigang Wu
2009-05-11 13:34:26
That's the point of UAC - if your app needs elevated privileges, it should ask the user for permission. Vista is designed to not allow exactly what you're trying to achieve - I'm not saying its impossible, I'm sure the malware community has/will come up with workarounds, but if you're a legitimate developer then you need to rethink your design so that you don't need to defeat UAC or Session 0 isolation.
snowcrash09
2009-05-11 14:33:26