예제 #1
0
        /// <summary>
        /// 信任状を文字列に変換する
        /// </summary>
        /// <param name="CredType"></param>
        /// <param name="CredInforgbHashOfCert"></param>
        /// <param name="MarshaledCredential"></param>
        /// <returns></returns>
        public static string MarshalCredential(CredMarshalType CredType, IntPtr Credential)
        {
            if (Interop.CredMarshalCredential(CredType, Credential, out var MarshaledCredential))
            {
                using (var getter = new CriticalCredGetterHandle <string>(MarshaledCredential, Marshal.PtrToStringUni))
                    return(getter.Value);
            }
            var hresult   = Marshal.GetHRForLastWin32Error();
            var exception = Marshal.GetExceptionForHR(hresult);

            if (unchecked ((uint)hresult) == 0x80070032)
            {
                throw new NotSupportedException("not support.", exception);
            }
            throw exception;
        }
예제 #2
0
 public static extern bool CredUnmarshalCredential(string marshaledCredential, out CredMarshalType credType, out IntPtr credential);
예제 #3
0
 public BaseCredentialInfo(CredMarshalType Type, IntPtr Credential)
 {
     this.Type       = Type;
     this.Credential = Credential;
 }
예제 #4
0
 public static extern bool CredMarshalCredential(CredMarshalType credType, IntPtr credential, out IntPtr marshaledCredential);