Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top