tags:

views:

238

answers:

2

As we all know,we can use such api as "LockWorkStation()" in "user32.dll" to lock windows. But how to unlock it?

For example, if i run an app at first, I want the app to unlock windows by itself after 30 second. How to do it? In another word, if auto-logging in, windows will read the username and password from regedit and then use an api to login by those. Now i need the api. It must exist, but it seems not to make public.

I can get the app the username and password of the windows.

It seems that there is some Api in WBF.But you know,the resource is too less. I don't want to send keyboard message to solve the problem,for it is the worst method.

+1  A: 

When the workstation is locked the only way to unlock it is by the user logging in (pressing Ctrl-Alt-Del and entering correct password). This is a security feature that you cannot circumvent using an application API.

Martin Liversage
But you know,if autologin, windows will read the username and password from regedit and then use an api to login windows by those.Now i need the api.It must exist,but it seems not to make public.
Edwin Tai
The autologin feature is different than an unlock. With AutoLogin your username and password is stored in the registry. Unlocks are not. Perhaps a better approach to this question is to describe what you are trying to do. You may be able to do it without unlocking their system.
Rob Haupt
I am writing some code for face recognization.If unrecoginzed,the system will be locked,otherwise,be unlocked.i know the username and password. But i want the app to unlock system by itself with the username and password parameters i gave it.
Edwin Tai
It sounds like you need to write a GINA (http://en.wikipedia.org/wiki/Graphical_Identification_and_Authentication) DLL.
Larry Osterman
+6  A: 

Promoting my comment because it needs more explanation:

You really want to write a GINA (for XP) or a Credential Provider for Windows Vista and beyond.

Fundamentally the Windows authentication model is based on the user providing evidence (identification) that they're authorized to access the computer (either by their credentials or biometric data or smartcard or other information). Once you've been authorized to log onto the computer, Windows allows you access.

When the workstation is locked (for whatever reason - screen saver, user typing in Win-L) the user needs to be re-authenticated.

Typically that's sufficient - the authorization is good for a period of time (determined by the administrator). If (for policy reasons) you need a finer grained control model, you could use your "LockWorkstation" idea to force the user to re-authenticate themselves. You need to be VERY careful about false positives (nothing pisses off users more than being told they're not allowed to use their computer simply because they removed their glasses or combed their hair differently) and how much drain on system resources your app causes.

Larry Osterman
thanks for advise :)
Edwin Tai