RE: WTSEnumerateSessions and Welcome Screen
From: Rob (Rob_at_discussions.microsoft.com)
Date: Fri, 25 Mar 2005 09:33:02 -0800
I don't recall exactly how XP works with regards to this because it
implements terminal services differently than 2000 and 2003 (single user TS).
But for a real terminal server, logging off disconnects you from that
session, but the session remains active with no logged on user. winlogon.exe,
belonging to local system, displays the welcome screen - not that you can see
it since you've logged out.
Terminal Services has its own method for both reusing sessions and cleaning
them up - eventually.
> If there is a better NG for this, please let me know.
> I have WTSEnumerateSessions working with WTSEnumerateProcesses to get
> all Terminal Services users. I match up the unique process users'
> sessions from WTSEnumerateProcesses with the SessionInfo structures
> returned from WTSEnumerateSessions. I then check the Status and
> WinStation to see if a session is active.
> However, when I go Start -> LogOff to bring up the Welcome Screen,
> terminal services is still reporting the session status as Active and
> the station as Console. So I guess the Welcome Screen belongs to the
> last user and it is not its own session. But I need to know that XP is
> sitting on the Welcome Screen and therefore all users are disconnected
> (from my perspective).
> If the only answer is WTSRegisterSessionNotification, then may someone
> supply either a CSharp or VB.NET example as I only have been able to
> find CPP examples. Or if CPP is the only way perhaps a full project I
> could just slap into VS7 and compile?