LogonUser() API blocks with wrong credentials - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

LogonUser() API blocks with wrong credentials


We are impersonating a user in an application that runs as a service. The service under which the application is running is started with Logon as Local System Account.

User have all the required previledge required like log on as service.
After providing correct credentials we are able to do successful impersonation

if the password passed to LogonUser() API is wrong it blocked/hanging.
we are using OS: Windows XP

For impersonation we are calling LogonUser() API


steps followed for impersonation are as follows-
1. LookupPrivilegeValue for SE_TCB_NAME
2. OpenProcessToken
3. AdjustTokenPrivileges
4. LogonUser
5. LoadUserProfile
6. ImpersonateLoggedOnUser

any suggestion would be great help for us.

Thanks in advance
Sign In or Register to comment.