|
@@ -7,9 +7,8 @@
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices;
|
|
-using System.Text;
|
|
|
|
|
|
|
|
-namespace SMBLibrary.Authentication.Win32
|
|
|
|
|
|
+namespace SMBLibrary.Win32.Security
|
|
{
|
|
{
|
|
public enum SecBufferType : uint
|
|
public enum SecBufferType : uint
|
|
{
|
|
{
|
|
@@ -69,39 +68,4 @@ namespace SMBLibrary.Authentication.Win32
|
|
return buffer;
|
|
return buffer;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- [StructLayout(LayoutKind.Sequential)]
|
|
|
|
- public struct SecBufferDesc : IDisposable
|
|
|
|
- {
|
|
|
|
- public uint ulVersion;
|
|
|
|
- public uint cBuffers; // Indicates the number of SecBuffer structures in the pBuffers array.
|
|
|
|
- public IntPtr pBuffers; // Pointer to an array of SecBuffer structures.
|
|
|
|
-
|
|
|
|
- public SecBufferDesc(SecBuffer buffer) : this(new SecBuffer[] { buffer })
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public SecBufferDesc(SecBuffer[] buffers)
|
|
|
|
- {
|
|
|
|
- int secBufferSize = Marshal.SizeOf(typeof(SecBuffer));
|
|
|
|
- ulVersion = (uint)SecBufferType.SECBUFFER_VERSION;
|
|
|
|
- cBuffers = (uint)buffers.Length;
|
|
|
|
- pBuffers = Marshal.AllocHGlobal(buffers.Length * secBufferSize);
|
|
|
|
- IntPtr currentBuffer = pBuffers;
|
|
|
|
- for (int index = 0; index < buffers.Length; index++)
|
|
|
|
- {
|
|
|
|
- Marshal.StructureToPtr(buffers[index], currentBuffer, false);
|
|
|
|
- currentBuffer = new IntPtr(currentBuffer.ToInt64() + secBufferSize);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void Dispose()
|
|
|
|
- {
|
|
|
|
- if (pBuffers != IntPtr.Zero)
|
|
|
|
- {
|
|
|
|
- Marshal.FreeHGlobal(pBuffers);
|
|
|
|
- pBuffers = IntPtr.Zero;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|