Basaa
Basaa

Reputation: 1685

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.

Upvotes: 4

Views: 5214

Answers (1)

Justin
Justin

Reputation: 86799

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

Upvotes: 6

Related Questions