简体   繁体   中英

C# Unlock workstation

For a usb-smartstick application I want to make, I need to be able to unlock a locked workstation in C#. When I insert my usb with a unique id, I want to unlock the ws. What would be the best way to do this?

I'm aiming for a similar application like Rohos Logon Key.

As I understand it in order to achieve this you need replacement / hook into the implementation of the component of Windows that handles logon. To my knowledge there is no other way to achieve what you are asking for - the reason why users are required to enter the secure attention sequence (SAS) before logging in is to prevent malware from spoofing the logon dialog. If any old program could do what you are asking for then this is something that malware would be able to exploit.

There are two different methods of doing this depending on the version of Windows that you are targetting.

For Windows XP and earlier

In order to do this you need to write your own GINA (Microsoft Graphical Identification and Authentication) replacement. FYI implementing such a dll in .Net is a probably a bad idea (see A GINA replacement in a .NET language? ). Also this is fairly advanced stuff, to quote one of the below linked articles

replacing the GINA is an advanced technique that should not be taken lightly. You should only do this if you have no other choice (if, for example, you are implementing a new logon mechanism that Windows does not support).

For more information on GINA take a look through the following links

Vista and later

On Windows Vista and later GINA has been replaced with Credential Providers , so instead you need to implement the ICredentialProviderCredential interface . Although this is a COM interface, again implementing this in a .Net language would be a bad idea.

More detail can be Found in the following links

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM