Преглед на файлове

Updated UI to enable selection of SMB1.0/CIFS and/or SMB 2.0 / 2.1

Tal Aloni преди 8 години
родител
ревизия
723df4698b
променени са 2 файла, в които са добавени 72 реда и са изтрити 10 реда
  1. 51 9
      SMBServer/ServerUI.Designer.cs
  2. 21 1
      SMBServer/ServerUI.cs

+ 51 - 9
SMBServer/ServerUI.Designer.cs

@@ -36,6 +36,9 @@ namespace SMBServer
             this.lblTransport = new System.Windows.Forms.Label();
             this.lblAddress = new System.Windows.Forms.Label();
             this.chkIntegratedWindowsAuthentication = new System.Windows.Forms.CheckBox();
+            this.chkSMB1 = new System.Windows.Forms.CheckBox();
+            this.chkSMB2 = new System.Windows.Forms.CheckBox();
+            this.label1 = new System.Windows.Forms.Label();
             this.SuspendLayout();
             // 
             // comboIPAddress
@@ -51,7 +54,7 @@ namespace SMBServer
             // 
             this.rbtNetBiosOverTCP.AutoSize = true;
             this.rbtNetBiosOverTCP.Checked = true;
-            this.rbtNetBiosOverTCP.Location = new System.Drawing.Point(79, 41);
+            this.rbtNetBiosOverTCP.Location = new System.Drawing.Point(79, 38);
             this.rbtNetBiosOverTCP.Name = "rbtNetBiosOverTCP";
             this.rbtNetBiosOverTCP.Size = new System.Drawing.Size(164, 17);
             this.rbtNetBiosOverTCP.TabIndex = 2;
@@ -62,7 +65,7 @@ namespace SMBServer
             // rbtDirectTCPTransport
             // 
             this.rbtDirectTCPTransport.AutoSize = true;
-            this.rbtDirectTCPTransport.Location = new System.Drawing.Point(79, 64);
+            this.rbtDirectTCPTransport.Location = new System.Drawing.Point(79, 61);
             this.rbtDirectTCPTransport.Name = "rbtDirectTCPTransport";
             this.rbtDirectTCPTransport.Size = new System.Drawing.Size(174, 17);
             this.rbtDirectTCPTransport.TabIndex = 3;
@@ -93,7 +96,7 @@ namespace SMBServer
             // lblTransport
             // 
             this.lblTransport.AutoSize = true;
-            this.lblTransport.Location = new System.Drawing.Point(12, 43);
+            this.lblTransport.Location = new System.Drawing.Point(12, 40);
             this.lblTransport.Name = "lblTransport";
             this.lblTransport.Size = new System.Drawing.Size(55, 13);
             this.lblTransport.TabIndex = 14;
@@ -113,18 +116,53 @@ namespace SMBServer
             this.chkIntegratedWindowsAuthentication.AutoSize = true;
             this.chkIntegratedWindowsAuthentication.Checked = true;
             this.chkIntegratedWindowsAuthentication.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.chkIntegratedWindowsAuthentication.Location = new System.Drawing.Point(79, 94);
+            this.chkIntegratedWindowsAuthentication.Location = new System.Drawing.Point(79, 114);
             this.chkIntegratedWindowsAuthentication.Name = "chkIntegratedWindowsAuthentication";
             this.chkIntegratedWindowsAuthentication.Size = new System.Drawing.Size(192, 17);
             this.chkIntegratedWindowsAuthentication.TabIndex = 15;
             this.chkIntegratedWindowsAuthentication.Text = "Integrated Windows Authentication";
             this.chkIntegratedWindowsAuthentication.UseVisualStyleBackColor = true;
             // 
+            // chkSMB1
+            // 
+            this.chkSMB1.AutoSize = true;
+            this.chkSMB1.Checked = true;
+            this.chkSMB1.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.chkSMB1.Location = new System.Drawing.Point(79, 86);
+            this.chkSMB1.Name = "chkSMB1";
+            this.chkSMB1.Size = new System.Drawing.Size(95, 17);
+            this.chkSMB1.TabIndex = 16;
+            this.chkSMB1.Text = "SMB 1.0/CIFS";
+            this.chkSMB1.UseVisualStyleBackColor = true;
+            this.chkSMB1.CheckedChanged += new System.EventHandler(this.chkSMB1_CheckedChanged);
+            // 
+            // chkSMB2
+            // 
+            this.chkSMB2.AutoSize = true;
+            this.chkSMB2.Location = new System.Drawing.Point(204, 86);
+            this.chkSMB2.Name = "chkSMB2";
+            this.chkSMB2.Size = new System.Drawing.Size(93, 17);
+            this.chkSMB2.TabIndex = 17;
+            this.chkSMB2.Text = "SMB 2.0 / 2.1";
+            this.chkSMB2.UseVisualStyleBackColor = true;
+            this.chkSMB2.CheckedChanged += new System.EventHandler(this.chkSMB2_CheckedChanged);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(12, 87);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(49, 13);
+            this.label1.TabIndex = 18;
+            this.label1.Text = "Protocol:";
+            // 
             // ServerUI
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(442, 123);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+            this.ClientSize = new System.Drawing.Size(444, 145);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.chkSMB1);
+            this.Controls.Add(this.chkSMB2);
             this.Controls.Add(this.chkIntegratedWindowsAuthentication);
             this.Controls.Add(this.lblTransport);
             this.Controls.Add(this.lblAddress);
@@ -133,9 +171,10 @@ namespace SMBServer
             this.Controls.Add(this.rbtDirectTCPTransport);
             this.Controls.Add(this.rbtNetBiosOverTCP);
             this.Controls.Add(this.comboIPAddress);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(450, 150);
-            this.MinimumSize = new System.Drawing.Size(450, 150);
+            this.MaximumSize = new System.Drawing.Size(450, 170);
+            this.MinimumSize = new System.Drawing.Size(450, 170);
             this.Name = "ServerUI";
             this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
             this.Text = "SMB Server";
@@ -155,6 +194,9 @@ namespace SMBServer
         private System.Windows.Forms.Label lblTransport;
         private System.Windows.Forms.Label lblAddress;
         private System.Windows.Forms.CheckBox chkIntegratedWindowsAuthentication;
+        private System.Windows.Forms.CheckBox chkSMB1;
+        private System.Windows.Forms.CheckBox chkSMB2;
+        private System.Windows.Forms.Label label1;
     }
 }
 

+ 21 - 1
SMBServer/ServerUI.cs

@@ -89,7 +89,7 @@ namespace SMBServer
                 return;
             }
 
-            m_server = new SMBLibrary.Server.SMBServer(shares, provider, serverAddress, transportType);
+            m_server = new SMBLibrary.Server.SMBServer(shares, provider, serverAddress, transportType, chkSMB1.Checked, chkSMB2.Checked);
             m_server.OnLogEntry += new EventHandler<LogEntry>(Server_OnLogEntry);
 
             try
@@ -112,6 +112,8 @@ namespace SMBServer
             comboIPAddress.Enabled = false;
             rbtDirectTCPTransport.Enabled = false;
             rbtNetBiosOverTCP.Enabled = false;
+            chkSMB1.Enabled = false;
+            chkSMB2.Enabled = false;
             chkIntegratedWindowsAuthentication.Enabled = false;
         }
 
@@ -184,6 +186,8 @@ namespace SMBServer
             comboIPAddress.Enabled = true;
             rbtDirectTCPTransport.Enabled = true;
             rbtNetBiosOverTCP.Enabled = true;
+            chkSMB1.Enabled = true;
+            chkSMB2.Enabled = true;
             chkIntegratedWindowsAuthentication.Enabled = true;
 
             if (m_nameServer != null)
@@ -222,5 +226,21 @@ namespace SMBServer
             string message = String.Format("{0} {1} {2}", entry.Severity.ToString().PadRight(12), timestamp, entry.Message);
             System.Diagnostics.Debug.Print(message);
         }
+
+        private void chkSMB1_CheckedChanged(object sender, EventArgs e)
+        {
+            if (!chkSMB1.Checked)
+            {
+                chkSMB2.Checked = true;
+            }
+        }
+
+        private void chkSMB2_CheckedChanged(object sender, EventArgs e)
+        {
+            if (!chkSMB2.Checked)
+            {
+                chkSMB1.Checked = true;
+            }
+        }
     }
 }