CredEnumerateA function (wincred.h)
The CredEnumerate function enumerates the credentials 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 CredEnumerateA(
[in] LPCSTR Filter,
[in] DWORD Flags,
[out] DWORD *Count,
[out] PCREDENTIALA **Credential
);
Parameters
[in] Filter
Pointer to a null-terminated string that contains the filter for the returned credentials. Only credentials with a TargetName matching the filter will be returned. The filter specifies a name prefix followed by an asterisk. For instance, the filter "FRED*" will return all credentials with a TargetName beginning with the string "FRED".
If NULL is specified, all credentials will be returned.
[in] Flags
The value of this parameter can be zero or more of the following values combined with a bitwise-OR operation.
[out] Count
Count of the credentials returned in the Credentials array.
[out] Credential
Pointer to an array of pointers to credentials. The returned credential is a single allocated block. Any pointers contained within the buffer are pointers to locations within this single allocated block. The single returned buffer must be freed by calling CredFree.
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.
Return code/value | Description |
---|---|
|
No credential exists matching the specified Filter. |
|
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. |
|
A flag that is not valid was specified for the Flags parameter, or CRED_ENUMERATE_ALL_CREDENTIALS is specified for the Flags parameter and the Filter parameter is not NULL. |
Remarks
Note
The wincred.h header defines CredEnumerate 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 XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincred.h |
Library | Advapi32.lib |
DLL | Advapi32.dll |