Re: Problem in service with User Fast-Switching
- From: "boris" <somewhere@xxxxxxxxxxx>
- Date: Sun, 1 Mar 2009 20:48:21 -0800
Hi,
I think, there should be state machine (n your code). It should handle some or all of 3 events (WTS_CONSOLE_CONNECT, WTS_SESSION_UNLOCK, WTS_SESSION_LOGON). In case of WTS_CONSOLE_CONNECT, WTS_SESSION_UNLOCK - LsaXXX funcs (that I pointed out earlier) should be used. In case of WTS_SESSION_LOGON - you should handle user token as passed to you by Windows.
Another possibility: take a look at http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/c9bb1f13-cded-45d9-920f-4a721bbc43a7/
Boris
<swtbase@xxxxxxxxx> wrote in message news:0afd74d9-2e0a-4fed-ab98-a789991da5bf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Session id (as returned by WTS_SESSION_UNLOCK, etc.) can be mapped toAre you refering to Session ID in lpEventData in HandlerEx callback
function? That session ID is which triggered the session change event.
That wouldn't be useful.
Session field of SECURITY_LOGON_SESSION_DATA struct (that's returned by
LsaGetLogonSessionData). SECURITY_LOGON_SESSION_DATA also has fields for
username, domainname, and SID (no token though).
So your service could call LsaEnumerateLogonSessions() to get list of LUIDs
for all existing sessions, then for each LUID returned - call
LsaGetLogonSessionData() to get detailed info about corresponding session.
With this I could retrieve username without getting user token, nice.
But where should I call LsaEnumerateLogonSessions()?
WTS_SESSION_UNLOCK is not always fired. Take a look at the following
cases:
1. A user switches into previously unopened account
WM_SESSION_LOCK, WM_CONSOLE_DISCONNECT, WM_CONSOLE_CONNECT,
WM_SESSION_UNLOCK, WM_SESSION_LOGON
2. A user switches into previously opened account
WM_SESSION_LOCK, WM_CONSOLE_DISCONNECT, WM_CONSOLE_CONNECT,
WM_SESSION_UNLOCK
3. A user logs off then logs on previously unopened account
WM_SESSION_LOGOFF, WM_SESSION_LOGON
4. A user logs off then logs previously opened account
WM_SESSION_LOGOFF, WM_CONSOLE_DISCONNECT, WM_CONSOLE_CONNECT
5. Computer starts and a user logs on
WM_CONSOLE_CONNECT, WM_SESSION_LOGON
As you see there is no one event that is always fired when active user
changes. That's the problem.
.
- Follow-Ups:
- Re: Problem in service with User Fast-Switching
- From: swtbase
- Re: Problem in service with User Fast-Switching
- References:
- Re: Problem in service with User Fast-Switching
- From: swtbase
- Re: Problem in service with User Fast-Switching
- From: boris
- Re: Problem in service with User Fast-Switching
- From: swtbase
- Re: Problem in service with User Fast-Switching
- Prev by Date: Re: Detecting scheduler interference?
- Next by Date: Exception Processing Message C0000013
- Previous by thread: Re: Problem in service with User Fast-Switching
- Next by thread: Re: Problem in service with User Fast-Switching
- Index(es):
Relevant Pages
|