Skip to content

Commit

Permalink
コメントアウトしてた周りの確認。ソース更新。
Browse files Browse the repository at this point in the history
※ただし、動かなかったので再度コメントアウトした。
  • Loading branch information
juner committed Apr 15, 2018
1 parent 2b3575a commit 0a8274f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion WinCred/Interop/Credential.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public WinCred.Credential ToManaged()
LastWritten = LastWritten.ToDateTime(),
CredentialBlob = CredentialBlob,
Persist = Persist,
//Attributes = (Attributes ?? Enumerable.Empty<UnmanagedCredentialAttribute>())
//Attributes = (Attributes ?? Enumerable.Empty<CredentialAttribute>())
// .Select(uca => uca.ToManaged())
// .ToArray(),
TargetAlias = TargetAlias,
Expand Down
12 changes: 7 additions & 5 deletions WinCred/Interop/CredentialAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Advapi32.WinCred.Unmanaged
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
public struct CredentialAttribute : IUnmanaged<WinCred.CredentialAttribute>
{
[MarshalAs(UnmanagedType.LPWStr)]
public string Keyword;
public uint Flags;
uint ValueSize;
Expand Down Expand Up @@ -54,13 +56,13 @@ public byte[] Value
public static CredentialAttribute From(IntPtr Ptr)
{
return (CredentialAttribute)Marshal.PtrToStructure(Ptr, typeof(CredentialAttribute));
//var Size = Marshal.SizeOf(typeof(UnmanagedCredentialAttribute));
//var Size = Marshal.SizeOf(typeof(CredentialAttribute));
//var bytes = new byte[Size];
//Marshal.Copy(Ptr, bytes, 0, Size);
//var Keyword = Marshal.PtrToStringBSTR(new IntPtr(BitConverter.ToInt32(bytes, 0)));
//var Flags = BitConverter.ToUInt32(bytes, 4);
//var KeywordPtr = Marshal.ReadIntPtr(Ptr, 0);
//var Keyword = Marshal.PtrToStringUni(KeywordPtr);
//var Flags = (uint)Marshal.ReadInt32(Ptr, 4);
//var _Value = new IntPtr(BitConverter.ToInt32(bytes, 8));
//return new UnmanagedCredentialAttribute
//return new CredentialAttribute
//{
// Keyword = Keyword,
// Flags = Flags,
Expand Down

0 comments on commit 0a8274f

Please sign in to comment.