Unlock Windows programmatically

You’ll need a custom windows credential provider to log in for you. Also, you’ll need to save the user’s credentials somewhere to log in. There are some samples in Windows SDK 7 https://www.microsoft.com/en-us/download/details.aspx?id=8279

There’s a bunch of projects to get you started under Samples\security\credentialproviders.

To unlock the screen:

  • set the username / password in CSampleCredential::Initialize
  • set autologin to true in CSampleCredential::SetSelected
  • search the hardware provider sample for WM_TOGGLE_CONNECTED_STATUS message to see how to trigger the login
  • build some way to communicate with your app to trigger the unlock (local tcp server for example)

It’s a pain in the ass, but it works.

Leave a Comment