/// <summary> /// Get credentials for user from credential manager. /// </summary> /// <param name="filter">A filter for the target name, for example DOMAIN*. If null or empty returns all credentials.</param> /// <param name="flags">Flags for the enumeration.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The list of credentials.</returns> public static NtResult <IEnumerable <Credential> > GetCredentials(string filter, CredentialEnumerateFlags flags, bool throw_on_error) { if (string.IsNullOrEmpty(filter)) { filter = null; } return(SecurityNativeMethods.CredEnumerate(flags.HasFlagSet(CredentialEnumerateFlags.AllCredentials) ? null : filter, flags, out int count, out SafeCredBuffer buffer).CreateWin32Result(throw_on_error, () => ParseCredentials(count, buffer))); }
/// <summary> /// Get credentials for user from credential manager. /// </summary> /// <param name="filter">A filter for the target name, for example DOMAIN*. If null or empty returns all credentials.</param> /// <param name="flags">Flags for the enumeration.</param> /// <returns>The list of credentials.</returns> public static IEnumerable <Credential> GetCredentials(string filter, CredentialEnumerateFlags flags) { return(GetCredentials(filter, flags, true).Result); }
internal static extern bool CredEnumerate( string Filter, CredentialEnumerateFlags Flags, out int Count, out SafeCredBuffer Credential );
internal static extern bool CredEnumerate( [In][MarshalAs(UnmanagedType.LPWStr)] string targetNameFilter, [In][MarshalAs(UnmanagedType.U4)] CredentialEnumerateFlags flags, [Out] out int count, [Out] out IntPtr credenitalsArrayPtr);
public static extern bool CredEnumerate( string filter, CredentialEnumerateFlags flags, out int count, out IntPtr credentialsList);
internal static extern bool CredEnumerate(string targetNameFilter, CredentialEnumerateFlags flags, out int count, out IntPtr credenitalsArrayPtr);
internal static extern bool CredEnumerate(string targetNameFilter, CredentialEnumerateFlags flags, out int count, out IntPtr credenitalsArrayPtr);