0

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?

nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • 1
    The `LogonUser` function creates a logon session and a security token for the user, which you can then use to create processes which will run in that user's security context. It does not initiate an interactive logon. (The interactive logon process uses `LogonUser` but it also does many other things.) – Harry Johnston Feb 11 '14 at 20:30

1 Answers1

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.

Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
  • Hi Scott, I'm using the credential provider of pGina to log users to Windows by webservice. I would like to ask you, why we need to create a custom Credential Provider and we can't call all the steps to logon user in an application (in my case I would like to logon my users from Screensaver in C#) ? Thanks – TheMightyX2Y Jul 23 '14 at 06:51