CredUICredUIPromptForWindowsCredentials Method

Creates and displays a configurable dialog box that allows users to supply credential information by using any credential provider installed on the local computer

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("CredUI.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true)]
public static Win32ErrorCode CredUIPromptForWindowsCredentials(
	ref CredUiInfo refiInfo,
	Win32ErrorCode authError,
	ref uint refAuthPackage,
	IntPtr inAuthBuffer,
	uint inAuthBufferSize,
	out IntPtr refOutAuthBuffer,
	out uint refOutAuthBufferSize,
	ref bool refSave,
	WindowsCredentialsDialogOptions flags
)

Parameters

refiInfo  CredUiInfo
A CredUiInfo structure that contains information for customizing the appearance of the dialog box.

If the Parent member is not Zero, this function displays a modal dialog box centered on the parent window.

If the Parent member is Zero, the function displays a dialog box centered on the screen.

This function ignores the Banner member.

authError  Win32ErrorCode
A Windows error code that is displayed in the dialog box.

If credentials previously collected were not valid, the caller uses this parameter to pass the error message from the API that collected the credentials (for example, Winlogon) to this function.

The corresponding error message is formatted and displayed in the dialog box.

Set the value of this parameter to zero to display no error message.

refAuthPackage  UInt32
On input, the value of this parameter is used to specify the authentication package for which the credentials in the pvInAuthBuffer buffer are serialized.

If the value of inAuthBuffer is NULL and the AuthPackageOnly flag is set in the flags parameter, only credential providers capable of serializing credentials for the specified authentication package are to be enumerated.

To get the appropriate value to use for this parameter on input, call the LsaLookupAuthenticationPackage function and use the value of the AuthenticationPackage parameter of that function.

On output, this parameter specifies the authentication package for which the credentials in the refOutAuthBuffer buffer are serialized.

inAuthBuffer  IntPtr
A pointer to a credential BLOB that is used to populate the credential fields in the dialog box.

Set the value of this parameter to NULL to leave the credential fields empty.

inAuthBufferSize  UInt32
The size, in bytes, of the inAuthBuffer buffer.
refOutAuthBuffer  IntPtr
The address of a pointer that, on output, specifies the credential BLOB.

For Kerberos, NTLM, or Negotiate credentials, call the CredUnPackAuthenticationBuffer(CredentialsPackFlags, IntPtr, Int32, IntPtr, Int32, IntPtr, Int32, IntPtr, Int32) function to convert this BLOB to string representations of the credentials.

When you have finished using the credential BLOB, clear it from memory by calling the SecureZeroMemory function, and free it by calling the CoTaskMemFree(IntPtr) function.

refOutAuthBufferSize  UInt32
The size, in bytes, of the refOutAuthBuffer buffer.
refSave  Boolean
A pointer to a Boolean value that, on input, specifies whether the Save check box is selected in the dialog box that this function displays.

On output, the value of this parameter specifies whether the Save check box was selected when the user clicks the Submit button in the dialog box.

Set this parameter to NULL to ignore the Save check box.

flags  WindowsCredentialsDialogOptions
A value that specifies behavior for this function.

Return Value

Win32ErrorCode
If the function succeeds, the function returns ERROR_SUCCESS. If the function is canceled by the user, it returns ERROR_CANCELLED. Any other Win32ErrorCode value indicates that the function failed to load.

Remarks

See Also