CredUIPromptForWindowsCredentials (credui)
Last changed: -82.113.106.205

.
Summary
The CredUIPromptForWindowsCredentials function creates and displays a configurable dialog box that allows users to supply credential information by using any credential provider installed on the local computer.

C# Signature:

[DllImport("credui.dll", SetLastError=true)]
static extern TODO CredUIPromptForWindowsCredentials(TODO);

VB Signature:

    ''' <summary>
    ''' The CredUIPromptForWindowsCredentials function creates and displays a configurable dialog box that allows users to supply credential information by using any credential provider installed on the local computer.
    ''' NOTE: Windows Vista or Server 2008 or later ONLY. For older Windows versions use CredUIPromptForCredentials().
    ''' See http://msdn.microsoft.com/en-us/library/aa375178(v=VS.85).aspx
    ''' </summary>
    ''' <param name="pUiInfo">The CREDUI_INFO structure with customises the appearance of the dialog.</param>
    ''' <param name="dwAuthError">If prompting after an error pass the Windows Error code so the appropriate error message is included in the dialog.</param>
    ''' <param name="pulAuthPackage">Determine the authentication package to use. Pass zero to use default. Returns with identifier for package used.</param>
    ''' <param name="pvInAuthBuffer">An authentication buffer with which to default prompted values (see <see cref="CredPackAuthenticationBuffer" />).</param>
    ''' <param name="ulInAuthBufferSize">Size of the input authentication buffer.</param>
    ''' <param name="ppvOutAuthBuffer">An authentication buffer which will be populated with entered credentials (see <see cref="CredUnPackAuthenticationBuffer" />).</param>
    ''' <param name="pulOutAuthBufferSize">Size of the output authentication buffer.</param>
    ''' <param name="pfSave">If set to <c>True</c> the check the "Save" checkbox on the dialog - only displayed if CREDUIWIN_CHECKBOX is passed in dwFlags.</param>
    ''' <param name="dwFlags">Flags to control the dialog functionality (see <see cref="CredUIWinFlags" />.</param>
    ''' <returns>A <see cref="CredUIReturnCodes" /> value.</returns>
    <System.Runtime.InteropServices.DllImport("credui.dll", EntryPoint:="CredUIPromptForWindowsCredentials", CharSet:=CharSet.Unicode)> <CLSCompliant(False)> _
    Public Shared Function CredUIPromptForWindowsCredentials(ByRef pUiInfo As CREDUI_INFO, _
                                ByVal dwAuthError As UInt32, _
                                ByRef pulAuthPackage As UInt32, _
                                ByVal pvInAuthBuffer As IntPtr, _
                                ByVal ulInAuthBufferSize As UInt32, _
                                ByRef ppvOutAuthBuffer As IntPtr, _
                                ByRef pulOutAuthBufferSize As UInt32, _
                                <MarshalAs(UnmanagedType.Bool)> ByRef pfSave As Boolean, _
                                ByVal dwFlags As CredUIWinFlags) As CredUIReturnCodes
    End Function

User-Defined Types:

VB Syntax:

    <Flags()> _
    Public Enum CredUIWinFlags As Integer
    CredUIWin_Generic = &H1
    CredUIWin_Checkbox = &H2
    CredUIWin_AuthPackage_Only = &H10
    CredUIWin_InCred_Only = &H20
    CredUIWin_Enumerate_Admins = &H100
    CredUIWin_Enumerate_CurrentUser = &H200
    CredUIWin_Secure_Prompt = &H1000
    CredUIWin_Pack_32_Wow = &H10000000
    End Enum

    Public Enum CredUIReturnCodes As Integer
    NO_ERROR = 0
    ERROR_CANCELLED = 1223
    ERROR_NO_SUCH_LOGON_SESSION = 1312
    ERROR_NOT_FOUND = 1168
    ERROR_INVALID_ACCOUNT_NAME = 1315
    ERROR_INSUFFICIENT_BUFFER = 122
    ERROR_INVALID_PARAMETER = 87
    ERROR_INVALID_FLAGS = 1004
    End Enum

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation