mirror of
https://github.com/Deltafox79/Win_1337_Apply_Patch
synced 2025-07-06 04:51:51 -07:00
v1.3 Release
Code optimization..
This commit is contained in:
parent
1efd94b16b
commit
0759d094bc
15 changed files with 3083 additions and 0 deletions
25
Win_1337_Patch.sln
Normal file
25
Win_1337_Patch.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2046
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_1337_Patch", "Win_1337_Patch\Win_1337_Patch.csproj", "{97153568-54C0-4295-9ABD-20358B78A5BB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{97153568-54C0-4295-9ABD-20358B78A5BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{97153568-54C0-4295-9ABD-20358B78A5BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{97153568-54C0-4295-9ABD-20358B78A5BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{97153568-54C0-4295-9ABD-20358B78A5BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C5685316-F6A2-4185-B130-85BCDCDB7F93}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
235
Win_1337_Patch/1337.Designer.cs
generated
Normal file
235
Win_1337_Patch/1337.Designer.cs
generated
Normal file
|
@ -0,0 +1,235 @@
|
|||
namespace Win_1337_Patch
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.btnSelectExe = new System.Windows.Forms.Button();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.t1337 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.texe = new System.Windows.Forms.TextBox();
|
||||
this.btnSelect1337 = new System.Windows.Forms.Button();
|
||||
this.linkdfox = new System.Windows.Forms.LinkLabel();
|
||||
this.Patch = new System.Windows.Forms.Button();
|
||||
this.cfixoff = new System.Windows.Forms.Button();
|
||||
this.controlloBackup = new System.Windows.Forms.CheckBox();
|
||||
this.cfileoffsett = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnSelectExe
|
||||
//
|
||||
this.btnSelectExe.CausesValidation = false;
|
||||
this.btnSelectExe.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
|
||||
this.btnSelectExe.Location = new System.Drawing.Point(397, 4);
|
||||
this.btnSelectExe.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnSelectExe.Name = "btnSelectExe";
|
||||
this.btnSelectExe.Size = new System.Drawing.Size(24, 23);
|
||||
this.btnSelectExe.TabIndex = 18;
|
||||
this.btnSelectExe.Text = "...";
|
||||
this.btnSelectExe.UseVisualStyleBackColor = true;
|
||||
this.btnSelectExe.Click += new System.EventHandler(this.btnSelectExe_Click);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label7.ForeColor = System.Drawing.Color.DarkGreen;
|
||||
this.label7.Location = new System.Drawing.Point(12, 35);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(67, 13);
|
||||
this.label7.TabIndex = 17;
|
||||
this.label7.Text = "1337 File :";
|
||||
//
|
||||
// t1337
|
||||
//
|
||||
this.t1337.AllowDrop = true;
|
||||
this.t1337.BackColor = System.Drawing.SystemColors.Info;
|
||||
this.t1337.ForeColor = System.Drawing.Color.DarkRed;
|
||||
this.t1337.Location = new System.Drawing.Point(85, 32);
|
||||
this.t1337.Name = "t1337";
|
||||
this.t1337.ReadOnly = true;
|
||||
this.t1337.Size = new System.Drawing.Size(309, 20);
|
||||
this.t1337.TabIndex = 16;
|
||||
this.t1337.Text = "Select .1337 File...";
|
||||
this.t1337.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.t1337.DragDrop += new System.Windows.Forms.DragEventHandler(this.t1337_DragDrop);
|
||||
this.t1337.DragEnter += new System.Windows.Forms.DragEventHandler(this.t1337_DragEnter);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label6.ForeColor = System.Drawing.Color.DarkGreen;
|
||||
this.label6.Location = new System.Drawing.Point(12, 9);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(60, 13);
|
||||
this.label6.TabIndex = 15;
|
||||
this.label6.Text = "Exe File :";
|
||||
//
|
||||
// texe
|
||||
//
|
||||
this.texe.AllowDrop = true;
|
||||
this.texe.BackColor = System.Drawing.SystemColors.Info;
|
||||
this.texe.ForeColor = System.Drawing.Color.DarkRed;
|
||||
this.texe.Location = new System.Drawing.Point(85, 6);
|
||||
this.texe.Name = "texe";
|
||||
this.texe.ReadOnly = true;
|
||||
this.texe.Size = new System.Drawing.Size(309, 20);
|
||||
this.texe.TabIndex = 14;
|
||||
this.texe.Text = "Select Exe to Patch...";
|
||||
this.texe.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.texe.DragDrop += new System.Windows.Forms.DragEventHandler(this.texe_DragDrop);
|
||||
this.texe.DragEnter += new System.Windows.Forms.DragEventHandler(this.texe_DragEnter);
|
||||
//
|
||||
// btnSelect1337
|
||||
//
|
||||
this.btnSelect1337.CausesValidation = false;
|
||||
this.btnSelect1337.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
|
||||
this.btnSelect1337.Location = new System.Drawing.Point(397, 30);
|
||||
this.btnSelect1337.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnSelect1337.Name = "btnSelect1337";
|
||||
this.btnSelect1337.Size = new System.Drawing.Size(24, 23);
|
||||
this.btnSelect1337.TabIndex = 19;
|
||||
this.btnSelect1337.Text = "...";
|
||||
this.btnSelect1337.UseVisualStyleBackColor = true;
|
||||
this.btnSelect1337.Click += new System.EventHandler(this.btnSelect1337_Click);
|
||||
//
|
||||
// linkdfox
|
||||
//
|
||||
this.linkdfox.AutoSize = true;
|
||||
this.linkdfox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.linkdfox.ForeColor = System.Drawing.Color.BlueViolet;
|
||||
this.linkdfox.LinkColor = System.Drawing.Color.Indigo;
|
||||
this.linkdfox.Location = new System.Drawing.Point(250, 62);
|
||||
this.linkdfox.Name = "linkdfox";
|
||||
this.linkdfox.Size = new System.Drawing.Size(77, 13);
|
||||
this.linkdfox.TabIndex = 73;
|
||||
this.linkdfox.TabStop = true;
|
||||
this.linkdfox.Text = "By DeltaFoX";
|
||||
//
|
||||
// Patch
|
||||
//
|
||||
this.Patch.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Patch.ForeColor = System.Drawing.Color.DarkBlue;
|
||||
this.Patch.Location = new System.Drawing.Point(333, 57);
|
||||
this.Patch.Name = "Patch";
|
||||
this.Patch.Size = new System.Drawing.Size(88, 23);
|
||||
this.Patch.TabIndex = 74;
|
||||
this.Patch.Text = "Patch";
|
||||
this.Patch.UseVisualStyleBackColor = true;
|
||||
this.Patch.Click += new System.EventHandler(this.Patch_Click);
|
||||
//
|
||||
// cfixoff
|
||||
//
|
||||
this.cfixoff.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cfixoff.ForeColor = System.Drawing.Color.Crimson;
|
||||
this.cfixoff.Location = new System.Drawing.Point(156, 57);
|
||||
this.cfixoff.Name = "cfixoff";
|
||||
this.cfixoff.Size = new System.Drawing.Size(88, 23);
|
||||
this.cfixoff.TabIndex = 75;
|
||||
this.cfixoff.Text = "Exit";
|
||||
this.cfixoff.UseVisualStyleBackColor = true;
|
||||
this.cfixoff.Click += new System.EventHandler(this.Esci_Click);
|
||||
//
|
||||
// controlloBackup
|
||||
//
|
||||
this.controlloBackup.AutoSize = true;
|
||||
this.controlloBackup.Checked = true;
|
||||
this.controlloBackup.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.controlloBackup.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.controlloBackup.ForeColor = System.Drawing.Color.Teal;
|
||||
this.controlloBackup.Location = new System.Drawing.Point(15, 61);
|
||||
this.controlloBackup.Name = "controlloBackup";
|
||||
this.controlloBackup.Size = new System.Drawing.Size(63, 17);
|
||||
this.controlloBackup.TabIndex = 76;
|
||||
this.controlloBackup.Text = "Backup";
|
||||
this.controlloBackup.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cfileoffsett
|
||||
//
|
||||
this.cfileoffsett.AutoSize = true;
|
||||
this.cfileoffsett.Checked = true;
|
||||
this.cfileoffsett.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cfileoffsett.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.cfileoffsett.ForeColor = System.Drawing.Color.Teal;
|
||||
this.cfileoffsett.Location = new System.Drawing.Point(80, 61);
|
||||
this.cfileoffsett.Name = "cfileoffsett";
|
||||
this.cfileoffsett.Size = new System.Drawing.Size(70, 17);
|
||||
this.cfileoffsett.TabIndex = 77;
|
||||
this.cfileoffsett.Text = "Fix Offset";
|
||||
this.cfileoffsett.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(432, 83);
|
||||
this.Controls.Add(this.cfileoffsett);
|
||||
this.Controls.Add(this.controlloBackup);
|
||||
this.Controls.Add(this.cfixoff);
|
||||
this.Controls.Add(this.Patch);
|
||||
this.Controls.Add(this.linkdfox);
|
||||
this.Controls.Add(this.btnSelect1337);
|
||||
this.Controls.Add(this.btnSelectExe);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.t1337);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.texe);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(448, 122);
|
||||
this.MinimumSize = new System.Drawing.Size(448, 122);
|
||||
this.Name = "Form1";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Win 1337 Apply Patch File v1.3...";
|
||||
this.Load += new System.EventHandler(this.DFoX_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnSelectExe;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox t1337;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox texe;
|
||||
private System.Windows.Forms.Button btnSelect1337;
|
||||
private System.Windows.Forms.LinkLabel linkdfox;
|
||||
private System.Windows.Forms.Button Patch;
|
||||
private System.Windows.Forms.Button cfixoff;
|
||||
private System.Windows.Forms.CheckBox controlloBackup;
|
||||
private System.Windows.Forms.CheckBox cfileoffsett;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
206
Win_1337_Patch/1337.cs
Normal file
206
Win_1337_Patch/1337.cs
Normal file
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Win_1337_Patch
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public string exe = String.Empty;
|
||||
public string f1337 = String.Empty;
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("Imagehlp.dll")]
|
||||
private static extern bool ImageRemoveCertificate(IntPtr handle, int index);
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnSelectExe_Click(object sender, EventArgs e)
|
||||
{
|
||||
string urlexe = Properties.Settings.Default["urlexe"].ToString();
|
||||
OpenFileDialog apriDialogoFile1 = new OpenFileDialog();
|
||||
apriDialogoFile1.Filter = "File Exe|*.exe|File Dll|*.dll|All File|*.*";
|
||||
apriDialogoFile1.FilterIndex = 0;
|
||||
apriDialogoFile1.Title = "Select the file Exe/Dll File...";
|
||||
apriDialogoFile1.InitialDirectory = urlexe != "" ? urlexe : Directory.GetCurrentDirectory() + "\\";
|
||||
apriDialogoFile1.RestoreDirectory = true;
|
||||
if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
exe = apriDialogoFile1.FileName;
|
||||
texe.Text = Ellipsis.Compact(exe, texe, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(texe, exe);
|
||||
Properties.Settings.Default["urlexe"] = exe;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelect1337_Click(object sender, EventArgs e)
|
||||
{
|
||||
string url1337 = Properties.Settings.Default["url1337"].ToString();
|
||||
OpenFileDialog apriDialogoFile1 = new OpenFileDialog();
|
||||
apriDialogoFile1.Filter = "File 1337|*.*";
|
||||
apriDialogoFile1.FilterIndex = 0;
|
||||
apriDialogoFile1.Title = "Select the file 1337 File...";
|
||||
apriDialogoFile1.InitialDirectory = url1337 != "" ? url1337 : Directory.GetCurrentDirectory() + "\\";
|
||||
apriDialogoFile1.RestoreDirectory = true;
|
||||
if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
f1337 = apriDialogoFile1.FileName;
|
||||
t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(t1337, f1337);
|
||||
Properties.Settings.Default["url1337"] = f1337;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
private void texe_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
private void texe_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
exe = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
|
||||
texe.Text = Ellipsis.Compact(exe, texe, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(texe, exe);
|
||||
Properties.Settings.Default["urlexe"] = exe;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
}
|
||||
|
||||
private void t1337_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
private void t1337_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
f1337 = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
|
||||
t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(t1337, f1337);
|
||||
Properties.Settings.Default["url1337"] = f1337;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
private void Esci_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void Patch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (exe == String.Empty || f1337 == String.Empty)
|
||||
{
|
||||
MessageBox.Show("Select a " + ((exe == String.Empty) ? "Exe" : "1337") + " File...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
DFoX_Patch();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
MessageBox.Show("Sorry !!!\nYou Run the Program as Administrator...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Problems on Patch...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void DFoX_Patch()
|
||||
{
|
||||
if (!File.Exists(exe) || !File.Exists(f1337))
|
||||
{
|
||||
MessageBox.Show("Files are no Longer Present...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
string[] lines = File.ReadAllLines(f1337);
|
||||
if (lines[0].Substring(0,1) != ">")
|
||||
{
|
||||
MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (lines[0].Substring(1).ToLower() != Path.GetFileName(exe).ToLower())
|
||||
{
|
||||
MessageBox.Show("File 1337 is not valid for selected exe...\n\n(\"" + lines[0].Substring(1).ToLower() + "\" vs \"" + Path.GetFileName(exe).ToLower() + "\")", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
byte[] bexe = File.ReadAllBytes(exe);
|
||||
bool ok = true;
|
||||
for (var i = 1; i < lines.Length; i += 1)
|
||||
{
|
||||
if (lines[i].Trim() != "")
|
||||
{
|
||||
string[] tmp = lines[i].Split(':');
|
||||
int offsetHex = int.Parse(tmp[0], System.Globalization.NumberStyles.HexNumber) - (cfileoffsett.Checked ? 0xC00 : 0);
|
||||
string[] tmp2 = tmp[1].Replace("->", ":").Split(':');
|
||||
byte e = bexe[offsetHex];
|
||||
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
|
||||
{
|
||||
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);
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
if (controlloBackup.Checked == true)
|
||||
{
|
||||
if (File.Exists(exe + ".BAK"))
|
||||
File.Delete(exe + ".BAK");
|
||||
File.Copy(exe, exe + ".BAK");
|
||||
}
|
||||
if (File.Exists(exe))
|
||||
File.Delete(exe);
|
||||
File.WriteAllBytes(exe, bexe);
|
||||
SistemaPeCks(exe);
|
||||
MessageBox.Show("File " + Path.GetFileName(exe) + " Patched...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
return;
|
||||
}
|
||||
private void SistemaPeCks(string file)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.ReadWrite))
|
||||
{
|
||||
ImageRemoveCertificate(fs.SafeFileHandle.DangerousGetHandle(), 0);
|
||||
fs.Close();
|
||||
}
|
||||
mCheckSum PE = new mCheckSum();
|
||||
PE.FixCheckSum(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Nothing
|
||||
}
|
||||
return;
|
||||
}
|
||||
private void DFoX_Load(object sender, EventArgs e)
|
||||
{
|
||||
string urlexe = Properties.Settings.Default["urlexe"].ToString().Trim();
|
||||
string url1337 = Properties.Settings.Default["url1337"].ToString().Trim();
|
||||
if (urlexe != "")
|
||||
{
|
||||
texe.Text = Ellipsis.Compact(urlexe, texe, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(texe, urlexe);
|
||||
exe = urlexe;
|
||||
}
|
||||
else
|
||||
texe.Text = "Select Exe to Patch...";
|
||||
if (url1337 != "")
|
||||
{
|
||||
t1337.Text = Ellipsis.Compact(url1337, t1337, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(t1337, url1337);
|
||||
f1337 = url1337;
|
||||
}
|
||||
else
|
||||
t1337.Text = "Select .1337 File...";
|
||||
}
|
||||
}
|
||||
}
|
1841
Win_1337_Patch/1337.resx
Normal file
1841
Win_1337_Patch/1337.resx
Normal file
File diff suppressed because it is too large
Load diff
173
Win_1337_Patch/Ellipsis.cs
Normal file
173
Win_1337_Patch/Ellipsis.cs
Normal file
|
@ -0,0 +1,173 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Win_1337_Patch
|
||||
{
|
||||
/*http://www.codeproject.com/Articles/37503/Auto-Ellipsis*/
|
||||
/// <summary>
|
||||
/// Specifies ellipsis format and alignment.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum EllipsisFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Text is not modified.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Text is trimmed at the end of the string. An ellipsis (...) is drawn in place of remaining text.
|
||||
/// </summary>
|
||||
End = 1,
|
||||
/// <summary>
|
||||
/// Text is trimmed at the begining of the string. An ellipsis (...) is drawn in place of remaining text.
|
||||
/// </summary>
|
||||
Start = 2,
|
||||
/// <summary>
|
||||
/// Text is trimmed in the middle of the string. An ellipsis (...) is drawn in place of remaining text.
|
||||
/// </summary>
|
||||
Middle = 3,
|
||||
/// <summary>
|
||||
/// Preserve as much as possible of the drive and filename information. Must be combined with alignment information.
|
||||
/// </summary>
|
||||
Path = 4,
|
||||
/// <summary>
|
||||
/// Text is trimmed at a word boundary. Must be combined with alignment information.
|
||||
/// </summary>
|
||||
Word = 8
|
||||
}
|
||||
public static class Ellipsis
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// String used as a place holder for trimmed text.
|
||||
/// </summary>
|
||||
public static readonly string EllipsisChars = "...";
|
||||
|
||||
private static Regex prevWord = new Regex(@"\W*\w*$");
|
||||
private static Regex nextWord = new Regex(@"\w*\W*");
|
||||
|
||||
/// <summary>
|
||||
/// Truncates a text string to fit within a given control width by replacing trimmed text with ellipses.
|
||||
/// </summary>
|
||||
/// <param name="text">String to be trimmed.</param>
|
||||
/// <param name="ctrl">text must fit within ctrl width.
|
||||
/// The ctrl's Font is used to measure the text string.</param>
|
||||
/// <param name="options">Format and alignment of ellipsis.</param>
|
||||
/// <returns>This function returns text trimmed to the specified witdh.</returns>
|
||||
public static string Compact(string text, Control ctrl, EllipsisFormat options)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return text;
|
||||
|
||||
if (ctrl == null)
|
||||
throw new ArgumentNullException("ctrl");
|
||||
|
||||
using (Graphics dc = ctrl.CreateGraphics())
|
||||
{
|
||||
Size s = TextRenderer.MeasureText(dc, text, ctrl.Font);
|
||||
|
||||
// control is large enough to display the whole text
|
||||
if (s.Width <= ctrl.Width)
|
||||
return text;
|
||||
|
||||
string pre = "";
|
||||
string mid = text;
|
||||
string post = "";
|
||||
|
||||
bool isPath = (EllipsisFormat.Path & options) != 0;
|
||||
|
||||
// split path string into <drive><directory><filename>
|
||||
if (isPath)
|
||||
{
|
||||
pre = Path.GetPathRoot(text);
|
||||
mid = Path.GetDirectoryName(text).Substring(pre.Length);
|
||||
post = Path.GetFileName(text);
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
int seg = mid.Length;
|
||||
string fit = "";
|
||||
|
||||
// find the longest string that fits into
|
||||
// the control boundaries using bisection method
|
||||
while (seg > 1)
|
||||
{
|
||||
seg -= seg / 2;
|
||||
|
||||
int left = len + seg;
|
||||
int right = mid.Length;
|
||||
|
||||
if (left > right)
|
||||
continue;
|
||||
|
||||
if ((EllipsisFormat.Middle & options) == EllipsisFormat.Middle)
|
||||
{
|
||||
right -= left / 2;
|
||||
left -= left / 2;
|
||||
}
|
||||
else if ((EllipsisFormat.Start & options) != 0)
|
||||
{
|
||||
right -= left;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
// trim at a word boundary using regular expressions
|
||||
if ((EllipsisFormat.Word & options) != 0)
|
||||
{
|
||||
if ((EllipsisFormat.End & options) != 0)
|
||||
{
|
||||
left -= prevWord.Match(mid, 0, left).Length;
|
||||
}
|
||||
if ((EllipsisFormat.Start & options) != 0)
|
||||
{
|
||||
right += nextWord.Match(mid, right).Length;
|
||||
}
|
||||
}
|
||||
|
||||
// build and measure a candidate string with ellipsis
|
||||
string tst = mid.Substring(0, left) + EllipsisChars + mid.Substring(right);
|
||||
|
||||
// restore path with <drive> and <filename>
|
||||
if (isPath)
|
||||
{
|
||||
tst = Path.Combine(Path.Combine(pre, tst), post);
|
||||
}
|
||||
s = TextRenderer.MeasureText(dc, tst, ctrl.Font);
|
||||
|
||||
// candidate string fits into control boundaries, try a longer string
|
||||
// stop when seg <= 1
|
||||
if (s.Width <= ctrl.Width)
|
||||
{
|
||||
len += seg;
|
||||
fit = tst;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 0) // string can't fit into control
|
||||
{
|
||||
// "path" mode is off, just return ellipsis characters
|
||||
if (!isPath)
|
||||
return EllipsisChars;
|
||||
|
||||
// <drive> and <directory> are empty, return <filename>
|
||||
if (pre.Length == 0 && mid.Length == 0)
|
||||
return post;
|
||||
|
||||
// measure "C:\...\filename.ext"
|
||||
fit = Path.Combine(Path.Combine(pre, EllipsisChars), post);
|
||||
|
||||
s = TextRenderer.MeasureText(dc, fit, ctrl.Font);
|
||||
|
||||
// if still not fit then return "...\filename.ext"
|
||||
if (s.Width > ctrl.Width)
|
||||
fit = Path.Combine(EllipsisChars, post);
|
||||
}
|
||||
return fit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
Win_1337_Patch/Program.cs
Normal file
21
Win_1337_Patch/Program.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Win_1337_Patch
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Punto di ingresso principale dell'applicazione.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
36
Win_1337_Patch/Properties/AssemblyInfo.cs
Normal file
36
Win_1337_Patch/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Le informazioni generali relative a un assembly sono controllate dal seguente
|
||||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
|
||||
// associate a un assembly.
|
||||
[assembly: AssemblyTitle("Win_1337_Patch")]
|
||||
[assembly: AssemblyDescription("Tool to apply/patch the 1337 files directly into the .exe or .dll")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DeFconX")]
|
||||
[assembly: AssemblyProduct("Win_1337_Patch")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("DeltaFoX")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
|
||||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
|
||||
// COM, impostare su true l'attributo ComVisible per tale tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
|
||||
[assembly: Guid("97153568-54c0-4295-9abd-20358b78a5bb")]
|
||||
|
||||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
|
||||
//
|
||||
// Versione principale
|
||||
// Versione secondaria
|
||||
// Numero di build
|
||||
// Revisione
|
||||
//
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0.0")]
|
63
Win_1337_Patch/Properties/Resources.Designer.cs
generated
Normal file
63
Win_1337_Patch/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Win_1337_Patch.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
/// </summary>
|
||||
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
|
||||
// tramite uno strumento quale ResGen o Visual Studio.
|
||||
// Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
|
||||
// con l'opzione /str oppure ricompilare il progetto VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Win_1337_Patch.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
/// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
Win_1337_Patch/Properties/Resources.resx
Normal file
117
Win_1337_Patch/Properties/Resources.resx
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
50
Win_1337_Patch/Properties/Settings.Designer.cs
generated
Normal file
50
Win_1337_Patch/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Win_1337_Patch.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string urlexe {
|
||||
get {
|
||||
return ((string)(this["urlexe"]));
|
||||
}
|
||||
set {
|
||||
this["urlexe"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string url1337 {
|
||||
get {
|
||||
return ((string)(this["url1337"]));
|
||||
}
|
||||
set {
|
||||
this["url1337"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
Win_1337_Patch/Properties/Settings.settings
Normal file
12
Win_1337_Patch/Properties/Settings.settings
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Win_1337_Patch.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="urlexe" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="url1337" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
88
Win_1337_Patch/Win_1337_Patch.csproj
Normal file
88
Win_1337_Patch/Win_1337_Patch.csproj
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{97153568-54C0-4295-9ABD-20358B78A5BB}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Win_1337_Patch</RootNamespace>
|
||||
<AssemblyName>Win_1337_Patch</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>vampire.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Ellipsis.cs" />
|
||||
<Compile Include="1337.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="1337.Designer.cs">
|
||||
<DependentUpon>1337.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="mCheckSum.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="1337.resx">
|
||||
<DependentUpon>1337.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="vampire.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
18
Win_1337_Patch/app.config
Normal file
18
Win_1337_Patch/app.config
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Win_1337_Patch.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<Win_1337_Patch.Properties.Settings>
|
||||
<setting name="urlexe" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="url1337" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Win_1337_Patch.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
198
Win_1337_Patch/mCheckSum.cs
Normal file
198
Win_1337_Patch/mCheckSum.cs
Normal file
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Win_1337_Patch
|
||||
{
|
||||
class mCheckSum
|
||||
{
|
||||
public string Pein = string.Empty;
|
||||
public string Pefi = string.Empty;
|
||||
public string TrovaCheckSum(string sFilePath)
|
||||
{
|
||||
if (File.Exists(sFilePath))
|
||||
{
|
||||
uint AttualeHeaderSum, CheckSumCalcolato = 0; uint uRet = 0;
|
||||
uRet = MapFileAndCheckSum(sFilePath, out AttualeHeaderSum, out CheckSumCalcolato);
|
||||
if (uRet == 0x00)
|
||||
return AttualeHeaderSum.ToString("X8") + "-" + CheckSumCalcolato.ToString("X8");
|
||||
else return "0";
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
|
||||
public bool FixCheckSum(string sFilePath)
|
||||
{
|
||||
if (!File.Exists(sFilePath))
|
||||
return false;
|
||||
IMAGE_DOS_HEADER DHD = new IMAGE_DOS_HEADER();
|
||||
IMAGE_NT_HEADERS NHD = new IMAGE_NT_HEADERS();
|
||||
|
||||
int iPointer = 0;
|
||||
uint uOriginal = 0;
|
||||
uint uRecalculated = 0;
|
||||
uint uRet = 0;
|
||||
byte[] fBytes = new byte[0];
|
||||
|
||||
try
|
||||
{
|
||||
BinaryReader bReader = new BinaryReader(new FileStream(sFilePath, FileMode.Open, FileAccess.Read));
|
||||
fBytes = bReader.ReadBytes((int)bReader.BaseStream.Length);
|
||||
bReader.Close();
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (fBytes.Length <= 0) { return false; }
|
||||
|
||||
GCHandle gHandle = GCHandle.Alloc(fBytes, GCHandleType.Pinned);
|
||||
iPointer = gHandle.AddrOfPinnedObject().ToInt32();
|
||||
DHD = (IMAGE_DOS_HEADER)Marshal.PtrToStructure(new IntPtr(iPointer), typeof(IMAGE_DOS_HEADER));
|
||||
NHD = (IMAGE_NT_HEADERS)Marshal.PtrToStructure(new IntPtr(iPointer + DHD.e_lfanew), typeof(IMAGE_NT_HEADERS));
|
||||
gHandle.Free();
|
||||
|
||||
if (NHD.Signature != 17744 || DHD.e_magic != 23117) { return false; }
|
||||
|
||||
uRet = MapFileAndCheckSum(sFilePath, out uOriginal, out uRecalculated);
|
||||
|
||||
if (uRet == 0x00)
|
||||
{
|
||||
if (uOriginal == uRecalculated)
|
||||
{
|
||||
Pein = uOriginal.ToString("X8");
|
||||
Pefi = uRecalculated.ToString("X8");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Pein = string.Empty;
|
||||
Pefi = string.Empty;
|
||||
return false;
|
||||
}
|
||||
Pein = uOriginal.ToString("X8");
|
||||
Pefi = uRecalculated.ToString("X8");
|
||||
NHD.OptionalHeader.CheckSum = uRecalculated;
|
||||
|
||||
byte[] bNHD = getBytes_(NHD);
|
||||
if (fBytes.Length - (DHD.e_lfanew + bNHD.Length) <= 0) { Array.Resize(ref fBytes, (int)(fBytes.Length + bNHD.Length)); }
|
||||
Array.Copy(bNHD, 0, fBytes, DHD.e_lfanew, bNHD.Length);
|
||||
|
||||
try
|
||||
{
|
||||
BinaryWriter bWriter = new BinaryWriter(new FileStream(sFilePath, FileMode.Open));
|
||||
bWriter.Write(fBytes);
|
||||
bWriter.Flush();
|
||||
bWriter.Close();
|
||||
}
|
||||
catch { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private byte[] getBytes_(object oObject)
|
||||
{
|
||||
int iSize = Marshal.SizeOf(oObject);
|
||||
IntPtr ipBuffer = Marshal.AllocHGlobal(iSize);
|
||||
Marshal.StructureToPtr(oObject, ipBuffer, false);
|
||||
byte[] bData = new byte[iSize];
|
||||
Marshal.Copy(ipBuffer, bData, 0, iSize);
|
||||
Marshal.FreeHGlobal(ipBuffer);
|
||||
return bData;
|
||||
}
|
||||
|
||||
//STRUCTURES
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct IMAGE_DOS_HEADER
|
||||
{
|
||||
public UInt16 e_magic;
|
||||
public UInt16 e_cblp;
|
||||
public UInt16 e_cp;
|
||||
public UInt16 e_crlc;
|
||||
public UInt16 e_cparhdr;
|
||||
public UInt16 e_minalloc;
|
||||
public UInt16 e_maxalloc;
|
||||
public UInt16 e_ss;
|
||||
public UInt16 e_sp;
|
||||
public UInt16 e_csum;
|
||||
public UInt16 e_ip;
|
||||
public UInt16 e_cs;
|
||||
public UInt16 e_lfarlc;
|
||||
public UInt16 e_ovno;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
public UInt16[] e_res1;
|
||||
public UInt16 e_oemid;
|
||||
public UInt16 e_oeminfo;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
|
||||
public UInt16[] e_res2;
|
||||
public Int32 e_lfanew;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct IMAGE_FILE_HEADER
|
||||
{
|
||||
public UInt16 Machine;
|
||||
public UInt16 NumberOfSections;
|
||||
public UInt32 TimeDateStamp;
|
||||
public UInt32 PointerToSymbolTable;
|
||||
public UInt32 NumberOfSymbols;
|
||||
public UInt16 SizeOfOptionalHeader;
|
||||
public UInt16 Characteristics;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct IMAGE_DATA_DIRECTORY
|
||||
{
|
||||
public UInt32 VirtualAddress;
|
||||
public UInt32 Size;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct IMAGE_OPTIONAL_HEADER32
|
||||
{
|
||||
public UInt16 Magic;
|
||||
public Byte MajorLinkerVersion;
|
||||
public Byte MinorLinkerVersion;
|
||||
public UInt32 SizeOfCode;
|
||||
public UInt32 SizeOfInitializedData;
|
||||
public UInt32 SizeOfUninitializedData;
|
||||
public UInt32 AddressOfEntryPoint;
|
||||
public UInt32 BaseOfCode;
|
||||
public UInt32 BaseOfData;
|
||||
public UInt32 ImageBase;
|
||||
public UInt32 SectionAlignment;
|
||||
public UInt32 FileAlignment;
|
||||
public UInt16 MajorOperatingSystemVersion;
|
||||
public UInt16 MinorOperatingSystemVersion;
|
||||
public UInt16 MajorImageVersion;
|
||||
public UInt16 MinorImageVersion;
|
||||
public UInt16 MajorSubsystemVersion;
|
||||
public UInt16 MinorSubsystemVersion;
|
||||
public UInt32 Win32VersionValue;
|
||||
public UInt32 SizeOfImage;
|
||||
public UInt32 SizeOfHeaders;
|
||||
public UInt32 CheckSum;
|
||||
public UInt16 Subsystem;
|
||||
public UInt16 DllCharacteristics;
|
||||
public UInt32 SizeOfStackReserve;
|
||||
public UInt32 SizeOfStackCommit;
|
||||
public UInt32 SizeOfHeapReserve;
|
||||
public UInt32 SizeOfHeapCommit;
|
||||
public UInt32 LoaderFlags;
|
||||
public UInt32 NumberOfRvaAndSizes;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public IMAGE_DATA_DIRECTORY[] DataDirectory;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct IMAGE_NT_HEADERS
|
||||
{
|
||||
public UInt32 Signature;
|
||||
public IMAGE_FILE_HEADER FileHeader;
|
||||
public IMAGE_OPTIONAL_HEADER32 OptionalHeader;
|
||||
}
|
||||
|
||||
//API's
|
||||
[DllImport("Imagehlp.dll", EntryPoint = "MapFileAndCheckSum", ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern uint MapFileAndCheckSum(string Filename, out uint HeaderSum, out uint CheckSum);
|
||||
}
|
||||
}
|
BIN
Win_1337_Patch/vampire.ico
Normal file
BIN
Win_1337_Patch/vampire.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 KiB |
Loading…
Add table
Add a link
Reference in a new issue