开发者

Unlock local computer using .net

Is there any way, without using DLL injection, services, and wha开发者_StackOverflow社区tnot, to unlock the local computer using .net? The windows username and password is available to my program.


I think there is no .NET function that you can use to unlock your computer and there is no short way to achieve it. But there is a way.

You need to implement your custom ICredentialProvider componet, hook it into the windows authentication mechanism, and implement communication between it and your application.

The Windows 7 authentication mechanism consists of two parts. They are WinLogon and LogonUI. LogonUI is responsible for displaying a login window and notification of WinLogon about users’ actions. Winlogon reacts for events from LogonUI and performs required actions to log-in users, log-off users, lock sessions, and unlock sessions.

Microsoft provides a mechanism to hook a custom behavior into LogonUI. To do this you need to create a COM object that implements ICredentialProvider and register it with a system. You component can tell LogonUI to tell WinLogon to unlock a session.

Here are couple examples of how to build custom credential providers: How to Build Custom Logon UI’s in Windows Vista, Create Custom Login Experiences With Credential Providers For Windows Vista

This mechanism will work for Windows Vista and Windows 7. You need to use similar mechanism called GINA if you want to achieve the same result for Windows XP. Here you can read more about GINA: Winlogon and GINA

There was a hack that you could kind of “unlock” a session in Windows XP.

WinLogon in Windows XP created an additional desktop and switched to it when user chose to lock a session. It was possible to switch back to a “normal” desktop using Windows API. Everything worked fine except WinLogon still though that system is locked and did not react for Ctrl-Alt-Del. I believe that it will not work for Windows Vista and 7. But you could try. It can be simple than implementing a custom credential provider.

Here is an example of how to do that: Remotely Unlock a Windows Workstation

I hope this answered your question.


No there isn't, at least not within the context specified in your question. But i have to ask - why do you want it unlocked? If you need an application to run, the machine doesn't have to be unlocked for that to happen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜