Export (0) Print
Expand All
Expand Minimize

CredDelete function

The CredDelete function deletes a credential from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled.

Syntax


BOOL CredDelete(
  _In_ LPCTSTR TargetName,
  _In_ DWORD   Type,
  _In_ DWORD   Flags
);

Parameters

TargetName [in]

Pointer to a null-terminated string that contains the name of the credential to delete.

Type [in]

Type of the credential to delete. Must be one of the CRED_TYPE_* defined types. For a list of the defined types, see the Type member of the CREDENTIAL structure.

If the value of this parameter is CRED_TYPE_DOMAIN_EXTENDED, this function can delete a credential that specifies a user name when there are multiple credentials for the same target. The value of the TargetName parameter must specify the user name as Target|UserName.

Flags [in]

Reserved and must be zero.

Return value

The 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 codes can be returned:

  • ERROR_NOT_FOUND

    There is no credential with the specified TargetName.

  • ERROR_NO_SUCH_LOGON_SESSION

    The logon session does not exist or there is no credential set associated with this logon session. Network logon sessions do not have an associated credential set.

  • ERROR_INVALID_FLAGS

    A flag that is not valid was specified for the Flags parameter.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

WinCred.h

Library

Advapi32.lib

DLL

Advapi32.dll

Unicode and ANSI names

CredDeleteW (Unicode) and CredDeleteA (ANSI)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft