Skip to content

Commit

Permalink
Merge pull request #1 from ShinobiSheep/master
Browse files Browse the repository at this point in the history
Require admin privileges
  • Loading branch information
Paolo authored Nov 27, 2018
2 parents 7f0c8f2 + 4a51cff commit 9566cbc
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 37 deletions.
21 changes: 3 additions & 18 deletions Win_1337_Patch/1337.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions Win_1337_Patch/1337.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public partial class Form1 : Form
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()
{
Expand All @@ -35,6 +39,7 @@ private void set()
apriDialogoFile1.Filter = "File " + ext + "|" + nf;
apriDialogoFile1.FilterIndex = 0;
apriDialogoFile1.Title = "Select the file \"" + nf + "\" File...";

if (apriDialogoFile1.ShowDialog() == DialogResult.OK)
{
exe = apriDialogoFile1.FileName;
Expand All @@ -45,8 +50,8 @@ private void set()
}
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;
}
Expand All @@ -72,7 +77,7 @@ private void btnSelect1337_Click(object sender, EventArgs e)
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)
Expand All @@ -97,34 +102,26 @@ private bool check_Symbol(string s)
{
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;
}
}
Expand All @@ -140,7 +137,7 @@ private void DFoX_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);
Expand Down Expand Up @@ -211,15 +208,15 @@ private void DFoX_Load(object sender, EventArgs e)
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);
toolTip1.SetToolTip(t1337, url1337);
f1337 = url1337;
}
else
t1337.Text = "Select .1337 File...";
t1337.Text = "Select a .1337 File...";
}

private void cfileoffsett_CheckedChanged(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions Win_1337_Patch/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// È 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")]
4 changes: 4 additions & 0 deletions Win_1337_Patch/Win_1337_Patch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<PropertyGroup>
<ApplicationIcon>vampire.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -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>
Expand Down
76 changes: 76 additions & 0 deletions Win_1337_Patch/app.manifest
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 9566cbc

Please sign in to comment.