Re: Problem in service with User Fast-Switching

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 to
Are 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.

.



Relevant Pages

  • Re: Problem with User Fast-Switching
    ... A user switches into previously unopened account ... A user logs off then logs on previously unopened account ... A user logs off then logs previoulsy opened account ...
    (microsoft.public.vc.language)
  • Re: Problem in service with User Fast-Switching
    ... That session ID is which triggered the session change event. ... LsaGetLogonSessionData() to get detailed info about corresponding session. ... A user logs off then logs on previously unopened account ...
    (microsoft.public.win32.programmer.kernel)
  • Re: print problem with multiuser
    ... It's possible the printers weren't removed correctly and when the new user logs in with the same session id that the orignial user had, they also picked up the printers. ... Microsoft MVP - Terminal Server ...
    (microsoft.public.windows.terminal_services)
  • Re: ASP.NET Forms Authentication - How to Know if User Has Previously Been Authenticated
    ... the user logs on to my site and checks "Remember my ... ID" (persistent cookie). ... logged in" because their FormsAuthentication ticket was set to ... Request.IsAuthenticated = false when they open the new session. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: server question
    ... >> values when a user logs in. ... And after that uses http to show the pages. ... Since I am using session var's to keep track of things, ... store the session id in a secure cookie, then it wouldn't be sent when the ...
    (comp.lang.php)