How to implement Fast User Switing in a customized shell?

G

Guest

Hello community!

I'm currently migrating the software my company is working on to windows
XPe. We've decided to replace the explorer shell with our application. Within
the application customers should only see the application and no Windows XP,
but our service staff should be able to switch to a dedicated service user
account whose shell is the explorer shell.

My goal is to realize this by using Fast User Switching, but I have no idea
how I can trigger a user change programmatically. Furthermore it would be
nice, if someone can tell me, what components are needed to support Fast User
Switching in Windows XPe.

I'd be happy about an answer :)

Sascha
 
M

Mike Warren

Sascha said:
Hello community!

I'm currently migrating the software my company is working on to
windows XPe. We've decided to replace the explorer shell with our
application. Within the application customers should only see the
application and no Windows XP, but our service staff should be able
to switch to a dedicated service user account whose shell is the
explorer shell.

I don't know the answer to your question but we just run explorer.exe
for service access using a secret key sequence from within our shell
program.

Explorer.exe is not even included in the image. A USB thumb drive or CD
containing it is needed.
 
G

Guest

Mike Warren said:
I don't know the answer to your question but we just run explorer.exe
for service access using a secret key sequence from within our shell
program.

Explorer.exe is not even included in the image. A USB thumb drive or CD
containing it is needed.

Hello Mike,

thank you very much for your quick answer! Starting explorer.exe would be a
way to realize this task, but the application the customer is working with
should run with restricted user rights, while our service staff should have
full access (administrator priviledges) to the system.

If there's no way to trigger Fast User Switching, I will do as you proposed.
Fast User Switching seems to be the right way to work with different user
accounts.

Hmmm, by the way ... what would happen, if I run the explorer.exe with the
"Run as..." function? Will the complete desktop, windows explorer windows and
so on run under the specified user's priviledges?

Thank you for your answers :)
 
K

KM

Sascha,

Just to mention. You can have different shells working for different users.
All you have to do is to properly set up the following keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"

Note that the current user branch is where you specify the different user shell.
Here is an article for you from Sean to get started: http://msdn2.microsoft.com/en-us/library/ms838576.aspx

There are some limitations if you run the explorer.exe not as a shell (e.g., via RunAs command). Initially it may not look like the
full Desktop shell. Just FYI.
 
G

Guest

Hello KM,

thank you for your note about customizing a user shell. My application works
greatly as a shell, but I don't know how to switch between a service user
(administrator account) and the customer (restricted user account). My idea
is to use Fast User Switching, so I don't have to close the application the
customer is working with, when our service staff is working with the explorer
shell.

There must be a way to initiate a user switch... I'd be happy, if someone
could tell me, what api-functions I have to call to do this.

Thank you very much!

Sascha


KM said:
Sascha,

Just to mention. You can have different shells working for different users.
All you have to do is to properly set up the following keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"

Note that the current user branch is where you specify the different user shell.
Here is an article for you from Sean to get started: http://msdn2.microsoft.com/en-us/library/ms838576.aspx

There are some limitations if you run the explorer.exe not as a shell (e.g., via RunAs command). Initially it may not look like the
full Desktop shell. Just FYI.
--
=========
Regards,
KM

Hello Mike,

thank you very much for your quick answer! Starting explorer.exe would be a
way to realize this task, but the application the customer is working with
should run with restricted user rights, while our service staff should have
full access (administrator priviledges) to the system.

If there's no way to trigger Fast User Switching, I will do as you proposed.
Fast User Switching seems to be the right way to work with different user
accounts.

Hmmm, by the way ... what would happen, if I run the explorer.exe with the
"Run as..." function? Will the complete desktop, windows explorer windows and
so on run under the specified user's priviledges?

Thank you for your answers :)
 
K

KM

Sascha,

If what you are referring to is Winlogon screen where you can switch between users then you can just call LockWorkstation API and
that will bring you to the Winlogon screen.
(Fast User Switching stack only allows you to have multiple user environments running on XP/XPe)

Also, you can use LogonUser[Ex] API function to start another user context and launch any app there.
There is a great sample project on codeproject website that has a nice RunAsEx utility explained and displayed in the code:
http://www.codeproject.com/system/RunUser.asp

Personally I don't think using heavy Fast User Switching feature is good for an embedded device. But it is always up to you and your
system requirements.
I'd probably stick to APIs like CreateProcessAsUser if an admin app needs to be launched by a key sequence.

--
=========
Regards,
KM

Hello KM,

thank you for your note about customizing a user shell. My application works
greatly as a shell, but I don't know how to switch between a service user
(administrator account) and the customer (restricted user account). My idea
is to use Fast User Switching, so I don't have to close the application the
customer is working with, when our service staff is working with the explorer
shell.

There must be a way to initiate a user switch... I'd be happy, if someone
could tell me, what api-functions I have to call to do this.

Thank you very much!

Sascha


KM said:
Sascha,

Just to mention. You can have different shells working for different users.
All you have to do is to properly set up the following keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"

Note that the current user branch is where you specify the different user shell.
Here is an article for you from Sean to get started: http://msdn2.microsoft.com/en-us/library/ms838576.aspx

There are some limitations if you run the explorer.exe not as a shell (e.g., via RunAs command). Initially it may not look like
the
full Desktop shell. Just FYI.
--
=========
Regards,
KM

:

Sascha wrote:

Hello community!

I'm currently migrating the software my company is working on to
windows XPe. We've decided to replace the explorer shell with our
application. Within the application customers should only see the
application and no Windows XP, but our service staff should be able
to switch to a dedicated service user account whose shell is the
explorer shell.

I don't know the answer to your question but we just run explorer.exe
for service access using a secret key sequence from within our shell
program.

Explorer.exe is not even included in the image. A USB thumb drive or CD
containing it is needed.

--
-Mike


Hello Mike,

thank you very much for your quick answer! Starting explorer.exe would be a
way to realize this task, but the application the customer is working with
should run with restricted user rights, while our service staff should have
full access (administrator priviledges) to the system.

If there's no way to trigger Fast User Switching, I will do as you proposed.
Fast User Switching seems to be the right way to work with different user
accounts.

Hmmm, by the way ... what would happen, if I run the explorer.exe with the
"Run as..." function? Will the complete desktop, windows explorer windows and
so on run under the specified user's priviledges?

Thank you for your answers :)
 
G

Guest

Hello KM,

LockWorkstation sounds fine for that purpose. Our "Embedded Systems" are no
classical embedded systems, inside the box a Celeron M 1GHz with 1GB RAM is
working. Other systems ship with a Core2 Duo and 2GB RAM. I think Fast User
Switching is a convienient way to provide admin access for our service staff,
so they will get their well-known user interface they can work with.

Thank you very much for your answers!

Sascha

KM said:
Sascha,

If what you are referring to is Winlogon screen where you can switch between users then you can just call LockWorkstation API and
that will bring you to the Winlogon screen.
(Fast User Switching stack only allows you to have multiple user environments running on XP/XPe)

Also, you can use LogonUser[Ex] API function to start another user context and launch any app there.
There is a great sample project on codeproject website that has a nice RunAsEx utility explained and displayed in the code:
http://www.codeproject.com/system/RunUser.asp

Personally I don't think using heavy Fast User Switching feature is good for an embedded device. But it is always up to you and your
system requirements.
I'd probably stick to APIs like CreateProcessAsUser if an admin app needs to be launched by a key sequence.

--
=========
Regards,
KM

Hello KM,

thank you for your note about customizing a user shell. My application works
greatly as a shell, but I don't know how to switch between a service user
(administrator account) and the customer (restricted user account). My idea
is to use Fast User Switching, so I don't have to close the application the
customer is working with, when our service staff is working with the explorer
shell.

There must be a way to initiate a user switch... I'd be happy, if someone
could tell me, what api-functions I have to call to do this.

Thank you very much!

Sascha


KM said:
Sascha,

Just to mention. You can have different shells working for different users.
All you have to do is to properly set up the following keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],"Shell"

Note that the current user branch is where you specify the different user shell.
Here is an article for you from Sean to get started: http://msdn2.microsoft.com/en-us/library/ms838576.aspx

There are some limitations if you run the explorer.exe not as a shell (e.g., via RunAs command). Initially it may not look like
the
full Desktop shell. Just FYI.
--
=========
Regards,
KM




:

Sascha wrote:

Hello community!

I'm currently migrating the software my company is working on to
windows XPe. We've decided to replace the explorer shell with our
application. Within the application customers should only see the
application and no Windows XP, but our service staff should be able
to switch to a dedicated service user account whose shell is the
explorer shell.

I don't know the answer to your question but we just run explorer.exe
for service access using a secret key sequence from within our shell
program.

Explorer.exe is not even included in the image. A USB thumb drive or CD
containing it is needed.

--
-Mike


Hello Mike,

thank you very much for your quick answer! Starting explorer.exe would be a
way to realize this task, but the application the customer is working with
should run with restricted user rights, while our service staff should have
full access (administrator priviledges) to the system.

If there's no way to trigger Fast User Switching, I will do as you proposed.
Fast User Switching seems to be the right way to work with different user
accounts.

Hmmm, by the way ... what would happen, if I run the explorer.exe with the
"Run as..." function? Will the complete desktop, windows explorer windows and
so on run under the specified user's priviledges?

Thank you for your answers :)
 

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