Moved SECBUFFER_VERSION definition to SecBufferDesc

This commit is contained in:
Tal Aloni 2017-02-17 16:02:23 +02:00
parent ee65a99a92
commit 2b52d4b84c
2 changed files with 3 additions and 2 deletions

View file

@ -12,7 +12,6 @@ namespace SMBLibrary.Win32.Security
{ {
public enum SecBufferType : uint public enum SecBufferType : uint
{ {
SECBUFFER_VERSION = 0,
SECBUFFER_EMPTY = 0, SECBUFFER_EMPTY = 0,
SECBUFFER_DATA = 1, SECBUFFER_DATA = 1,
SECBUFFER_TOKEN = 2 SECBUFFER_TOKEN = 2

View file

@ -13,6 +13,8 @@ namespace SMBLibrary.Win32.Security
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct SecBufferDesc : IDisposable public struct SecBufferDesc : IDisposable
{ {
public const uint SECBUFFER_VERSION = 0;
public uint ulVersion; public uint ulVersion;
public uint cBuffers; // Indicates the number of SecBuffer structures in the pBuffers array. public uint cBuffers; // Indicates the number of SecBuffer structures in the pBuffers array.
public IntPtr pBuffers; // Pointer to an array of SecBuffer structures. public IntPtr pBuffers; // Pointer to an array of SecBuffer structures.
@ -24,7 +26,7 @@ namespace SMBLibrary.Win32.Security
public SecBufferDesc(SecBuffer[] buffers) public SecBufferDesc(SecBuffer[] buffers)
{ {
int secBufferSize = Marshal.SizeOf(typeof(SecBuffer)); int secBufferSize = Marshal.SizeOf(typeof(SecBuffer));
ulVersion = (uint)SecBufferType.SECBUFFER_VERSION; ulVersion = SECBUFFER_VERSION;
cBuffers = (uint)buffers.Length; cBuffers = (uint)buffers.Length;
pBuffers = Marshal.AllocHGlobal(buffers.Length * secBufferSize); pBuffers = Marshal.AllocHGlobal(buffers.Length * secBufferSize);
IntPtr currentBuffer = pBuffers; IntPtr currentBuffer = pBuffers;