Jump to content

Store credentials with _WinAPI_ShellUserAuthenticationDlgEx()


Go to solution Solved by DonChunior,

Recommended Posts

I'm just testing around on how to store credentials in Credential Manager.
With the function _WinAPI_ShellUserAuthenticationDlg() I managed this quite easily:
 

#include <WinAPIDlg.au3>

_WinAPI_ShellUserAuthenticationDlg( _
        "Any title for the dialog box", _
        "Any hint to enter the credentials.", _
        @UserName, _
        "Abc123", _
        "Example", _
        BitOR($CREDUI_FLAGS_GENERIC_CREDENTIALS, $CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX), _
        Default, _
        True)


If you execute the previous code, you will find the entry "Example" in the section for generic credentials.

In the Microsoft help for the CredUIPromptForCredentials() function, which is the counterpart to the AutoIt function _WinAPI_ShellUserAuthenticationDlg(), it is recommended to use the CredUIPromptForWindowsCredentials() function for newer Windows versions.
The corresponding AutoIt function for this is _WinAPI_ShellUserAuthenticationDlgEx():
 

#include <WinAPIDlg.au3>

_WinAPI_ShellUserAuthenticationDlgEx( _
        "Any title for the dialog box", _
        "Any hint to enter the credentials.", _
        @UserName, _
        "Abc123", _
        BitOR($CREDUIWIN_GENERIC, $CREDUIWIN_CHECKBOX), _
        Default, _
        True)


But I can't manage to create an entry for the login information.
What do I have to do for this to be the case?

Thanks,
DonChunior

Link to comment
Share on other sites

  • Solution

After reading the descriptions of the two Windows functions in more detail, I came up with the solution myself. 👨‍🎓

For CredUIPromptForCredentials(), towards the end of the Remarks section, there is the following sentence:

Quote

Credentials are stored in the credential manager based on target name.

However, for CredUIPromptForWindowsCredentials(), the Remarks section says the following sentence right at the beginning:

Quote

This function does not save credentials.

Consequently, the corresponding AutoIt function _WinAPI_ShellUserAuthenticationDlgEx() doesn't save credentials either.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...