Can users interact with services directly in Microsoft Vista?
Microsoft's website (see msdn.microsoft.com/en-us/library/ms683502(VS.85).aspx ) clearly states: "Services cannot directly interact with the user with Windows Vista."
So I decided to test it using "psexec -s cmd.exe". As far as I know, "psexec" creates a service to open the command prompt. Needless to say, it worked. Then I decided to use the "EnumWinSta GUI" in combination with psexec to switch to the winlogon desktop. To my surprise, I could even run "cmd.exe" on that desktop. Does this mean that a new process created from a service can be interactive?
Or is it because psexec is doing some kind of black magic? If so, how is it done?
I am trying to display a full screen window from a service to a winlogon desktop object in Vista as well as XP.
Code running inside a service cannot directly interact with an interactive session.
However, code that runs as a service with sufficient privileges can create a new process running on a specific user's desktop — for example, get the user's interactive session token and call CreateProcessAsUser.
You can use WTSGetActiveConsoleSessionId to get the active console session, the session of the user who is actually on the machine. The WTSQueryUserToken can then be used to get the token.
Your service can also use session change notifications in its handler function to see when users log in / out, unlock their session, etc.
a source to share