CredUnmarshalCredentialA function (wincred.h)

The CredUnmarshalCredential function transforms a marshaled credential back into its original form.

Syntax

BOOL CredUnmarshalCredentialA(
  [in]  LPCSTR             MarshaledCredential,
  [out] PCRED_MARSHAL_TYPE CredType,
  [out] PVOID              *Credential
);

Parameters

[in] MarshaledCredential

Pointer to a null-terminated string that contains the marshaled credential.

[out] CredType

Type of credential specified by MarshaledCredential.

This is one of the CRED_MARSHAL_TYPE values.

[out] Credential

Pointer to the unmarshaled credential. If CredType returns CertCredential, the returned pointer is to a CERT_CREDENTIAL_INFO structure. If CredType returns UsernameTargetCredential, the returned pointer is to a USERNAME_TARGET_CREDENTIAL_INFO structure.

The caller should free the returned buffer using CredFree.

Return value

This function returns TRUE on success and FALSE on failure. The GetLastError function can be called to get a more specific status code. The following status code can be returned:

ERROR_INVALID_PARAMETER

MarshaledCredential is not valid.

Remarks

Note

The wincred.h header defines CredUnmarshalCredential as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header wincred.h
Library Advapi32.lib
DLL Advapi32.dll

See also

CERT_CREDENTIAL_INFO

CRED_MARSHAL_TYPE

CredFree

CredMarshalCredential

GetLastError

USERNAME_TARGET_CREDENTIAL_INFO