Create an interactive logon session

元气小坏坏 提交于 2019-11-29 19:04:47

问题


I'm trying to create a utility similar to Microsoft's abandoned Super Fast User Switcher (download), which allows fast user switching without going through the Welcome screen.

I have a working implementation using the undocumented WinStationConnectW API (along with WTSEnumerateSessions), but it can only switch to a user who is already logged in.

How can I create a login session so that it can switch to a user who is not logged in?
I only need to support XP, although it'd be nice to work on Vista / Seven. (My current code already does)

I know that this is possible because Super Fast User Switcher does it. (Although it needs a Windows service to do it)

I'm writing C#, but I can translate any answer into C#.


回答1:


I solved this in XP by calling the undocumented InitiateInteractiveLogon function in the ShellLocalMachine COM object in shgina.dll.

This method, which can only be called by the Local System account, will log a user on to the console. (It cannot log a user on to an RDP session)

The version of the DLL included with Windows 7 (and presumably also Vista) does not contain this method.




回答2:


Which Windows versions you want to target?

I believe that there is no simple way. For Windows XP there is GINA. For Windows Vista, there is 'Credential Providers'.

Also, if you are targeting Windows XP, you can create service, that sends keystrokes to WinLogon desktop to log in as if user pressed them on keyboard. This was done by RealVNC or UltraVNC, I don't remember. However, this approach does not work in Windows Vista.



来源:https://stackoverflow.com/questions/2134391/create-an-interactive-logon-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!