Disable programmatically the "Fast User Switching"

V

Viviana Vc

Hi all,

I would like programmatically to disable "Fast User Switching" (FUS) (as
an option for the user). As
I understood from what I read there are 2 ways for doing this:
1) replace the msgina.dll, as FUS doesn't work with a custom msgina.dll
2) set into the registry: HKLM\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon -> AllowMultipleTSSessions to 0

I would like to use the second way of disabling and I have some
questions:
1) Some are saying that this entry might not be in the registry. Can
this be true? If yes, if I just add it there with the 0 value will it
disable the FUS?
If indeed something from this path can miss on a WinXP, is it just the
string or it can be one of the keys from the paths (like for instance
Winlogon)?

2) Is this solution an ok solution, or it can not guarantee that by just
setting the AllowMultipleTSSessions to 0 the FUS will be disabled?

Thanks a lot in advance,
Viv
 
R

Ramesh [MVP]

Viv,

1st solution disables Welcome Screen as well.
2nd solution should work.

One entry of AllowMultipleTSSessions will exist anyway

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AllowMultipleTSSessions
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\AllowMultipleTSSessions (not present by default)

Set AllowMultipleTSSessions to 0 the FUS will be disabled. The AllowMultipleTSSessions value present under 'policies' will override the value under WinLogon. (If Winlogon\AllowMultipleTSSessions is set to 0 and policies\system\AllowMultipleTSSessions is set to 1, FUS WILL work.)

HTH

--
Ramesh - Microsoft MVP
Windows XP Shell
http://www.mvps.org/sramesh2k


Hi all,

I would like programmatically to disable "Fast User Switching" (FUS) (as
an option for the user). As
I understood from what I read there are 2 ways for doing this:
1) replace the msgina.dll, as FUS doesn't work with a custom msgina.dll
2) set into the registry: HKLM\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon -> AllowMultipleTSSessions to 0

I would like to use the second way of disabling and I have some
questions:
1) Some are saying that this entry might not be in the registry. Can
this be true? If yes, if I just add it there with the 0 value will it
disable the FUS?
If indeed something from this path can miss on a WinXP, is it just the
string or it can be one of the keys from the paths (like for instance
Winlogon)?

2) Is this solution an ok solution, or it can not guarantee that by just
setting the AllowMultipleTSSessions to 0 the FUS will be disabled?

Thanks a lot in advance,
Viv
 
V

Viviana Vc

Hi all,

In some conditions from MyApp when a FUS occurs I have to force instead
a real 'Log Off' to be sure that all the applications of that user are
closed. So for instance user A is working then he is chosing a FUS, so
in that moment from MyApp I would like to force a real 'Log Off'.

In MyApp I get the message when the user is doing a FUS by:
WM_WTSSESSION_CHANGE -> WTS_SESSION_LOCK, so now in WTS_SESSION_LOCK I
would like to force a 'Log Off' instead.

I tried doing this in several ways:
1) ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_MAJOR_OPERATINGSYSTEM) but
even though it returns success it actually doesn't do a log off of the
current user.
It's working if I use also EWX_FORCE flag, but then the system is not
waiting for the user to save any unsaved data. It's not behaving like a
normal 'Log Off'.
2) I tried to run logoff.exe when I get the WTS_SESSION_LOCK but nothing
happens
3) I tried WTSLogoffSession, but this behaves like ExitWindowsEx with
the EWX_FORCE flag, meaning that it's a 'brutal' log off.

Is there any way to do a normal 'Log Off' when I get the
WTS_SESSION_LOCK msg? (normal 'Log Off' means the kind of log off you
get when the user choses log off instead of switch user)

Thanks in advance,
Viv
 
V

Viviana Vc

Hi Ramesh,

I have just tried what you wrote me and it's indeed true: "value present
under 'policies' will override the value under WinLogon". I haven't
found this info anywhere in MSDNL or NGs, so thanks a lot again.

This means actually that for disabling FUS I should care only about:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\AllowMultipleTSSessions
by creating it if needed and setting it to 0.
I don't need to also set or care about HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AllowMultipleTSSessions as this is anyhow
overwritten right?

(I am asking this because there is XP Home, XP Pro, 2 service packs, and
as I don't have access to all of these combinations I would like to be
sure that the above is true for all of these)

Thanks a lot,
Viv
 
R

Ramesh [MVP]

Viv,

Yes. For the 2nd question, will test in a Windows XP Home unit and let you know.

--
Ramesh - Microsoft MVP
Windows XP Shell
http://www.mvps.org/sramesh2k
---------------------------------------
What You Should Know About the Sasser Worm and It Variants:
http://www.microsoft.com/security/incident/sasser.asp
---------------------------------------


Hi Ramesh,

I have just tried what you wrote me and it's indeed true: "value present
under 'policies' will override the value under WinLogon". I haven't
found this info anywhere in MSDNL or NGs, so thanks a lot again.

This means actually that for disabling FUS I should care only about:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\AllowMultipleTSSessions
by creating it if needed and setting it to 0.
I don't need to also set or care about HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AllowMultipleTSSessions as this is anyhow
overwritten right?

(I am asking this because there is XP Home, XP Pro, 2 service packs, and
as I don't have access to all of these combinations I would like to be
sure that the above is true for all of these)

Thanks a lot,
Viv
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top