Expand Minimize

CredFindBestCredential function

The CredFindBestCredential function searches the Credentials Management (CredMan) database for the set of generic credentials that are associated with the current logon session and that best match the specified target resource.

Syntax


BOOL WINAPI CredFindBestCredential(
  _In_   LPCTSTR TargetName,
  _In_   DWORD Type,
  _In_   DWORD Flags,
  _Out_  PCREDENTIAL *Credential
);

Parameters

TargetName [in]

A pointer to a null-terminated string that contains the name of the target resource for which to find credentials.

Type [in]

The type of credentials to search for. Currently, this function supports only CRED_TYPE_GENERIC.

Flags [in]

Reserved.

Credential [out]

The address of a pointer to a CREDENTIAL structure that specifies the set of credentials this function finds.

When you have finished using this structure, free it by calling the CredFree function.

Return value

If the function succeeds, it returns TRUE.

If the function fails, it returns FALSE. To get extended error information, call GetLastError.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinCred.h

Library

Advapi32.lib

DLL

Advapi32.dll

Unicode and ANSI names

CredFindBestCredentialW (Unicode) and CredFindBestCredentialA (ANSI)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft