CredUICredUIParseUserName Method

Extracts the domain and user account name from a fully qualified user name.

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 CredUIParseUserName(
	string userName,
	StringBuilder userBuffer,
	int userBufferSize,
	StringBuilder domainName,
	int domainNameSize
)

Parameters

userName  String
Pointer to a null-terminated string that contains the user name to be parsed.

The name must be in UPN or down-level format, or a certificate.

Typically, userName is received from the CredUIPromptForCredentials(CredUiInfo, String, IntPtr, Win32ErrorCode, StringBuilder, Int32, StringBuilder, Int32, Boolean, CredentialsDialogOptions) or CredUICmdLinePromptForCredentials(String, IntPtr, Win32ErrorCode, StringBuilder, UInt32, StringBuilder, UInt32, Boolean, CredentialsDialogOptions).

userBuffer  StringBuilder
Pointer to a null-terminated string that receives the user account name.
userBufferSize  Int32
Maximum number of characters to write to the pszUser string including the terminating null character.
domainName  StringBuilder
Pointer to a null-terminated string that receives the domain name.

If userName specifies a certificate, domainName will be NULL.

domainNameSize  Int32
Maximum number of characters to write to the domainName string including the terminating null character.

Return Value

Win32ErrorCode
Returns ERROR_SUCCESS on success, or a Win32ErrorCode error code on failure.

Remarks

See Also