diff --git a/Win_1337_Patch/1337.cs b/Win_1337_Patch/1337.cs index e84405e..86a762d 100644 --- a/Win_1337_Patch/1337.cs +++ b/Win_1337_Patch/1337.cs @@ -179,6 +179,7 @@ namespace Win_1337_Patch } byte[] bexe = File.ReadAllBytes(exe); bool ok = true; + bool alreadyApplied = false; for (var i = 1; i < lines.Length; i += 1) { if (lines[i].Trim() != "") @@ -190,6 +191,12 @@ namespace Win_1337_Patch byte f = byte.Parse(tmp2[0], System.Globalization.NumberStyles.HexNumber); if (bexe[offsetHex] == byte.Parse(tmp2[0], System.Globalization.NumberStyles.HexNumber)) bexe[offsetHex] = byte.Parse(tmp2[1], System.Globalization.NumberStyles.HexNumber); + else if (bexe[offsetHex] == byte.Parse(tmp2[1], System.Globalization.NumberStyles.HexNumber)) + { + alreadyApplied = true; + ok = false; + break; + } else { MessageBox.Show("Offset [" + offsetHex.ToString("X") + "] Wrong...\n\nSet 0x" + bexe[offsetHex].ToString("X") + " -> I expected 0x" + byte.Parse(tmp2[0], System.Globalization.NumberStyles.HexNumber).ToString("X"), "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -215,6 +222,10 @@ namespace Win_1337_Patch SistemaPeCks(exe); MessageBox.Show("File " + Path.GetFileName(exe) + " Patched...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Information); } + else if (alreadyApplied) + { + MessageBox.Show("The patch has already been applied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void SistemaPeCks(string file) diff --git a/Win_1337_Patch/mCheckSum.cs b/Win_1337_Patch/mCheckSum.cs index 962b532..00b7318 100644 --- a/Win_1337_Patch/mCheckSum.cs +++ b/Win_1337_Patch/mCheckSum.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using System.Windows.Forms; namespace Win_1337_Patch { @@ -67,7 +68,8 @@ namespace Win_1337_Patch { Pein = uOriginal.ToString("X8"); Pefi = uRecalculated.ToString("X8"); - return true; + MessageBox.Show("The patch has already been applied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return true; // Indicate the patch was already applied } } else