I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password.
This article https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx explains the logon authentication workflow on Windows in the following image:
As seen above, on step 5, the user inputs the credentials into the Logon UI. What I want to achieve is to have the Windows Service input the credentials and have winlogon perform the login.
There is no winlogon API to achieve this. As seen in other questions, using winapi's LogonUser
function successfully performs the authentication and returns a token, but it does not switch to the application desktop and the Logon UI remains on screen.
Most articles and SO answers hint towards credentials providers, but all credentials providers samples require user interaction with the Logon UI.
Update: I see some users haven't exactly understood the question and are proposing workarounds that are not useful for my case. The workflow that I'm trying to achieve is the following:
- Windows service starts on Windows boot (done).
- Same Windows service has a web service and accepts HTTP requests through an API (done).
- User provides credentials to the service through the API from another device (done).
- Provided credentials are used to log into the work station.
4.1 Provided credentials are used to also unlock the work station in case of lock (WinKey + L). - (Optional) The service exposes the Windows accounts via the API.
- (Optional) The user is able to specify to the service what account wants to use for login.
For now, I am interested in making steps 4 and 4.1.
LogonUser
method and use the authentication token to switch to application desktop. Any other method is welcome, as long as it gets the service to successfully unlock the station. – Padlock