CredFindBestCredentialW 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 CredFindBestCredentialW(
[in] LPCWSTR TargetName,
[in] DWORD Type,
[in] DWORD Flags,
[out] PCREDENTIALW *Credential
);
Parameters
[in] TargetName
A pointer to a null-terminated string that contains the name of the target resource for which to find credentials.
[in] Type
The type of credentials to search for. Currently, this function supports only CRED_TYPE_GENERIC.
[in] Flags
Reserved.
[out] 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 that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
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 |