CredUICredUIConfirmCredentials Method

The CredUIConfirmCredentials(String, Boolean) function is called after CredUIPromptForCredentials(CredUiInfo, String, IntPtr, Win32ErrorCode, StringBuilder, Int32, StringBuilder, Int32, Boolean, CredentialsDialogOptions) or CredUICmdLinePromptForCredentials(String, IntPtr, Win32ErrorCode, StringBuilder, UInt32, StringBuilder, UInt32, Boolean, CredentialsDialogOptions), to confirm the validity of the credential harvested.

CredUIConfirmCredentials(String, Boolean) must be called if the ExpectConfirmation flag was passed to the "prompt" function, either CredUIPromptForCredentials(CredUiInfo, String, IntPtr, Win32ErrorCode, StringBuilder, Int32, StringBuilder, Int32, Boolean, CredentialsDialogOptions) or CredUICmdLinePromptForCredentials(String, IntPtr, Win32ErrorCode, StringBuilder, UInt32, StringBuilder, UInt32, Boolean, CredentialsDialogOptions), and the "prompt" function returned ERROR_SUCCESS.

After calling the "prompt" function and before calling CredUIConfirmCredentials(String, Boolean), the caller must determine whether the credentials are actually valid by using the credentials to access the resource specified by targetName. The results of that validation test are passed to CredUIConfirmCredentials(String, Boolean) in the confirm parameter.

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 CredUIConfirmCredentials(
	string targetName,
	bool confirm
)

Parameters

targetName  String
Pointer to a null-terminated string that contains the name of the target for the credentials, typically a domain or server application name.

This must be the same value passed as targetName to CredUIPromptForCredentials(CredUiInfo, String, IntPtr, Win32ErrorCode, StringBuilder, Int32, StringBuilder, Int32, Boolean, CredentialsDialogOptions) or CredUICmdLinePromptForCredentials(String, IntPtr, Win32ErrorCode, StringBuilder, UInt32, StringBuilder, UInt32, Boolean, CredentialsDialogOptions).

confirm  Boolean
Specifies whether the credentials returned from the prompt function are valid.

If , the credentials are stored in the credential manager as defined by CredUIPromptForCredentials(CredUiInfo, String, IntPtr, Win32ErrorCode, StringBuilder, Int32, StringBuilder, Int32, Boolean, CredentialsDialogOptions) or CredUICmdLinePromptForCredentials(String, IntPtr, Win32ErrorCode, StringBuilder, UInt32, StringBuilder, UInt32, Boolean, CredentialsDialogOptions).

If , the credentials are not stored and various pieces of memory are cleaned up.

Return Value

Win32ErrorCode
Status of the operation is returned.

The caller can check this status to determine whether the credential confirm operation succeeded.

Most applications ignore this status code because the application's connection to the resource has already been done. The operation can fail because the credential was not found on the list of credentials awaiting confirmation, or because the attempt to write or delete the credential failed.

Failure to find the credential on the list can occur because the credential was never queued or as a result of too many credentials being queued.

Up to five credentials can be queued before older ones are discarded as newer ones are queued.

Remarks

See Also