Skip to content

Commit

Permalink
use privexec instead of advancedrun
Browse files Browse the repository at this point in the history
  • Loading branch information
rounk-ctrl committed Oct 8, 2023
1 parent 3bec8ed commit c61d093
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 351 deletions.
5 changes: 1 addition & 4 deletions Rectify11.Phase2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ private static void Main(string[] args)
{
x86Files = (string[])r11Reg.GetValue("x86PendingFiles");
}

}

// copy necessary files
Expand Down Expand Up @@ -302,7 +301,6 @@ private static void Main(string[] args)
{
for (int j = 0; j < dirsi.Length; j++)
{
Console.WriteLine("j=" + dirsi[j]);
if (Directory.GetFiles(dirsi[j]).Length == 0)
{
Directory.Delete(dirsi[j], true);
Expand Down Expand Up @@ -345,9 +343,8 @@ private static void InstallFonts()
if (!File.Exists(MarlettBackupDest))
{
File.Move(MarlettDest, MarlettBackupDest);
File.Copy(marlett, MarlettDest);
}
else SafeFileCopy(marlett, MarlettDest);
SafeFileCopy(marlett, MarlettDest);

var BackIconsDest = Path.Combine(Variables.windir, "Fonts", "BackIcons.ttf");
var backicons = Path.Combine(Variables.r11Files, "BackIcons.ttf");
Expand Down
9 changes: 6 additions & 3 deletions Rectify11Installer/Core/Backend/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool WriteFiles(bool icons, bool themes)
{
if (icons)
{
if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "aRun.exe"), Properties.Resources.AdvancedRun, Helper.OperationType.Write))
if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "wsudo.exe"), Properties.Resources.wsudo, Helper.OperationType.Write))
return false;
if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"), Properties.Resources.Rectify11Phase2, Helper.OperationType.Write))
return false;
Expand Down Expand Up @@ -235,9 +235,12 @@ public static bool Cleanup()
Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "themes"), false);
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "themes.7z"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "7za.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "aRun.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "wsudo.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.exe"));
if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras")))
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.ini"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"));

if (Directory.Exists(Path.Combine(Variables.r11Folder, "extras")))
{
if (Directory.GetDirectories(Path.Combine(Variables.r11Folder, "extras")).Length == 0)
{
Expand Down
6 changes: 3 additions & 3 deletions Rectify11Installer/Core/Backend/Extras.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ private static bool InstallShell()
Arguments = " -r"
};
int num = InstallOptions.CMenuStyle;
string text = (string)Properties.Resources.ResourceManager.GetObject("config" + num);
File.WriteAllText(Path.Combine(Variables.Windir, "nilesoft", "shell.nss"), text);
if (num == 1 || num == 2)
{
var shlInstproc2 = Process.Start(shlinfo2);
string text = (string)Properties.Resources.ResourceManager.GetObject("config" + num);
File.WriteAllText(Path.Combine(Variables.Windir, "nilesoft", "shell.nss"), text);
var shlInstproc2 = Process.Start(shlinfo2);
shlInstproc2.WaitForExit();
}
if (num == 3 || num == 4)
Expand Down
5 changes: 2 additions & 3 deletions Rectify11Installer/Core/Backend/Icons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ public static bool Uninstall()
{
try
{
Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"), Properties.Resources.Rectify11Phase2, Helper.OperationType.Write);
Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "aRun.exe"), Properties.Resources.AdvancedRun, Helper.OperationType.Write);
Common.WriteFiles(true, false);
Registry.LocalMachine.OpenSubKey(@"SOFTWARE", true)
?.CreateSubKey("Rectify11", true)
?.SetValue("UninstallFiles", UninstallOptions.uninstIconsList.ToArray());
Expand All @@ -144,7 +143,7 @@ public static bool Uninstall()
}

Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "aRun.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "wsudo.exe"));

Logger.WriteLine("Icons.Uninstall() succeeded.");
Logger.WriteLine("══════════════════════════════════════════════");
Expand Down
2 changes: 0 additions & 2 deletions Rectify11Installer/Core/Backend/Themes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ private static bool InstallMsstyles()
File.Copy(themefiles[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", themefiles[i].Name), true);
}

File.WriteAllBytes(Path.Combine(Variables.r11Folder, "aRun1.exe"), Properties.Resources.AdvancedRun);
for (var i = 0; i < msstyleDirList.Length; i++)
{
try
Expand All @@ -438,7 +437,6 @@ private static bool InstallMsstyles()
return false;
}
}
File.Delete(Path.Combine(Variables.r11Folder, "aRun1.exe"));
return true;
}
private static bool UninstallMfe()
Expand Down
7 changes: 3 additions & 4 deletions Rectify11Installer/Core/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ public static bool SafeDirectoryDeletion(string path, bool ischild)
}
public static void RunAsTI(string file,string param)
{
Interaction.Shell(Path.Combine(Variables.r11Folder, "aRun.exe")
+ " /EXEFilename " + '"' + file + '"'
+ " /CommandLine " + "\'" + param + "\'"
+ " /WaitProcess 1 /RunAs 8 /Run", AppWinStyle.NormalFocus, true);
Interaction.Shell(Path.Combine(Variables.r11Folder, "wsudo.exe")
+ " -T " + file
+ " " + param, AppWinStyle.NormalFocus, true);
}
#endregion
#region Private Methods
Expand Down
164 changes: 10 additions & 154 deletions Rectify11Installer/Properties/Resources.Designer.cs

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

Loading

0 comments on commit c61d093

Please sign in to comment.