CredFindBestCredentialA function (wincred.h)

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 CredFindBestCredentialA(
  LPCSTR       TargetName,
  DWORD        Type,
  DWORD        Flags,
  PCREDENTIALA *Credential
);

Parameters

TargetName

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

Type

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

Flags

Reserved.

Credential

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.

Remarks

Note

The wincred.h header defines CredFindBestCredential 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

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header wincred.h
Library Advapi32.lib
DLL Advapi32.dll