This topic has not yet been rated - Rate this topic

CredRename function

[CredRename is no longer supported. Starting with Windows Vista, calls to CredRename always return ERROR_NOT_SUPPORTED.]

Applies to: desktop apps only

The CredRename function renames a credential in 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 CredRename(
  __in  LPCTSTR OldTargetName,
  __in  LPCTSTR NewTargetName,
  __in  DWORD Type,
  __in  DWORD Flags
);

Parameters

OldTargetName [in]

Pointer to a null-terminated string that contains the current name of the credential to be renamed.

NewTargetName [in]

Pointer to a null-terminated string that contains the new name for the credential.

Type [in]

Type of the credential to rename. Must be one of the CRED_TYPE_* defines.

Flags [in]

Flags to control the operation of the function. Currently 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 OldTargetName.

  • ERROR_ALREADY_EXISTS

    There is already a credential or type Type and named NewTargetName.

  • 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

Minimum supported server

Windows Server 2003

Header

WinCred.h

Library

Advapi32.lib

DLL

Advapi32.dll

Unicode and ANSI names

CredRenameW (Unicode) and CredRenameA (ANSI)

 

 

Send comments about this topic to Microsoft

Build date: 3/13/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ