CredUICredPackAuthenticationBuffer Method

Converts a string user name and password into an authentication buffer.

Beginning with Windows 8, the CredPackAuthenticationBuffer(CredentialsPackFlags, String, String, IntPtr, Int32) function converts an identity credential into an authentication buffer, which is a SEC_WINNT_AUTH_IDENTITY_EX2 structure. This buffer can be passed to LsaLogonUser, AcquireCredentialsHandle, or other identity provider interfaces.

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, SetLastError = true)]
public static bool CredPackAuthenticationBuffer(
	CredentialsPackFlags flags,
	string userName,
	string password,
	IntPtr packedCredentials,
	ref int refPackedCredentialsSize
)

Parameters

flags  CredentialsPackFlags
Specifies how the credential should be packed.
userName  String
A pointer to a null-terminated string that specifies the user name to be converted.

For domain users, the string must be in the following format:

DomainName/UserName

password  String
A pointer to a null-terminated string that specifies the password to be converted.
packedCredentials  IntPtr
A pointer to an array of bytes that, on output, receives the packed authentication buffer.

This parameter can be NULL to receive the required buffer size in the refPackedCredentialsSize parameter.

refPackedCredentialsSize  Int32
A value that specifies the size, in bytes, of the packedCredentials buffer.

On output, if the buffer is not of sufficient size, specifies the required size, in bytes, of the packedCredentials buffer.

Return Value

Boolean
if the function succeeds; otherwise, .

Remarks

See Also