Bladeren bron

Renamed SMBLibrary.Authentication.Win32 to SMBLibrary.Win32.Security

Tal Aloni 8 jaren geleden
bovenliggende
commit
c60ee93dd9

+ 5 - 4
SMBLibrary/SMBLibrary.csproj

@@ -532,10 +532,11 @@
     <Compile Include="Utilities\LogEntry.cs" />
     <Compile Include="Utilities\PrefetchedStream.cs" />
     <Compile Include="Utilities\SocketUtils.cs" />
-    <Compile Include="Win32\Authentication\LoginAPI.cs" />
-    <Compile Include="Win32\Authentication\NetworkAPI.cs" />
-    <Compile Include="Win32\Authentication\SecBufferDesc.cs" />
-    <Compile Include="Win32\Authentication\SSPIHelper.cs" />
+    <Compile Include="Win32\Security\LoginAPI.cs" />
+    <Compile Include="Win32\Security\NetworkAPI.cs" />
+    <Compile Include="Win32\Security\SSPIHelper.cs" />
+    <Compile Include="Win32\Security\Structures\SecBuffer.cs" />
+    <Compile Include="Win32\Security\Structures\SecBufferDesc.cs" />
     <Compile Include="Win32\Win32UserCollection.cs" />
   </ItemGroup>
   <ItemGroup>

+ 1 - 2
SMBLibrary/Win32/Authentication/LoginAPI.cs

@@ -7,10 +7,9 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
-using System.Text;
 using Utilities;
 
-namespace SMBLibrary.Authentication.Win32
+namespace SMBLibrary.Win32.Security
 {
     public enum LogonType
     {

+ 1 - 2
SMBLibrary/Win32/Authentication/NetworkAPI.cs

@@ -7,10 +7,9 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
-using System.Text;
 using Utilities;
 
-namespace SMBLibrary.Authentication.Win32
+namespace SMBLibrary.Win32.Security
 {
     public class NetworkAPI
     {

+ 1 - 2
SMBLibrary/Win32/Authentication/SSPIHelper.cs

@@ -7,9 +7,8 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
-using System.Text;
 
-namespace SMBLibrary.Authentication.Win32
+namespace SMBLibrary.Win32.Security
 {
     [StructLayout(LayoutKind.Sequential)]
     public struct SecHandle

+ 1 - 37
SMBLibrary/Win32/Authentication/SecBufferDesc.cs

@@ -7,9 +7,8 @@
 using System;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
-using System.Text;
 
-namespace SMBLibrary.Authentication.Win32
+namespace SMBLibrary.Win32.Security
 {
     public enum SecBufferType : uint
     {
@@ -69,39 +68,4 @@ namespace SMBLibrary.Authentication.Win32
             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;
-            }
-        }
-    }
 }

+ 47 - 0
SMBLibrary/Win32/Security/Structures/SecBufferDesc.cs

@@ -0,0 +1,47 @@
+/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
+ * 
+ * You can redistribute this program and/or modify it under the terms of
+ * the GNU Lesser Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ */
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace SMBLibrary.Win32.Security
+{
+    [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;
+            }
+        }
+    }
+}

+ 1 - 1
SMBLibrary/Win32/Win32UserCollection.cs

@@ -10,7 +10,7 @@ using System.Net;
 using System.Text;
 using Utilities;
 using SMBLibrary.Authentication;
-using SMBLibrary.Authentication.Win32;
+using SMBLibrary.Win32.Security;
 using Microsoft.Win32;
 
 namespace SMBLibrary.Server.Win32