From ccfa0b5456a1b4d193f8c2a1538aed5acf5b7d4f Mon Sep 17 00:00:00 2001 From: XAS-712 Date: Tue, 16 Apr 2019 21:07:38 +0800 Subject: [PATCH] try to fix CUID empty write bug --- MifareOneTool/Form1.Designer.cs | 60 ++++++++++++------- MifareOneTool/Form1.cs | 22 +++++++ MifareOneTool/Form1.resx | 3 - MifareOneTool/Properties/AssemblyInfo.cs | 6 +- MifareOneTool/Properties/Settings.Designer.cs | 12 ++++ MifareOneTool/Properties/Settings.settings | 3 + MifareOneTool/app.config | 3 + 7 files changed, 81 insertions(+), 28 deletions(-) diff --git a/MifareOneTool/Form1.Designer.cs b/MifareOneTool/Form1.Designer.cs index f230b41..1fe8cd7 100644 --- a/MifareOneTool/Form1.Designer.cs +++ b/MifareOneTool/Form1.Designer.cs @@ -92,6 +92,7 @@ this.groupBox8 = new System.Windows.Forms.GroupBox(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.groupBox14 = new System.Windows.Forms.GroupBox(); + this.checkBoxMultiDev = new System.Windows.Forms.CheckBox(); this.label11 = new System.Windows.Forms.Label(); this.SetDeviceCombo = new System.Windows.Forms.ComboBox(); this.checkBoxNewScan = new System.Windows.Forms.CheckBox(); @@ -114,9 +115,9 @@ this.runTimeLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.localVersionLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.checkBoxMultiDev = new System.Windows.Forms.CheckBox(); this.curDevice = new System.Windows.Forms.ToolStripStatusLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.checkBoxCuidKeyOver = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -923,6 +924,17 @@ this.groupBox14.TabStop = false; this.groupBox14.Text = "优化设置"; // + // checkBoxMultiDev + // + this.checkBoxMultiDev.AutoSize = true; + this.checkBoxMultiDev.Location = new System.Drawing.Point(4, 84); + this.checkBoxMultiDev.Name = "checkBoxMultiDev"; + this.checkBoxMultiDev.Size = new System.Drawing.Size(108, 40); + this.checkBoxMultiDev.TabIndex = 4; + this.checkBoxMultiDev.Text = "多实例运行模式\r\n会禁用多开检测\r\n请自行指定设备"; + this.checkBoxMultiDev.UseVisualStyleBackColor = true; + this.checkBoxMultiDev.CheckedChanged += new System.EventHandler(this.checkBoxMultiDev_CheckedChanged); + // // label11 // this.label11.AutoSize = true; @@ -996,11 +1008,11 @@ // groupBox11 // this.groupBox11.Controls.Add(this.checkBoxHardLowCost); - this.groupBox11.Location = new System.Drawing.Point(2, 86); + this.groupBox11.Location = new System.Drawing.Point(2, 99); this.groupBox11.Margin = new System.Windows.Forms.Padding(2); this.groupBox11.Name = "groupBox11"; this.groupBox11.Padding = new System.Windows.Forms.Padding(2); - this.groupBox11.Size = new System.Drawing.Size(150, 56); + this.groupBox11.Size = new System.Drawing.Size(150, 43); this.groupBox11.TabIndex = 14; this.groupBox11.TabStop = false; this.groupBox11.Text = "HardNested"; @@ -1093,6 +1105,7 @@ // // groupBox6 // + this.groupBox6.Controls.Add(this.checkBoxCuidKeyOver); this.groupBox6.Controls.Add(this.checkBoxWriteProtect); this.groupBox6.Controls.Add(this.checkBoxAutoLoadKey); this.groupBox6.Controls.Add(this.checkBoxAutoABN); @@ -1100,7 +1113,7 @@ this.groupBox6.Margin = new System.Windows.Forms.Padding(2); this.groupBox6.Name = "groupBox6"; this.groupBox6.Padding = new System.Windows.Forms.Padding(2); - this.groupBox6.Size = new System.Drawing.Size(150, 80); + this.groupBox6.Size = new System.Drawing.Size(150, 93); this.groupBox6.TabIndex = 0; this.groupBox6.TabStop = false; this.groupBox6.Text = "卡操作相关"; @@ -1110,7 +1123,7 @@ this.checkBoxWriteProtect.AutoSize = true; this.checkBoxWriteProtect.Checked = true; this.checkBoxWriteProtect.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxWriteProtect.Location = new System.Drawing.Point(4, 59); + this.checkBoxWriteProtect.Location = new System.Drawing.Point(4, 53); this.checkBoxWriteProtect.Margin = new System.Windows.Forms.Padding(2); this.checkBoxWriteProtect.Name = "checkBoxWriteProtect"; this.checkBoxWriteProtect.Size = new System.Drawing.Size(132, 16); @@ -1122,7 +1135,7 @@ // checkBoxAutoLoadKey // this.checkBoxAutoLoadKey.AutoSize = true; - this.checkBoxAutoLoadKey.Location = new System.Drawing.Point(4, 39); + this.checkBoxAutoLoadKey.Location = new System.Drawing.Point(4, 33); this.checkBoxAutoLoadKey.Margin = new System.Windows.Forms.Padding(2); this.checkBoxAutoLoadKey.Name = "checkBoxAutoLoadKey"; this.checkBoxAutoLoadKey.Size = new System.Drawing.Size(138, 16); @@ -1136,7 +1149,7 @@ this.checkBoxAutoABN.AutoSize = true; this.checkBoxAutoABN.Checked = true; this.checkBoxAutoABN.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxAutoABN.Location = new System.Drawing.Point(4, 19); + this.checkBoxAutoABN.Location = new System.Drawing.Point(4, 13); this.checkBoxAutoABN.Margin = new System.Windows.Forms.Padding(2); this.checkBoxAutoABN.Name = "checkBoxAutoABN"; this.checkBoxAutoABN.Size = new System.Drawing.Size(126, 16); @@ -1191,26 +1204,28 @@ this.toolStripCheckUpdate.Text = "检查更新"; this.toolStripCheckUpdate.ButtonClick += new System.EventHandler(this.toolStripCheckUpdate_ButtonClick); // + // curDevice + // + this.curDevice.Name = "curDevice"; + this.curDevice.Size = new System.Drawing.Size(0, 21); + // // timer1 // this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // checkBoxMultiDev + // checkBoxCuidKeyOver // - this.checkBoxMultiDev.AutoSize = true; - this.checkBoxMultiDev.Location = new System.Drawing.Point(4, 84); - this.checkBoxMultiDev.Name = "checkBoxMultiDev"; - this.checkBoxMultiDev.Size = new System.Drawing.Size(108, 40); - this.checkBoxMultiDev.TabIndex = 4; - this.checkBoxMultiDev.Text = "多实例运行模式\r\n会禁用多开检测\r\n请自行指定设备"; - this.checkBoxMultiDev.UseVisualStyleBackColor = true; - this.checkBoxMultiDev.CheckedChanged += new System.EventHandler(this.checkBoxMultiDev_CheckedChanged); - // - // curDevice - // - this.curDevice.Name = "curDevice"; - this.curDevice.Size = new System.Drawing.Size(0, 21); + this.checkBoxCuidKeyOver.AutoSize = true; + this.checkBoxCuidKeyOver.Checked = true; + this.checkBoxCuidKeyOver.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxCuidKeyOver.Location = new System.Drawing.Point(4, 72); + this.checkBoxCuidKeyOver.Name = "checkBoxCuidKeyOver"; + this.checkBoxCuidKeyOver.Size = new System.Drawing.Size(108, 16); + this.checkBoxCuidKeyOver.TabIndex = 13; + this.checkBoxCuidKeyOver.Text = "CUID写空卡补丁"; + this.checkBoxCuidKeyOver.UseVisualStyleBackColor = true; + this.checkBoxCuidKeyOver.CheckedChanged += new System.EventHandler(this.checkBoxCuidKeyOver_CheckedChanged); // // Form1 // @@ -1350,6 +1365,7 @@ private System.Windows.Forms.ComboBox SetDeviceCombo; private System.Windows.Forms.CheckBox checkBoxMultiDev; private System.Windows.Forms.ToolStripStatusLabel curDevice; + private System.Windows.Forms.CheckBox checkBoxCuidKeyOver; } } diff --git a/MifareOneTool/Form1.cs b/MifareOneTool/Form1.cs index 04579d5..e7f38cb 100644 --- a/MifareOneTool/Form1.cs +++ b/MifareOneTool/Form1.cs @@ -207,6 +207,7 @@ namespace MifareOneTool checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv; checkBoxHardLowCost.Checked = Properties.Settings.Default.HardLowCost; checkBoxNewScan.Checked = Properties.Settings.Default.NewScan; + checkBoxCuidKeyOver.Checked = Properties.Settings.Default.CuidKeyOver; if (Properties.Settings.Default.DefIsAdv) { tabControl1.SelectedIndex = 1; @@ -838,6 +839,8 @@ namespace MifareOneTool b.ReportProgress(100, "##运行完毕##"); } + bool cuidKeyOver = false; + private void buttonCmfWrite_Click(object sender, EventArgs e) { if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; @@ -856,6 +859,14 @@ namespace MifareOneTool return; } if (!writecheck(rmfd)) { MessageBox.Show("将要写入的文件存在错误,请用高级模式中的Hex工具打开查看。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + if (keymfd == "" && Properties.Settings.Default.CuidKeyOver) + { + cuidKeyOver = true; + S50 empty = new S50(); + empty.ExportToMfd("cuid_empty.kmf"); + keymfd = "cuid_empty.kmf"; + logAppend("已启用CUID空卡写入补丁"); + } string kt = "A"; string nn = ""; if (checkBoxAutoABN.Checked && keymfd != "") @@ -907,6 +918,12 @@ namespace MifareOneTool process.BeginErrorReadLine(); process.WaitForExit(); lprocess = false; running = false; + if (cuidKeyOver == true) + { + keymfd = ""; + cuidKeyOver = false; + File.Delete("cuid_empty.kmf"); + } b.ReportProgress(100, "##运行完毕##"); } @@ -1472,5 +1489,10 @@ namespace MifareOneTool { Properties.Settings.Default.MultiMode = checkBoxMultiDev.Checked; } + + private void checkBoxCuidKeyOver_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.CuidKeyOver = checkBoxCuidKeyOver.Checked; + } } } diff --git a/MifareOneTool/Form1.resx b/MifareOneTool/Form1.resx index 245e50e..85a464d 100644 --- a/MifareOneTool/Form1.resx +++ b/MifareOneTool/Form1.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - 157, 17 diff --git a/MifareOneTool/Properties/AssemblyInfo.cs b/MifareOneTool/Properties/AssemblyInfo.cs index 1c68d1d..5a111ea 100644 --- a/MifareOneTool/Properties/AssemblyInfo.cs +++ b/MifareOneTool/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("XciCode")] [assembly: AssemblyProduct("MifareOneTool")] -[assembly: AssemblyCopyright("Copyright © XciCode 2018")] +[assembly: AssemblyCopyright("Copyright © XciCode 2018-2019")] [assembly: AssemblyTrademark("M1T")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.6.0")] -[assembly: AssemblyFileVersion("1.6.6.0")] +[assembly: AssemblyVersion("1.6.7.0")] +[assembly: AssemblyFileVersion("1.6.7.0")] diff --git a/MifareOneTool/Properties/Settings.Designer.cs b/MifareOneTool/Properties/Settings.Designer.cs index 73004e2..456fa7a 100644 --- a/MifareOneTool/Properties/Settings.Designer.cs +++ b/MifareOneTool/Properties/Settings.Designer.cs @@ -163,5 +163,17 @@ namespace MifareOneTool.Properties { this["MultiMode"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool CuidKeyOver { + get { + return ((bool)(this["CuidKeyOver"])); + } + set { + this["CuidKeyOver"] = value; + } + } } } diff --git a/MifareOneTool/Properties/Settings.settings b/MifareOneTool/Properties/Settings.settings index 2bc055d..0cc95ec 100644 --- a/MifareOneTool/Properties/Settings.settings +++ b/MifareOneTool/Properties/Settings.settings @@ -38,5 +38,8 @@ False + + True + \ No newline at end of file diff --git a/MifareOneTool/app.config b/MifareOneTool/app.config index 1db23f3..b8bed09 100644 --- a/MifareOneTool/app.config +++ b/MifareOneTool/app.config @@ -50,6 +50,9 @@ False + + True + \ No newline at end of file