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.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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
)
<DllImportAttribute("CredUI.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function CredPackAuthenticationBuffer (
flags As CredentialsPackFlags,
userName As String,
password As String,
packedCredentials As IntPtr,
ByRef refPackedCredentialsSize As Integer
) As Boolean
Dim flags As CredentialsPackFlags
Dim userName As String
Dim password As String
Dim packedCredentials As IntPtr
Dim refPackedCredentialsSize As Integer
Dim returnValue As Boolean
returnValue = CredUI.CredPackAuthenticationBuffer(flags,
userName, password, packedCredentials,
refPackedCredentialsSize)
public:
[DllImportAttribute(L"CredUI.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static bool CredPackAuthenticationBuffer(
CredentialsPackFlags flags,
String^ userName,
String^ password,
IntPtr packedCredentials,
int% refPackedCredentialsSize
)
[<DllImportAttribute("CredUI.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member CredPackAuthenticationBuffer :
flags : CredentialsPackFlags *
userName : string *
password : string *
packedCredentials : IntPtr *
refPackedCredentialsSize : int byref -> bool
No code example is currently available or this language may not be supported.
- 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.
Boolean if the function succeeds; otherwise,
.