示例#1
0
        public static SafeFreeCredentials AcquireDefaultCredential(ISSPIInterface secModule, string package, Interop.SspiCli.CredentialUse intent)
        {
            if (NetEventSource.Log.IsEnabled())
            {
                NetEventSource.Log.AcquireDefaultCredential(package, intent);
            }

            SafeFreeCredentials?outCredential = null;
            int errorCode = secModule.AcquireDefaultCredential(package, intent, out outCredential);

            if (errorCode != 0)
            {
                if (NetEventSource.Log.IsEnabled())
                {
                    NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(AcquireDefaultCredential), $"0x{errorCode:X}"));
                }
                throw new Win32Exception(errorCode);
            }
            return(outCredential);
        }