Merge pull request from ShinobiSheep/master

Require admin privileges
This commit is contained in:
Paolo 2018-11-28 00:22:30 +01:00 committed by GitHub
commit 9566cbc482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 37 deletions

@ -37,7 +37,6 @@
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);
@ -65,7 +64,7 @@
this.t1337.Size = new System.Drawing.Size(309, 20);
this.t1337.TabIndex = 16;
this.t1337.TabStop = false;
this.t1337.Text = "Select .1337 File...";
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);
@ -115,7 +114,7 @@
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(255, 62);
this.linkdfox.Location = new System.Drawing.Point(226, 62);
this.linkdfox.Name = "linkdfox";
this.linkdfox.Size = new System.Drawing.Size(77, 13);
this.linkdfox.TabIndex = 73;
@ -135,18 +134,6 @@
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;
@ -186,7 +173,6 @@
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);
@ -200,7 +186,7 @@
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.8...";
this.Text = "Win 1337 Apply Patch File";
this.Load += new System.EventHandler(this.DFoX_Load);
this.ResumeLayout(false);
this.PerformLayout();
@ -215,7 +201,6 @@
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;

@ -17,6 +17,10 @@ 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 set()
{
@ -35,6 +39,7 @@ namespace Win_1337_Patch
apriDialogoFile1.Filter = "File " + ext + "|" + nf;
apriDialogoFile1.FilterIndex = 0;
apriDialogoFile1.Title = "Select the file \"" + nf + "\" File...";
if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
{
exe = apriDialogoFile1.FileName;
@ -45,8 +50,8 @@ namespace Win_1337_Patch
}
else
{
t1337.Text = "Select .1337 File...";
texe.Text = "Name of Exe/Dll to Patch...";
t1337.Text = "Select a .1337 File...";
texe.Text = "Select the Exe/Dll to Patch...";
f1337 = String.Empty;
exe = String.Empty;
}
@ -72,7 +77,7 @@ namespace Win_1337_Patch
OpenFileDialog apriDialogoFile1 = new OpenFileDialog();
apriDialogoFile1.Filter = "File 1337|*.*";
apriDialogoFile1.FilterIndex = 0;
apriDialogoFile1.Title = "Select the file 1337 File...";
apriDialogoFile1.Title = "Select the .1337 File...";
apriDialogoFile1.InitialDirectory = url1337 != "" ? url1337 : Directory.GetCurrentDirectory() + "\\";
apriDialogoFile1.RestoreDirectory = true;
if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
@ -97,34 +102,26 @@ namespace Win_1337_Patch
{
if (!s.StartsWith(">"))
{
MessageBox.Show("File 1337 is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("The .1337 File is not valid...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
return true;
}
private void Esci_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Patch_Click(object sender, EventArgs e)
{
if (f1337 == String.Empty)
{
MessageBox.Show("Select a 1337 File...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Select a .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);
MessageBox.Show("Problem occured when Patching...", "Info...", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
@ -140,7 +137,7 @@ namespace Win_1337_Patch
return;
if (lines[0].Substring(1).ToLower().Trim() != Path.GetFileName(exe).ToLower().Trim())
{
MessageBox.Show("File 1337 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);
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);
@ -211,7 +208,7 @@ namespace Win_1337_Patch
exe = urlexe;
}
else
texe.Text = "Name of Exe/Dll to Patch...";
texe.Text = "Select the Exe/Dll to Patch...";
if (url1337 != "" && urlexe != "")
{
t1337.Text = Ellipsis.Compact(url1337, t1337, EllipsisFormat.Path);
@ -219,7 +216,7 @@ namespace Win_1337_Patch
f1337 = url1337;
}
else
t1337.Text = "Select .1337 File...";
t1337.Text = "Select a .1337 File...";
}
private void cfileoffsett_CheckedChanged(object sender, EventArgs e)

@ -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.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]

@ -34,6 +34,9 @@
<PropertyGroup>
<ApplicationIcon>vampire.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -71,6 +74,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>

@ -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>