CredWrite (Compact 2013)

3/28/2014

The CredWrite function creates a credential that is uniquely identified by the tuple that contains the credential type and the target ID associated with the credential. If there is already a credential corresponding to that tuple, then it is updated, unless flags explicitly override that behavior. This function replaces CeCredWrite (deprecated).

Syntax

DWORD CredWrite(
  PCRED pCred,
  DWORD dwFlags
);

Parameters

  • pCred
    [in] Pointer to the credential that has to be added.

    For more information about the credential structure used, see the CRED structure.

  • dwFlags
    [in] Flags that determine behavior when credential already exists, and can be one of the following flags.

    Flag

    Description

    CRED_FLAG_FAIL_IF_EXISTING

    If credential already exists then the call to CredWrite will fail.

    CRED_FLAG_NO_BLOB_HANDLING

    Meant for use by privileged SSPs. This flag requests that the blob not be manipulated, which may or may not be honored depending on whether the caller is trusted. For more information, see Credential Manager Registry Settings and HandleBlob.

Return Value

ERROR_SUCCESS is returned upon success. For a list of error codes, see Credential Manager Error Codes.

Remarks

The credential that has to be created must have wszTarget, wszUser, and pBlob values that are not NULL.

Requirements

Header

cred.h

Library

coredll.lib

See Also

Reference

Credential Manager Functions
CRED