tags:

views:

71

answers:

1

I've seen this question, but I was hoping to avoid using CreateProcessAsUser. I can enumerate windows by calling EnumDesktopWindows, and I can get the desktops by calling EnumDesktops. Unfortunately, EnumDesktops requires a window station name, and WTSQuerySessionInformation with WTSWinStationName explicitly does not return the window station name.

So, I guess my question is: how do I get hold of the Window Station for a WTS session?

A: 

You can use EnumWindowStations. For more background please see this blog post I wrote on Sessions, Window Stations, and Desktops.

Brian R. Bondy
It's been a while, but I seem to recall that this always returns "WinSta0". How do I find out the window stations *for a particular session*? Or: how do I pass a *session* to EnumDesktops?
Roger Lipscombe
You can start a process within a particular session and then use that API.
Brian R. Bondy
"...but I was hoping to avoid using CreateProcessAsUser...". Unfortunately, that's what I ended up doing.
Roger Lipscombe