try to fix CUID empty write bug

This commit is contained in:
XAS-712 2019-04-16 21:07:38 +08:00
parent aa4d65a068
commit ccfa0b5456
7 changed files with 81 additions and 28 deletions

View File

@ -92,6 +92,7 @@
this.groupBox8 = new System.Windows.Forms.GroupBox(); this.groupBox8 = new System.Windows.Forms.GroupBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox14 = new System.Windows.Forms.GroupBox(); this.groupBox14 = new System.Windows.Forms.GroupBox();
this.checkBoxMultiDev = new System.Windows.Forms.CheckBox();
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.SetDeviceCombo = new System.Windows.Forms.ComboBox(); this.SetDeviceCombo = new System.Windows.Forms.ComboBox();
this.checkBoxNewScan = new System.Windows.Forms.CheckBox(); this.checkBoxNewScan = new System.Windows.Forms.CheckBox();
@ -114,9 +115,9 @@
this.runTimeLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.runTimeLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.localVersionLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.localVersionLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripCheckUpdate = new System.Windows.Forms.ToolStripSplitButton(); 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.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.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -923,6 +924,17 @@
this.groupBox14.TabStop = false; this.groupBox14.TabStop = false;
this.groupBox14.Text = "优化设置"; 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 // label11
// //
this.label11.AutoSize = true; this.label11.AutoSize = true;
@ -996,11 +1008,11 @@
// groupBox11 // groupBox11
// //
this.groupBox11.Controls.Add(this.checkBoxHardLowCost); 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.Margin = new System.Windows.Forms.Padding(2);
this.groupBox11.Name = "groupBox11"; this.groupBox11.Name = "groupBox11";
this.groupBox11.Padding = new System.Windows.Forms.Padding(2); 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.TabIndex = 14;
this.groupBox11.TabStop = false; this.groupBox11.TabStop = false;
this.groupBox11.Text = "HardNested"; this.groupBox11.Text = "HardNested";
@ -1093,6 +1105,7 @@
// //
// groupBox6 // groupBox6
// //
this.groupBox6.Controls.Add(this.checkBoxCuidKeyOver);
this.groupBox6.Controls.Add(this.checkBoxWriteProtect); this.groupBox6.Controls.Add(this.checkBoxWriteProtect);
this.groupBox6.Controls.Add(this.checkBoxAutoLoadKey); this.groupBox6.Controls.Add(this.checkBoxAutoLoadKey);
this.groupBox6.Controls.Add(this.checkBoxAutoABN); this.groupBox6.Controls.Add(this.checkBoxAutoABN);
@ -1100,7 +1113,7 @@
this.groupBox6.Margin = new System.Windows.Forms.Padding(2); this.groupBox6.Margin = new System.Windows.Forms.Padding(2);
this.groupBox6.Name = "groupBox6"; this.groupBox6.Name = "groupBox6";
this.groupBox6.Padding = new System.Windows.Forms.Padding(2); 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.TabIndex = 0;
this.groupBox6.TabStop = false; this.groupBox6.TabStop = false;
this.groupBox6.Text = "卡操作相关"; this.groupBox6.Text = "卡操作相关";
@ -1110,7 +1123,7 @@
this.checkBoxWriteProtect.AutoSize = true; this.checkBoxWriteProtect.AutoSize = true;
this.checkBoxWriteProtect.Checked = true; this.checkBoxWriteProtect.Checked = true;
this.checkBoxWriteProtect.CheckState = System.Windows.Forms.CheckState.Checked; 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.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxWriteProtect.Name = "checkBoxWriteProtect"; this.checkBoxWriteProtect.Name = "checkBoxWriteProtect";
this.checkBoxWriteProtect.Size = new System.Drawing.Size(132, 16); this.checkBoxWriteProtect.Size = new System.Drawing.Size(132, 16);
@ -1122,7 +1135,7 @@
// checkBoxAutoLoadKey // checkBoxAutoLoadKey
// //
this.checkBoxAutoLoadKey.AutoSize = true; 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.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxAutoLoadKey.Name = "checkBoxAutoLoadKey"; this.checkBoxAutoLoadKey.Name = "checkBoxAutoLoadKey";
this.checkBoxAutoLoadKey.Size = new System.Drawing.Size(138, 16); this.checkBoxAutoLoadKey.Size = new System.Drawing.Size(138, 16);
@ -1136,7 +1149,7 @@
this.checkBoxAutoABN.AutoSize = true; this.checkBoxAutoABN.AutoSize = true;
this.checkBoxAutoABN.Checked = true; this.checkBoxAutoABN.Checked = true;
this.checkBoxAutoABN.CheckState = System.Windows.Forms.CheckState.Checked; 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.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxAutoABN.Name = "checkBoxAutoABN"; this.checkBoxAutoABN.Name = "checkBoxAutoABN";
this.checkBoxAutoABN.Size = new System.Drawing.Size(126, 16); this.checkBoxAutoABN.Size = new System.Drawing.Size(126, 16);
@ -1191,26 +1204,28 @@
this.toolStripCheckUpdate.Text = "检查更新"; this.toolStripCheckUpdate.Text = "检查更新";
this.toolStripCheckUpdate.ButtonClick += new System.EventHandler(this.toolStripCheckUpdate_ButtonClick); this.toolStripCheckUpdate.ButtonClick += new System.EventHandler(this.toolStripCheckUpdate_ButtonClick);
// //
// curDevice
//
this.curDevice.Name = "curDevice";
this.curDevice.Size = new System.Drawing.Size(0, 21);
//
// timer1 // timer1
// //
this.timer1.Enabled = true; this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// checkBoxMultiDev // checkBoxCuidKeyOver
// //
this.checkBoxMultiDev.AutoSize = true; this.checkBoxCuidKeyOver.AutoSize = true;
this.checkBoxMultiDev.Location = new System.Drawing.Point(4, 84); this.checkBoxCuidKeyOver.Checked = true;
this.checkBoxMultiDev.Name = "checkBoxMultiDev"; this.checkBoxCuidKeyOver.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxMultiDev.Size = new System.Drawing.Size(108, 40); this.checkBoxCuidKeyOver.Location = new System.Drawing.Point(4, 72);
this.checkBoxMultiDev.TabIndex = 4; this.checkBoxCuidKeyOver.Name = "checkBoxCuidKeyOver";
this.checkBoxMultiDev.Text = "多实例运行模式\r\n会禁用多开检测\r\n请自行指定设备"; this.checkBoxCuidKeyOver.Size = new System.Drawing.Size(108, 16);
this.checkBoxMultiDev.UseVisualStyleBackColor = true; this.checkBoxCuidKeyOver.TabIndex = 13;
this.checkBoxMultiDev.CheckedChanged += new System.EventHandler(this.checkBoxMultiDev_CheckedChanged); this.checkBoxCuidKeyOver.Text = "CUID写空卡补丁";
// this.checkBoxCuidKeyOver.UseVisualStyleBackColor = true;
// curDevice this.checkBoxCuidKeyOver.CheckedChanged += new System.EventHandler(this.checkBoxCuidKeyOver_CheckedChanged);
//
this.curDevice.Name = "curDevice";
this.curDevice.Size = new System.Drawing.Size(0, 21);
// //
// Form1 // Form1
// //
@ -1350,6 +1365,7 @@
private System.Windows.Forms.ComboBox SetDeviceCombo; private System.Windows.Forms.ComboBox SetDeviceCombo;
private System.Windows.Forms.CheckBox checkBoxMultiDev; private System.Windows.Forms.CheckBox checkBoxMultiDev;
private System.Windows.Forms.ToolStripStatusLabel curDevice; private System.Windows.Forms.ToolStripStatusLabel curDevice;
private System.Windows.Forms.CheckBox checkBoxCuidKeyOver;
} }
} }

View File

@ -207,6 +207,7 @@ namespace MifareOneTool
checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv; checkBoxDefIsAdv.Checked = Properties.Settings.Default.DefIsAdv;
checkBoxHardLowCost.Checked = Properties.Settings.Default.HardLowCost; checkBoxHardLowCost.Checked = Properties.Settings.Default.HardLowCost;
checkBoxNewScan.Checked = Properties.Settings.Default.NewScan; checkBoxNewScan.Checked = Properties.Settings.Default.NewScan;
checkBoxCuidKeyOver.Checked = Properties.Settings.Default.CuidKeyOver;
if (Properties.Settings.Default.DefIsAdv) if (Properties.Settings.Default.DefIsAdv)
{ {
tabControl1.SelectedIndex = 1; tabControl1.SelectedIndex = 1;
@ -838,6 +839,8 @@ namespace MifareOneTool
b.ReportProgress(100, "##运行完毕##"); b.ReportProgress(100, "##运行完毕##");
} }
bool cuidKeyOver = false;
private void buttonCmfWrite_Click(object sender, EventArgs e) private void buttonCmfWrite_Click(object sender, EventArgs e)
{ {
if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中"; if (lprocess) { MessageBox.Show("有任务运行中,不可执行。", "设备忙", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Form1.ActiveForm.Text = "MifareOne Tool - 运行中";
@ -856,6 +859,14 @@ namespace MifareOneTool
return; return;
} }
if (!writecheck(rmfd)) { MessageBox.Show("将要写入的文件存在错误请用高级模式中的Hex工具打开查看。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); 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 kt = "A";
string nn = ""; string nn = "";
if (checkBoxAutoABN.Checked && keymfd != "") if (checkBoxAutoABN.Checked && keymfd != "")
@ -907,6 +918,12 @@ namespace MifareOneTool
process.BeginErrorReadLine(); process.BeginErrorReadLine();
process.WaitForExit(); process.WaitForExit();
lprocess = false; running = false; lprocess = false; running = false;
if (cuidKeyOver == true)
{
keymfd = "";
cuidKeyOver = false;
File.Delete("cuid_empty.kmf");
}
b.ReportProgress(100, "##运行完毕##"); b.ReportProgress(100, "##运行完毕##");
} }
@ -1472,5 +1489,10 @@ namespace MifareOneTool
{ {
Properties.Settings.Default.MultiMode = checkBoxMultiDev.Checked; Properties.Settings.Default.MultiMode = checkBoxMultiDev.Checked;
} }
private void checkBoxCuidKeyOver_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.CuidKeyOver = checkBoxCuidKeyOver.Checked;
}
} }
} }

View File

@ -120,9 +120,6 @@
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="toolTipHelp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>157, 17</value> <value>157, 17</value>
</metadata> </metadata>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("XciCode")] [assembly: AssemblyCompany("XciCode")]
[assembly: AssemblyProduct("MifareOneTool")] [assembly: AssemblyProduct("MifareOneTool")]
[assembly: AssemblyCopyright("Copyright © XciCode 2018")] [assembly: AssemblyCopyright("Copyright © XciCode 2018-2019")]
[assembly: AssemblyTrademark("M1T")] [assembly: AssemblyTrademark("M1T")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.6.0")] [assembly: AssemblyVersion("1.6.7.0")]
[assembly: AssemblyFileVersion("1.6.6.0")] [assembly: AssemblyFileVersion("1.6.7.0")]

View File

@ -163,5 +163,17 @@ namespace MifareOneTool.Properties {
this["MultiMode"] = value; 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;
}
}
} }
} }

View File

@ -38,5 +38,8 @@
<Setting Name="MultiMode" Type="System.Boolean" Scope="User"> <Setting Name="MultiMode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="CuidKeyOver" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -50,6 +50,9 @@
<setting name="MultiMode" serializeAs="String"> <setting name="MultiMode" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="CuidKeyOver" serializeAs="String">
<value>True</value>
</setting>
</MifareOneTool.Properties.Settings> </MifareOneTool.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>