mirror of
https://github.com/Deltafox79/Win_1337_Apply_Patch
synced 2025-08-19 21:04:02 -07:00
Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
|
962a773ece |
||
|
11d01e8693 | ||
|
f319888c36 |
||
|
b5e095e691 | ||
|
9566cbc482 |
||
|
4a51cff5dc | ||
|
71ce22e358 | ||
|
7f0c8f2c68 |
||
|
eff9c84b80 |
||
|
c58bf684ef |
||
|
e12f52d7c3 |
||
|
4eec10f6cd |
11 changed files with 684 additions and 187 deletions
126
.gitignore
vendored
Normal file
126
.gitignore
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
# Ignore Visual Studio temporary files, build results, and
|
||||
# build logs directory.
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific folders
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
.vscode-test/
|
||||
|
||||
# Mono Auto Generated Files
|
||||
mono_crash.*
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# VS Code directories
|
||||
.vscode/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# DotNet Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# NuGet
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Include only NuGet's .gitignore
|
||||
!/.nuget/
|
||||
!/.nuget/NuGet.Config
|
||||
!/.nuget/NuGet.exe
|
||||
|
||||
# If using the new MSBuild .csproj format, uncomment this to ignore .NET Core / NuGet cache
|
||||
#!**/[Dd]ebug/
|
||||
#!**/[Rr]elease/
|
||||
|
||||
# Include only DLLs in the bin directory
|
||||
bin/**/*.dll
|
||||
|
||||
# Include only the package directory itself
|
||||
!**/[Pp]ackages/
|
||||
|
||||
# Ignore temp files
|
||||
**/bin
|
||||
**/obj
|
||||
**/TempPE
|
||||
|
||||
# Rider specific files
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# .NET Core directories
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopCache.xml
|
||||
|
||||
# Files generated by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Recycle Bin used by Visual Studio
|
||||
*.cachefile
|
||||
|
||||
# Exclude folder containing source code
|
||||
src/
|
||||
!src/**/*.cs
|
105
Win_1337_Patch/1337.Designer.cs
generated
105
Win_1337_Patch/1337.Designer.cs
generated
|
@ -30,7 +30,6 @@
|
|||
{
|
||||
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();
|
||||
|
@ -38,31 +37,18 @@
|
|||
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.cchangeOwnership = new System.Windows.Forms.CheckBox();
|
||||
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.Location = new System.Drawing.Point(7, 8);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(67, 13);
|
||||
this.label7.TabIndex = 17;
|
||||
|
@ -73,47 +59,48 @@
|
|||
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.Location = new System.Drawing.Point(90, 5);
|
||||
this.t1337.Name = "t1337";
|
||||
this.t1337.ReadOnly = true;
|
||||
this.t1337.Size = new System.Drawing.Size(309, 20);
|
||||
this.t1337.Size = new System.Drawing.Size(343, 20);
|
||||
this.t1337.TabIndex = 16;
|
||||
this.t1337.Text = "Select .1337 File...";
|
||||
this.t1337.TabStop = false;
|
||||
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);
|
||||
this.t1337.DoubleClick += new System.EventHandler(this.t1337_DoubleClick);
|
||||
//
|
||||
// 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.Location = new System.Drawing.Point(7, 34);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(60, 13);
|
||||
this.label6.Size = new System.Drawing.Size(81, 13);
|
||||
this.label6.TabIndex = 15;
|
||||
this.label6.Text = "Exe File :";
|
||||
this.label6.Text = "Exe/Dll 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.Location = new System.Drawing.Point(90, 31);
|
||||
this.texe.Name = "texe";
|
||||
this.texe.ReadOnly = true;
|
||||
this.texe.Size = new System.Drawing.Size(309, 20);
|
||||
this.texe.Size = new System.Drawing.Size(370, 20);
|
||||
this.texe.TabIndex = 14;
|
||||
this.texe.Text = "Select Exe to Patch...";
|
||||
this.texe.TabStop = false;
|
||||
this.texe.Text = "Name of Exe/Dll 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.ForeColor = System.Drawing.Color.DarkRed;
|
||||
this.btnSelect1337.Location = new System.Drawing.Point(436, 2);
|
||||
this.btnSelect1337.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btnSelect1337.Name = "btnSelect1337";
|
||||
this.btnSelect1337.Size = new System.Drawing.Size(24, 23);
|
||||
|
@ -128,18 +115,19 @@
|
|||
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.Location = new System.Drawing.Point(256, 61);
|
||||
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";
|
||||
this.linkdfox.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkdfox_LinkClicked);
|
||||
//
|
||||
// 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.Location = new System.Drawing.Point(372, 56);
|
||||
this.Patch.Name = "Patch";
|
||||
this.Patch.Size = new System.Drawing.Size(88, 23);
|
||||
this.Patch.TabIndex = 74;
|
||||
|
@ -147,31 +135,21 @@
|
|||
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.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.controlloBackup.ForeColor = System.Drawing.Color.Teal;
|
||||
this.controlloBackup.Location = new System.Drawing.Point(15, 61);
|
||||
this.controlloBackup.Location = new System.Drawing.Point(8, 60);
|
||||
this.controlloBackup.Name = "controlloBackup";
|
||||
this.controlloBackup.Size = new System.Drawing.Size(63, 17);
|
||||
this.controlloBackup.Size = new System.Drawing.Size(69, 17);
|
||||
this.controlloBackup.TabIndex = 76;
|
||||
this.controlloBackup.Text = "Backup";
|
||||
this.controlloBackup.UseVisualStyleBackColor = true;
|
||||
this.controlloBackup.CheckedChanged += new System.EventHandler(this.controlloBackup_CheckedChanged);
|
||||
//
|
||||
// cfileoffsett
|
||||
//
|
||||
|
@ -179,37 +157,54 @@
|
|||
this.cfileoffsett.Checked = true;
|
||||
this.cfileoffsett.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cfileoffsett.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.cfileoffsett.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cfileoffsett.ForeColor = System.Drawing.Color.Teal;
|
||||
this.cfileoffsett.Location = new System.Drawing.Point(80, 61);
|
||||
this.cfileoffsett.Location = new System.Drawing.Point(79, 60);
|
||||
this.cfileoffsett.Name = "cfileoffsett";
|
||||
this.cfileoffsett.Size = new System.Drawing.Size(70, 17);
|
||||
this.cfileoffsett.Size = new System.Drawing.Size(80, 17);
|
||||
this.cfileoffsett.TabIndex = 77;
|
||||
this.cfileoffsett.Text = "Fix Offset";
|
||||
this.cfileoffsett.UseVisualStyleBackColor = true;
|
||||
this.cfileoffsett.CheckedChanged += new System.EventHandler(this.cfileoffsett_CheckedChanged);
|
||||
//
|
||||
// cchangeOwnership
|
||||
//
|
||||
this.cchangeOwnership.AutoSize = true;
|
||||
this.cchangeOwnership.Checked = true;
|
||||
this.cchangeOwnership.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cchangeOwnership.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.cchangeOwnership.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
|
||||
this.cchangeOwnership.ForeColor = System.Drawing.Color.Teal;
|
||||
this.cchangeOwnership.Location = new System.Drawing.Point(165, 60);
|
||||
this.cchangeOwnership.Name = "cchangeOwnership";
|
||||
this.cchangeOwnership.Size = new System.Drawing.Size(93, 17);
|
||||
this.cchangeOwnership.TabIndex = 78;
|
||||
this.cchangeOwnership.Text = "Unlock DLL";
|
||||
this.cchangeOwnership.UseVisualStyleBackColor = true;
|
||||
this.cchangeOwnership.CheckedChanged += new System.EventHandler(this.cchangeOwnership_CheckedChanged);
|
||||
//
|
||||
// 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.ClientSize = new System.Drawing.Size(472, 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.Controls.Add(this.cchangeOwnership);
|
||||
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.MaximumSize = new System.Drawing.Size(488, 122);
|
||||
this.MinimumSize = new System.Drawing.Size(488, 122);
|
||||
this.Name = "Form1";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Win 1337 Apply Patch File v1.3...";
|
||||
this.Text = "Win 1337 Apply Patch File";
|
||||
this.Load += new System.EventHandler(this.DFoX_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
@ -217,8 +212,6 @@
|
|||
}
|
||||
|
||||
#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;
|
||||
|
@ -226,10 +219,10 @@
|
|||
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;
|
||||
private System.Windows.Forms.CheckBox cchangeOwnership;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
using System;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace Win_1337_Patch
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public string exe = String.Empty;
|
||||
public string f1337 = String.Empty;
|
||||
private string exe = String.Empty;
|
||||
private string f1337 = String.Empty;
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("Imagehlp.dll")]
|
||||
private static extern bool ImageRemoveCertificate(IntPtr handle, int index);
|
||||
|
@ -15,99 +19,135 @@ namespace Win_1337_Patch
|
|||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
string ver = "v" + version.Major + "." + version.Minor;
|
||||
this.Text = "Win 1337 Apply Patch File " + ver;
|
||||
linkdfox.Text = ver + " By DeltaFoX";
|
||||
}
|
||||
|
||||
private void btnSelectExe_Click(object sender, EventArgs e)
|
||||
private void set()
|
||||
{
|
||||
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;
|
||||
try
|
||||
{
|
||||
t1337.Text = Ellipsis.Compact(f1337, t1337, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(t1337, f1337);
|
||||
Properties.Settings.Default["url1337"] = f1337;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
string[] lines = File.ReadAllLines(f1337);
|
||||
if (!check_Symbol(lines[0]))
|
||||
return;
|
||||
|
||||
string unf = lines[0].Substring(1).ToLower().Trim();
|
||||
string nf = Path.GetFileName(unf);
|
||||
string ext = Path.GetExtension(unf);
|
||||
OpenFileDialog apriDialogoFile1 = new OpenFileDialog
|
||||
{
|
||||
FileName = nf,
|
||||
Filter = "File " + ext + "|" + nf,
|
||||
FilterIndex = 0,
|
||||
Title = "Select the file \"" + nf + "\" File..."
|
||||
};
|
||||
|
||||
if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
exe = apriDialogoFile1.FileName;
|
||||
texe.Text = Ellipsis.Compact(exe, texe, EllipsisFormat.Path);
|
||||
texe.Text = Ellipsis.Compact(Path.GetFileName(exe), texe, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(texe, exe);
|
||||
Properties.Settings.Default["urlexe"] = exe;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
t1337.Text = "Select a .1337 File...";
|
||||
texe.Text = "Select the Exe/Dll to Patch...";
|
||||
f1337 = String.Empty;
|
||||
exe = String.Empty;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while setting up the file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void t1337_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
f1337 = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
|
||||
set();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while processing drag and drop: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelect1337_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
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;
|
||||
OpenFileDialog apriDialogoFile1 = new OpenFileDialog
|
||||
{
|
||||
Filter = "File 1337|*.*",
|
||||
FilterIndex = 0,
|
||||
Title = "Select the .1337 File...",
|
||||
InitialDirectory = url1337 != "" ? url1337 : Directory.GetCurrentDirectory() + "\\",
|
||||
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();
|
||||
set();
|
||||
}
|
||||
}
|
||||
private void texe_DragEnter(object sender, DragEventArgs e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
MessageBox.Show($"An error occurred while selecting the .1337 file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
private void t1337_DragDrop(object sender, DragEventArgs e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
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();
|
||||
MessageBox.Show($"An error occurred during DragEnter: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
private void Esci_Click(object sender, EventArgs e)
|
||||
}
|
||||
|
||||
private bool check_Symbol(string s)
|
||||
{
|
||||
Application.Exit();
|
||||
if (!s.StartsWith(">"))
|
||||
{
|
||||
MessageBox.Show("The .1337 File is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Patch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (exe == String.Empty || f1337 == String.Empty)
|
||||
if (f1337 == String.Empty)
|
||||
{
|
||||
MessageBox.Show("Select a " + ((exe == String.Empty) ? "Exe" : "1337") + " File...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Select a .1337 File...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
DFoX_Patch();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
catch (Exception ex)
|
||||
{
|
||||
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;
|
||||
MessageBox.Show($"A problem occurred when patching: {ex.Message}", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DFoX_Patch()
|
||||
{
|
||||
if (!File.Exists(exe) || !File.Exists(f1337))
|
||||
|
@ -115,15 +155,26 @@ namespace Win_1337_Patch
|
|||
MessageBox.Show("Files are no Longer Present...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
string[] lines = File.ReadAllLines(f1337);
|
||||
if (lines[0].Substring(0,1) != ">")
|
||||
|
||||
if (cchangeOwnership.Checked)
|
||||
{
|
||||
MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
try
|
||||
{
|
||||
UnlockDLL(exe);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while changing ownership: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (lines[0].Substring(1).ToLower() != Path.GetFileName(exe).ToLower())
|
||||
}
|
||||
|
||||
string[] lines = File.ReadAllLines(f1337);
|
||||
if (!check_Symbol(lines[0]))
|
||||
return;
|
||||
if (lines[0].Substring(1).ToLower().Trim() != Path.GetFileName(exe).ToLower().Trim())
|
||||
{
|
||||
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);
|
||||
MessageBox.Show("The .1337 File is not valid for selected exe/dll...\n\n(\"" + lines[0].Substring(1).ToLower() + "\" but you have selected \"" + Path.GetFileName(exe).ToLower() + "\")", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
byte[] bexe = File.ReadAllBytes(exe);
|
||||
|
@ -151,9 +202,12 @@ namespace Win_1337_Patch
|
|||
{
|
||||
if (controlloBackup.Checked == true)
|
||||
{
|
||||
if (File.Exists(exe + ".BAK"))
|
||||
File.Delete(exe + ".BAK");
|
||||
File.Copy(exe, exe + ".BAK");
|
||||
string dateSuffix = DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss-tt");
|
||||
string backupFileName = $"{exe}.{dateSuffix}.BAK";
|
||||
|
||||
if (File.Exists(backupFileName))
|
||||
File.Delete(backupFileName);
|
||||
File.Copy(exe, backupFileName);
|
||||
}
|
||||
if (File.Exists(exe))
|
||||
File.Delete(exe);
|
||||
|
@ -161,8 +215,8 @@ namespace Win_1337_Patch
|
|||
SistemaPeCks(exe);
|
||||
MessageBox.Show("File " + Path.GetFileName(exe) + " Patched...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private void SistemaPeCks(string file)
|
||||
{
|
||||
try
|
||||
|
@ -170,37 +224,211 @@ namespace Win_1337_Patch
|
|||
using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.ReadWrite))
|
||||
{
|
||||
ImageRemoveCertificate(fs.SafeFileHandle.DangerousGetHandle(), 0);
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
checked
|
||||
{
|
||||
mCheckSum PE = new mCheckSum();
|
||||
PE.FixCheckSum(file);
|
||||
}
|
||||
catch
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
//Nothing
|
||||
MessageBox.Show($"Overflow error occurred while processing PE checksum: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return;
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while processing PE checksum: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DFoX_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string urlexe = Properties.Settings.Default["urlexe"].ToString().Trim();
|
||||
string url1337 = Properties.Settings.Default["url1337"].ToString().Trim();
|
||||
cfileoffsett.Checked = (bool)Properties.Settings.Default["fixoffset"];
|
||||
controlloBackup.Checked = (bool)Properties.Settings.Default["backup"];
|
||||
cchangeOwnership.Checked = (bool)Properties.Settings.Default["changeOwnership"];
|
||||
|
||||
if (urlexe != "")
|
||||
{
|
||||
texe.Text = Ellipsis.Compact(urlexe, texe, EllipsisFormat.Path);
|
||||
texe.Text = Ellipsis.Compact(Path.GetFileName(urlexe), texe, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(texe, urlexe);
|
||||
exe = urlexe;
|
||||
}
|
||||
else
|
||||
texe.Text = "Select Exe to Patch...";
|
||||
if (url1337 != "")
|
||||
texe.Text = "Select the Exe/Dll to Patch...";
|
||||
|
||||
if (url1337 != "" && urlexe != "")
|
||||
{
|
||||
t1337.Text = Ellipsis.Compact(url1337, t1337, EllipsisFormat.Path);
|
||||
toolTip1.SetToolTip(t1337, url1337);
|
||||
f1337 = url1337;
|
||||
}
|
||||
else
|
||||
t1337.Text = "Select .1337 File...";
|
||||
t1337.Text = "Select a .1337 File...";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred during form load: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void cfileoffsett_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Properties.Settings.Default["fixoffset"] = cfileoffsett.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while saving fix offset setting: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void controlloBackup_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Properties.Settings.Default["backup"] = controlloBackup.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while saving backup setting: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void cchangeOwnership_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Properties.Settings.Default["changeOwnership"] = cchangeOwnership.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while saving change ownership setting: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void linkdfox_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_apriUrl(@"https://github.com/Deltafox79/Win_1337_Apply_Patch");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while opening the URL: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void _apriUrl(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
string browserPath = ottieniLaPathBrowser();
|
||||
if (browserPath == string.Empty)
|
||||
browserPath = "iexplore";
|
||||
Process process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo(browserPath)
|
||||
{
|
||||
Arguments = url
|
||||
}
|
||||
};
|
||||
process.Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while opening the browser: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private static string ottieniLaPathBrowser()
|
||||
{
|
||||
string name = String.Empty;
|
||||
RegistryKey regKey = null;
|
||||
try
|
||||
{
|
||||
var regDefault = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.htm\\UserChoice", false);
|
||||
var stringDefault = regDefault.GetValue("ProgId");
|
||||
|
||||
regKey = Registry.ClassesRoot.OpenSubKey(stringDefault + "\\shell\\open\\command", false);
|
||||
name = regKey.GetValue(null).ToString().ToLower().Replace("" + (char)34, "");
|
||||
|
||||
if (!name.EndsWith("exe"))
|
||||
name = name.Substring(0, name.LastIndexOf(".exe") + 4);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while retrieving browser path: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (regKey != null)
|
||||
regKey.Close();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private void t1337_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
btnSelect1337.PerformClick();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred during double click: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void UnlockDLL(string filePath)
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
MessageBox.Show("The specified file does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using (Process process = new Process())
|
||||
{
|
||||
process.StartInfo = psi;
|
||||
process.Start();
|
||||
|
||||
using (StreamWriter sw = process.StandardInput)
|
||||
{
|
||||
if (sw.BaseStream.CanWrite)
|
||||
{
|
||||
sw.WriteLine($"takeown /F \"{filePath}\"");
|
||||
sw.WriteLine($"icacls \"{filePath}\" /grant Administrators:F");
|
||||
}
|
||||
}
|
||||
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
MessageBox.Show($"Ownership and permissions of {filePath} have been successfully changed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"An error occurred while changing ownership: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// È 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")]
|
||||
[assembly: AssemblyVersion("2.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.0")]
|
||||
|
|
26
Win_1337_Patch/Properties/Resources.Designer.cs
generated
26
Win_1337_Patch/Properties/Resources.Designer.cs
generated
|
@ -1,10 +1,10 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -13,13 +13,13 @@ namespace Win_1337_Patch.Properties {
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </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")]
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
@ -33,7 +33,7 @@ namespace Win_1337_Patch.Properties {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
|
@ -47,8 +47,8 @@ namespace Win_1337_Patch.Properties {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
/// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
|
|
46
Win_1337_Patch/Properties/Settings.Designer.cs
generated
46
Win_1337_Patch/Properties/Settings.Designer.cs
generated
|
@ -1,10 +1,10 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace Win_1337_Patch.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
@ -46,5 +46,41 @@ namespace Win_1337_Patch.Properties {
|
|||
this["url1337"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool fixoffset {
|
||||
get {
|
||||
return ((bool)(this["fixoffset"]));
|
||||
}
|
||||
set {
|
||||
this["fixoffset"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool backup {
|
||||
get {
|
||||
return ((bool)(this["backup"]));
|
||||
}
|
||||
set {
|
||||
this["backup"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool changeOwnership {
|
||||
get {
|
||||
return ((bool)(this["changeOwnership"]));
|
||||
}
|
||||
set {
|
||||
this["changeOwnership"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,14 @@
|
|||
<Setting Name="url1337" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="fixoffset" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="backup" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="changeOwnership" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -8,9 +8,10 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Win_1337_Patch</RootNamespace>
|
||||
<AssemblyName>Win_1337_Patch</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -21,6 +22,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -30,10 +32,14 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>vampire.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -71,6 +77,7 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?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 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>
|
||||
|
@ -13,6 +13,15 @@
|
|||
<setting name="url1337" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="fixoffset" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="backup" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="changeOwnership" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Win_1337_Patch.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
|
76
Win_1337_Patch/app.manifest
Normal file
76
Win_1337_Patch/app.manifest
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
|
@ -28,7 +28,7 @@ namespace Win_1337_Patch
|
|||
IMAGE_DOS_HEADER DHD = new IMAGE_DOS_HEADER();
|
||||
IMAGE_NT_HEADERS NHD = new IMAGE_NT_HEADERS();
|
||||
|
||||
int iPointer = 0;
|
||||
long iPointer = 0;
|
||||
uint uOriginal = 0;
|
||||
uint uRecalculated = 0;
|
||||
uint uRet = 0;
|
||||
|
@ -36,16 +36,23 @@ namespace Win_1337_Patch
|
|||
|
||||
try
|
||||
{
|
||||
BinaryReader bReader = new BinaryReader(new FileStream(sFilePath, FileMode.Open, FileAccess.Read));
|
||||
using (BinaryReader bReader = new BinaryReader(new FileStream(sFilePath, FileMode.Open, FileAccess.Read)))
|
||||
{
|
||||
fBytes = bReader.ReadBytes((int)bReader.BaseStream.Length);
|
||||
bReader.Close();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fBytes.Length <= 0) { return false; }
|
||||
|
||||
GCHandle gHandle = GCHandle.Alloc(fBytes, GCHandleType.Pinned);
|
||||
iPointer = gHandle.AddrOfPinnedObject().ToInt32();
|
||||
checked
|
||||
{
|
||||
iPointer = gHandle.AddrOfPinnedObject().ToInt64();
|
||||
}
|
||||
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();
|
||||
|
@ -74,17 +81,23 @@ namespace Win_1337_Patch
|
|||
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)); }
|
||||
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));
|
||||
using (BinaryWriter bWriter = new BinaryWriter(new FileStream(sFilePath, FileMode.Open)))
|
||||
{
|
||||
bWriter.Write(fBytes);
|
||||
bWriter.Flush();
|
||||
bWriter.Close();
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue