public IDisposableGetter <IEnumerable <Credential> > ReadDomainCredentials(CredReadDomainCredentialsFlags Flags = default)
        {
            if (Interop.CredReadDomainCredentials(ref this, Flags, out var Count, out var Credentials))
            {
                return(new CriticalCredGetterHandle <IEnumerable <Credential> >(Credentials, p => Credential.Froms((int)Count, Credentials)));
            }
            var hresult   = Marshal.GetHRForLastWin32Error();
            var exception = Marshal.GetExceptionForHR(hresult);

            if (unchecked ((uint)hresult) == 0x80070032)
            {
                throw new NotSupportedException("not support.", exception);
            }
            throw exception;
        }
Esempio n. 2
0
 public IEnumerable <Credential> ReadDomainCredentials(CredReadDomainCredentialsFlags Flags = default)
 => UnmanagedDisposableGetter <Unmanaged.CredentialTargetInformation, CredentialTargetInformation> .From(this)
 ?.Using().Select(g => g.Value.ReadDomainCredentials(Flags)).Using(g => g.Value)?.Select(c => c.ToManaged())
 ?? Enumerable.Empty <Credential>();
Esempio n. 3
0
 public static extern bool CredReadDomainCredentials(ref Unmanaged.CredentialTargetInformation TargetInfo, CredReadDomainCredentialsFlags Flags, out uint Count, out IntPtr Credentials);