This commit is contained in:
MaxXor 2015-08-27 15:40:03 +02:00
parent 0ef438f7b4
commit 4c06af84be
4 changed files with 3 additions and 49 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Xml;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Vestris.ResourceLib;
@ -34,13 +33,12 @@ public static class ClientBuilder
/// <param name="iconpath">The path to the icon for the client.</param>
/// <param name="asminfo">Information about the client executable's assembly information.</param>
/// <param name="version">The version number of the client.</param>
/// <param name="requireAdmin">Determines whether to require administrator privileges on startup.</param>
/// <exception cref="System.Exception">Thrown if the builder was unable to rename the client executable.</exception>
/// <exception cref="System.ArgumentException">Thrown if an invalid special folder was specified.</exception>
/// <exception cref="System.IO.FileLoadException">Thrown if the client binaries do not exist.</exception>
public static void Build(string output, string tag, string host, string password, string installsub, string installname,
string mutex, string startupkey, bool install, bool startup, bool hidefile, bool keylogger,
int reconnectdelay, int installpath, string iconpath, string[] asminfo, string version, bool requireAdmin)
int reconnectdelay, int installpath, string iconpath, string[] asminfo, string version)
{
// PHASE 1 - Settings
string encKey = FileHelper.GetRandomFilename(20);
@ -169,23 +167,7 @@ public static class ClientBuilder
versionResource.SaveTo(output);
}
// PHASE 5 - Manifest rewriting to require Administrator privileges on startup
if (requireAdmin)
{
ManifestResource rc = new ManifestResource();
rc.LoadFrom(output);
var nodes = rc.Manifest.GetElementsByTagName("requestedExecutionLevel");
if (nodes == null || nodes.Count == 0)
throw new Exception("Reading Manifest failed");
foreach (XmlNode node in nodes)
{
node.Attributes["level"].Value = "requireAdministrator";
break;
}
rc.SaveTo(output);
}
// PHASE 6 - Icon changing
// PHASE 5 - Icon changing
if (!string.IsNullOrEmpty(iconpath))
IconInjector.InjectIcon(output, iconpath);
}

View File

@ -287,18 +287,6 @@ public string FileVersion
}
}
public bool RequireAdministrator
{
get
{
return bool.Parse(ReadValueSafe("RequireAdministrator", "False"));
}
set
{
WriteValue("RequireAdministrator", value.ToString());
}
}
public BuilderProfile(string profileName)
{
if (string.IsNullOrEmpty(profileName)) throw new ArgumentException("Invalid Profile Path");

View File

@ -113,7 +113,6 @@ private void InitializeComponent()
this.lblTrademarks = new System.Windows.Forms.Label();
this.txtCopyright = new System.Windows.Forms.TextBox();
this.additionalTab = new System.Windows.Forms.TabPage();
this.chkRequireAdministrator = new System.Windows.Forms.CheckBox();
this.line10 = new xServer.Controls.Line();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
@ -970,7 +969,6 @@ private void InitializeComponent()
// additionalTab
//
this.additionalTab.BackColor = System.Drawing.SystemColors.Control;
this.additionalTab.Controls.Add(this.chkRequireAdministrator);
this.additionalTab.Controls.Add(this.line10);
this.additionalTab.Controls.Add(this.label14);
this.additionalTab.Controls.Add(this.label13);
@ -984,17 +982,6 @@ private void InitializeComponent()
this.additionalTab.TabIndex = 3;
this.additionalTab.Text = "Additional Settings";
//
// chkRequireAdministrator
//
this.chkRequireAdministrator.AutoSize = true;
this.chkRequireAdministrator.Location = new System.Drawing.Point(23, 119);
this.chkRequireAdministrator.Name = "chkRequireAdministrator";
this.chkRequireAdministrator.Size = new System.Drawing.Size(226, 17);
this.chkRequireAdministrator.TabIndex = 5;
this.chkRequireAdministrator.Text = "Require Administrator privileges to run";
this.chkRequireAdministrator.UseVisualStyleBackColor = true;
this.chkRequireAdministrator.CheckedChanged += new System.EventHandler(this.HasChangedSetting);
//
// line10
//
this.line10.LineAlignment = xServer.Controls.Line.Alignment.Horizontal;
@ -1178,6 +1165,5 @@ private void InitializeComponent()
private Controls.Line line10;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.ToolStripMenuItem ctxtClear;
private System.Windows.Forms.CheckBox chkRequireAdministrator;
}
}

View File

@ -51,7 +51,6 @@ private void LoadProfile(string profilename)
txtOriginalFilename.Text = profile.OriginalFilename;
txtProductVersion.Text = profile.ProductVersion;
txtFileVersion.Text = profile.FileVersion;
chkRequireAdministrator.Checked = profile.RequireAdministrator;
_profileLoaded = true;
}
@ -83,7 +82,6 @@ private void SaveProfile(string profilename)
profile.OriginalFilename = txtOriginalFilename.Text;
profile.ProductVersion = txtProductVersion.Text;
profile.FileVersion = txtFileVersion.Text;
profile.RequireAdministrator = chkRequireAdministrator.Checked;
}
private void FrmBuilder_Load(object sender, EventArgs e)
@ -283,7 +281,7 @@ private void btnBuild_Click(object sender, EventArgs e)
ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), txtPassword.Text, txtInstallsub.Text,
txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked,
chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo,
Application.ProductVersion, chkRequireAdministrator.Checked);
Application.ProductVersion);
MessageBox.Show("Successfully built client!", "Build Success", MessageBoxButtons.OK,
MessageBoxIcon.Information);