Skip to content

Commit

Permalink
Improve error handling for uxtheme patch
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaProductions committed Jan 5, 2024
1 parent 329c17a commit 57bc125
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Rectify11Installer/Core/Backend/Themes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using static Rectify11Installer.Win32.NativeMethods;

namespace Rectify11Installer.Core
Expand Down Expand Up @@ -179,7 +180,19 @@ private static bool InstallThemes()
Helper.OperationType.Copy);

Logger.WriteLine("Copied Themetool.");
Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " install", AppWinStyle.Hide, true);
try
{
Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " install", AppWinStyle.Hide, true);
}
catch
{
UninstallThemeWallpapers();

MessageBox.Show("Failed to install UxTheme patcher as SecureUXHelper.exe is missing (most likely deleted by antivirus. Try excluding the C:\\Windows\\Rectify11 folder from your anti-virus, and rerun the installer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine("InstallThemes() failed as SecureUXHelper is missing (most likely deleted by antivirus. Please exclude the C:\\Windows\\Rectify11 folder from your anti-virus.");

return false;
}
Helper.ImportReg(Path.Combine(Variables.r11Folder, "themes", "Themes.reg"));

InstallCursors();
Expand All @@ -193,7 +206,14 @@ private static bool InstallThemes()
UninstallCursors();
UninstallMsstyles();
Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "ThemeTool.exe"));
Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " uninstall", AppWinStyle.Hide, true);
try
{
Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " uninstall", AppWinStyle.Hide, true);
}
catch
{

}
return false;
}
}
Expand Down

0 comments on commit 57bc125

Please sign in to comment.