How to verify NT password?

I got a mission to verify password before creating service.

It seems that there is no API function to do this directly.

The two possible solutions are

1. LogonUser(). This can verify passwd however it requires the user must have TCB privilege(Acting as part of operating system).

2. NetUserChangePassword(). The trick is to use this function to change password to itself. It will also verify the password. However if the account has "Allow Changes in X days" set in the "Minimum Password Age", this function will hang up forever.

Can anyone tell me another function to do it?

Thanks a lot in advance.

Who is Participating?
Tommy HuiConnect With a Mentor EngineerCommented:
Search the MSDN articles for this keyword: Q180548 at It provides sample code to doing that.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.