Can I use logonuser(…) function to logon to windows 7?

旧街凉风 提交于 2019-12-12 01:32:01

问题


I've been trying to create a simple windows service application that inputs the logon credentials and with a click of a button logs you on. I have read about GINA and Credential Provider. I have also looked at many articles including: http://msdn.microsoft.com/en-us/library/aa379608%28VS.85%29.aspx.

I just want to know if it is possible to logon using the logonuser function provided by windows?


回答1:


No you can not, using LogonUser() is only one step of many in the logon process. Also GINA is only used in XP and earlier you can not use it on Windows 7.

You will need to instead create a custom Credential Provider (which is not a easy task to do) and it will not be easy to write in any .NET language, it was designed to work with native code (like C++ or C) and there are very few .NET resources available (if any) for example code.

If you do choose to write it in .NET you must use .NET 4.0 or newer due to the new features with Side by Side runtimes. If you write it in a older version it may crash your computer if two competing runtimes attempt to load at the same time. Also if you do get it running and working and then uninstall .NET 4.0 from your computer it also may crash your computer.



来源:https://stackoverflow.com/questions/21704293/can-i-use-logonuser-function-to-logon-to-windows-7

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