Search code examples
c++windowspasswordsuser-accounts

Windows: How to get full users' accounts


Is there any way to get users' system account? I want to make authorisation in my prog with Windows account. Trying to use Active Directory, but it only helps with names and other information, but what about passwords? I understand that I can't get passwords in free access, and I don't need this. But is there any way just to compare input string with real user's windows password? Or is there any other way to embed authorisation into my program with windows users' accounts?


Solution

  • You may start with NetUserEnum, and with NetQueryDisplayInformation. There is no way to determine password of a user.

    You may use LogonUser API to authenticate users based on password they'd give on your logon window. You should not keep the password after this API succeeds - that's a breach of safety.

    Use CredUIPromptForCredentials for asking the user credentials.