diff --git a/Rectify11Installer.sln b/Rectify11Installer.sln
index 4c6319ccb..00f452e2e 100644
--- a/Rectify11Installer.sln
+++ b/Rectify11Installer.sln
@@ -32,8 +32,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
+ {F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Mixed Platforms.Build.0 = Debug|x64
{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|Win32.ActiveCfg = Debug|Any CPU
{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|x64.ActiveCfg = Debug|Any CPU
{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}.Debug|x64.Build.0 = Debug|Any CPU
diff --git a/Rectify11Installer/Core/Backend/Common.cs b/Rectify11Installer/Core/Backend/Common.cs
index 2ded2901a..9ae08dc0b 100644
--- a/Rectify11Installer/Core/Backend/Common.cs
+++ b/Rectify11Installer/Core/Backend/Common.cs
@@ -33,14 +33,6 @@ public static bool WriteFiles(bool icons, bool themes)
{
if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "themes.7z"), Properties.Resources.themes, Helper.OperationType.Write))
return false;
-
- var s = NativeMethods.IsArm64() ? Properties.Resources.secureux_arm64 : Properties.Resources.secureux_x64;
- var dll = NativeMethods.IsArm64() ? Properties.Resources.ThemeDll_arm64 : Properties.Resources.ThemeDll_x64;
-
- if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe"), s, Helper.OperationType.Write))
- return false;
- if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "ThemeDll.dll"), dll, Helper.OperationType.Write))
- return false;
}
if (!themes && !icons)
{
diff --git a/Rectify11Installer/Core/Backend/Themes.cs b/Rectify11Installer/Core/Backend/Themes.cs
index 364b26e5a..310d8950e 100644
--- a/Rectify11Installer/Core/Backend/Themes.cs
+++ b/Rectify11Installer/Core/Backend/Themes.cs
@@ -10,226 +10,239 @@
namespace Rectify11Installer.Core
{
- internal class Themes
- {
- ///
- /// themes installation logic
- ///
- /// true if succeeds, else returns false
- public static bool Install()
- {
- try
- {
- Logger.WriteLine("Installing Themes");
- Logger.WriteLine("─────────────────");
- if (!Common.WriteFiles(false, true))
- return false;
-
-
- if (Directory.Exists(Path.Combine(Variables.r11Folder, "themes")))
- {
- Logger.WriteLine(Path.Combine(Variables.r11Folder, "themes") + " exists. Deleting it.");
- if (!Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "themes"), false))
- {
- return false;
- }
- }
-
- // extract the 7z
- Helper.SvExtract("themes.7z", "themes");
-
- if (!InstallThemes())
- return false;
-
- try
- {
- if (!InstallOptions.SkipMFE)
- {
- InstallMfe();
- Logger.WriteLine("InstallMfe() succeeded.");
- }
- }
- catch (Exception ex)
- {
- Logger.Warn("InstallMfe() failed", ex);
- }
-
- try
- {
- InstallR11Cpl();
- Logger.WriteLine("Installr11cpl() succeeded.");
- }
- catch (Exception ex)
- {
- Logger.Warn("Installr11cpl() failed", ex);
- }
-
- // mmc dpi fix
- Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 1 /f");
- Helper.SvExtract(true, "themes.7z", "mmc.exe.manifest");
- Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "mmc.exe.manifest"), Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"), Helper.OperationType.Copy);
- File.Delete(Path.Combine(Variables.r11Folder, "mmc.exe.manifest"));
-
- try
- {
- ApplyScheme();
- Logger.WriteLine("ApplyScheme() succeeded.");
- }
- catch (Exception ex)
- {
- Logger.Warn("ApplyScheme() failed", ex);
- }
-
- Variables.RestartRequired = true;
- Logger.WriteLine("Themes.Install() succeeded.");
- Logger.WriteLine("══════════════════════════════════════════════");
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Themes.Install() failed", ex);
- return false;
- }
- }
-
- ///
- /// themes uninstallation logic
- ///
- /// true if succeeds, else returns false
- public static bool Uninstall()
- {
- try
- {
- var s = IsArm64() ? Properties.Resources.secureux_arm64 : Properties.Resources.secureux_x64;
- var dll = IsArm64() ? Properties.Resources.ThemeDll_arm64 : Properties.Resources.ThemeDll_x64;
-
- if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe"), s, Helper.OperationType.Write))
- return false;
- if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "ThemeDll.dll"), dll, Helper.OperationType.Write))
- return false;
-
- string mode = Theme.IsUsingDarkMode ? "dark.theme" : "aero.theme";
- if (File.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", mode)))
- Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", mode));
- string theme = Theme.IsUsingDarkMode ? "Windows (dark)" : "Windows (light)";
- Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + theme + '"', AppWinStyle.Hide, true);
-
- UninstallThemeWallpapers();
-
- Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " uninstall", AppWinStyle.Hide, true);
- Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "Themetool.exe"));
-
- UninstallCursors();
-
- UninstallMsstyles();
-
- Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe"));
- Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ThemeDll.dll"));
-
- UninstallMfe();
-
- try
- {
- var key = Registry.ClassesRoot.OpenSubKey(@"CLSID", true);
- key.DeleteSubKeyTree("{959E11F4-0A48-49cf-8416-FF9BC49D9656}", false);
- key.Dispose();
- key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace", true);
- key.DeleteSubKeyTree("{959E11F4-0A48-49cf-8416-FF9BC49D9656}", false);
- key.Dispose();
- key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", true);
- key.SetValue("MS Shell Dlg 2", "Tahoma");
- key.SetValue("MS Shell Dlg", "Microsoft Sans Serif");
- key.Dispose();
- key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop\WindowMetrics", true);
- key.SetValue("MenuHeight", "-285");
- key.SetValue("MenuWidth", "-285");
- key.Dispose();
- Logger.WriteLine("Removed registry entries.");
- }
- catch { }
-
- UninstallR11Cpl();
- Logger.WriteLine("Deleted Rectify11 Control Center.");
-
- Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 0 /f");
- Helper.SafeFileDeletion(Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"));
-
- Logger.WriteLine("Themes.Uninstall() succeeded.");
- Logger.WriteLine("══════════════════════════════════════════════");
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Themes.Uninstall() failed", ex);
- return false;
- }
- }
-
- ///
- /// installs themes
- ///
- private static bool InstallThemes()
- {
- try
- {
- InstallThemeWallpapers();
-
- Helper.SafeFileOperation(
- Path.Combine(Variables.r11Folder, "themes", "ThemeTool.exe"),
- Path.Combine(Variables.Windir, "ThemeTool.exe"),
- Helper.OperationType.Copy);
-
- Logger.WriteLine("Copied Themetool.");
- try
- {
- Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " install", AppWinStyle.Hide, true);
+ internal class Themes
+ {
+ ///
+ /// themes installation logic
+ ///
+ /// true if succeeds, else returns false
+ public static bool Install()
+ {
+ try
+ {
+ Logger.WriteLine("Installing Themes");
+ Logger.WriteLine("─────────────────");
+ if (!Common.WriteFiles(false, true))
+ return false;
+
+
+ if (Directory.Exists(Path.Combine(Variables.r11Folder, "themes")))
+ {
+ Logger.WriteLine(Path.Combine(Variables.r11Folder, "themes") + " exists. Deleting it.");
+ if (!Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "themes"), false))
+ {
+ return false;
+ }
+ }
+
+ // extract the 7z
+ Helper.SvExtract("themes.7z", "themes");
+
+ // Install/update r11cpl first to make RectifyUtil class work
+ try
+ {
+ InstallR11Cpl();
+ Logger.WriteLine("Installr11cpl() succeeded.");
+ }
+ catch (Exception ex)
+ {
+ Logger.Warn("Installr11cpl() failed", ex);
+ return false;
+ }
+
+ if (!InstallThemes())
+ return false;
+
+ try
+ {
+ if (!InstallOptions.SkipMFE)
+ {
+ InstallMfe();
+ Logger.WriteLine("InstallMfe() succeeded.");
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.Warn("InstallMfe() failed", ex);
+ }
+
+ // mmc dpi fix
+ Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 1 /f");
+ Helper.SvExtract(true, "themes.7z", "mmc.exe.manifest");
+ Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "mmc.exe.manifest"), Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"), Helper.OperationType.Copy);
+ File.Delete(Path.Combine(Variables.r11Folder, "mmc.exe.manifest"));
+
+ try
+ {
+ ApplyScheme();
+ Logger.WriteLine("ApplyScheme() succeeded.");
+ }
+ catch (Exception ex)
+ {
+ Logger.Warn("ApplyScheme() failed", ex);
+ }
+
+ Variables.RestartRequired = true;
+ Logger.WriteLine("Themes.Install() succeeded.");
+ Logger.WriteLine("══════════════════════════════════════════════");
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Themes.Install() failed", ex);
+ return false;
+ }
+ }
+
+ ///
+ /// themes uninstallation logic
+ ///
+ /// true if succeeds, else returns false
+ public static bool Uninstall()
+ {
+ try
+ {
+ string mode = Theme.IsUsingDarkMode ? "dark.theme" : "aero.theme";
+ if (File.Exists(Path.Combine(Variables.Windir, "Resources", "Themes", mode)))
+ Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", mode));
+ string theme = Theme.IsUsingDarkMode ? "Windows (dark)" : "Windows (light)";
+ RectifyThemeUtil.Utility.ApplyTheme(theme);
+
+ UninstallThemeWallpapers();
+
+ nint hr = RectifyThemeUtil.Utility.UninstallThemeTool();
+ if (hr != 0)
+ {
+ Logger.WriteLine("FAILED TO REMOVE THEMETOOL: " + hr);
+ }
+ Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "Themetool.exe"));
+
+ UninstallCursors();
+
+ UninstallMsstyles();
+
+ // Remove leftovers from previous versions
+ Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe"));
+ Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ThemeDll.dll"));
+
+ UninstallMfe();
+
+ try
+ {
+ var key = Registry.ClassesRoot.OpenSubKey(@"CLSID", true);
+ key.DeleteSubKeyTree("{959E11F4-0A48-49cf-8416-FF9BC49D9656}", false);
+ key.Dispose();
+ key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace", true);
+ key.DeleteSubKeyTree("{959E11F4-0A48-49cf-8416-FF9BC49D9656}", false);
+ key.Dispose();
+ key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", true);
+ key.SetValue("MS Shell Dlg 2", "Tahoma");
+ key.SetValue("MS Shell Dlg", "Microsoft Sans Serif");
+ key.Dispose();
+ key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop\WindowMetrics", true);
+ key.SetValue("MenuHeight", "-285");
+ key.SetValue("MenuWidth", "-285");
+ key.Dispose();
+ Logger.WriteLine("Removed registry entries.");
+ }
+ catch { }
+
+ UninstallR11Cpl();
+ Logger.WriteLine("Deleted Rectify11 Control Center.");
+
+ Process.Start(Path.Combine(Variables.sys32Folder, "reg.exe"), @" ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide /v PreferExternalManifest /t REG_DWORD /d 0 /f");
+ Helper.SafeFileDeletion(Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"));
+
+ Logger.WriteLine("Themes.Uninstall() succeeded.");
+ Logger.WriteLine("══════════════════════════════════════════════");
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Themes.Uninstall() failed", ex);
+ return false;
+ }
+ }
+
+ ///
+ /// installs themes
+ ///
+ private static bool InstallThemes()
+ {
+ try
+ {
+ InstallThemeWallpapers();
+
+ Helper.SafeFileOperation(
+ Path.Combine(Variables.r11Folder, "themes", "ThemeTool.exe"),
+ Path.Combine(Variables.Windir, "ThemeTool.exe"),
+ Helper.OperationType.Copy);
+
+ Logger.WriteLine("Copied Themetool.");
+ nint hr = 0;
+ try
+ {
+ hr = RectifyThemeUtil.Utility.InstallThemeTool();
}
- catch
- {
+ catch (Exception ex)
+ {
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);
+ MessageBox.Show("Failed to install UxTheme patcher: " + ex.ToString(), "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;
+ return false;
}
- Helper.ImportReg(Path.Combine(Variables.r11Folder, "themes", "Themes.reg"));
-
- InstallCursors();
- InstallMsstyles();
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteLine("InstallThemes() failed", ex);
- UninstallThemeWallpapers();
- UninstallCursors();
- UninstallMsstyles();
- Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "ThemeTool.exe"));
- try
- {
- Interaction.Shell(Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " uninstall", AppWinStyle.Hide, true);
+
+ if (hr != 0)
+ {
+ MessageBox.Show("Failed to install UxTheme patcher. HRESULT is " + hr, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Logger.WriteLine("Failed to install UxTheme patcher. HRESULT is " + hr);
}
- catch
- {
-
- }
- return false;
- }
- }
-
- ///
- /// installs control center
- ///
- public static void InstallR11Cpl()
- {
- UninstallR11Cpl();
-
- // Delete r11 control center
- Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false);
- Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs"));
-
- // install new
+ Helper.ImportReg(Path.Combine(Variables.r11Folder, "themes", "Themes.reg"));
+
+ InstallCursors();
+ InstallMsstyles();
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("InstallThemes() failed", ex);
+ UninstallThemeWallpapers();
+ UninstallCursors();
+ UninstallMsstyles();
+ Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "ThemeTool.exe"));
+
+ nint hr = 0;
+ try
+ {
+ hr = RectifyThemeUtil.Utility.UninstallThemeTool();
+ }
+ catch (Exception ex2)
+ {
+ Logger.WriteLine("Failed to uninstall themetool: ", ex2);
+ }
+
+ if (hr != 0)
+ {
+ Logger.WriteLine("Failed to uninstall themetool. HRESULT is " + hr);
+ }
+ return false;
+ }
+ }
+
+ ///
+ /// installs control center
+ ///
+ public static void InstallR11Cpl()
+ {
+ UninstallR11Cpl();
+
+ // Delete r11 control center
+ Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false);
+ Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs"));
+
+ // install new
string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
//create files
@@ -237,6 +250,10 @@ public static void InstallR11Cpl()
File.WriteAllBytes(cplPath, Properties.Resources.Rectify11CPL);
+ // write SecureUxTheme helper dll
+ if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "Rectify11CPL", "ThemeDLL.dll"), Properties.Resources.ThemeDLL, Helper.OperationType.Write))
+ return;
+
// create shortcut
using ShellLink shortcut = new();
shortcut.Target = Path.Combine(Variables.sys32Folder, "control.exe");
@@ -270,288 +287,294 @@ public static void InstallR11Cpl()
Logger.WriteLine("Error while registering CPL: " + proc.ExitCode);
}
}
- ///
- /// uninstalls control center
- ///
- private static void UninstallR11Cpl()
- {
- string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
- string startmenuShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk");
- string desktopShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk");
-
- // delete shortcut
- Helper.SafeFileDeletion(startmenuShortcut);
- Helper.SafeFileDeletion(desktopShortcut);
-
- if (File.Exists(cplPath))
- {
- // unregister CPL
- var proc = new Process();
- proc.StartInfo.FileName = "regsvr32.exe";
- proc.StartInfo.Arguments = "/s /u \"" + cplPath + "\"";
- proc.Start();
- proc.WaitForExit();
-
- if (proc.ExitCode != 0)
- {
- Logger.Warn("Error while unregistering CPL: " + proc.ExitCode);
- }
- }
- // nuke r11cp
- Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false);
-
- //delete folder
- Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false);
- }
-
- ///
- /// installs mfe
- ///
- private static void InstallMfe()
- {
- UninstallMfe();
- Directory.Move(Path.Combine(Variables.r11Folder, "Themes", "MicaForEveryone"), Path.Combine(Variables.Windir, "MicaForEveryone"));
- Interaction.Shell(Path.Combine(Variables.sys32Folder, "schtasks.exe") + " /create /tn mfe /xml " + Path.Combine(Variables.Windir, "MicaForEveryone", "XML", "mfe.xml"), AppWinStyle.Hide, true);
-
- string path = Path.Combine(Environment.GetEnvironmentVariable("localappdata"), "Mica For Everyone");
- Helper.SafeDirectoryDeletion(path, false);
- string t = InstallOptions.TabbedNotMica ? "T" : "";
- string val = "";
- if (InstallOptions.ThemeLight) val = t + "lightrectified.conf";
- else if (InstallOptions.ThemeDark) val = t + "darkrectified.conf";
- else if (InstallOptions.ThemePDark) val = t + "darkrectified.conf";
- else if (InstallOptions.ThemeBlack)
- {
- val = t + "black.conf";
- string amdorarm = NativeMethods.IsArm64() ? "ARM" : "AMD";
- Interaction.Shell(Path.Combine(Variables.sys32Folder, "schtasks.exe") + " /create /tn micafix /xml " + Path.Combine(Variables.Windir, "MicaForEveryone", "XML", "micafix" + amdorarm + "64.xml"), AppWinStyle.Hide, true);
- }
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- File.Copy(Path.Combine(Variables.Windir, "MicaForEveryone", "CONF", val),
- Path.Combine(Variables.Windir, "MicaForEveryone", "MicaForEveryone.conf"), true);
- }
- }
-
- #region Internal
- private static bool InstallThemeWallpapers()
- {
- UninstallThemeWallpapers();
- Directory.CreateDirectory(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified"));
- try
- {
- var files = Directory.GetFiles(Path.Combine(Variables.r11Folder, "themes", "wallpapers"));
- for (int j = 0; j < files.Length; j++)
- {
- File.Copy(files[j], Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", Path.GetFileName(files[j])), true);
- }
- Logger.WriteLine("Copied wallpapers to " + Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified"));
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error copying wallpapers", ex);
- }
- return true;
- }
- private static bool UninstallThemeWallpapers()
- {
- if (Directory.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified")))
- {
- try
- {
- List wallpapers = new()
- {
- "cosmic.png",
- "img0.png",
- "img19.png",
- "metal.png"
- };
- string path = Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified");
- var files = Directory.GetFiles(path);
- for (int j = 0; j < files.Length; j++)
- {
- if (!wallpapers.Contains(Path.GetFileName(files[j])))
- Helper.SafeFileDeletion(files[j]);
- }
- if (Directory.GetFiles(path).Length == 0)
- {
- Helper.SafeDirectoryDeletion(path, false);
- Logger.WriteLine("Deleted " + path);
- }
- Logger.WriteLine("Deleted old wallpapers.");
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error deleting old wallpapers", ex);
- }
- }
- return true;
- }
- private static bool InstallCursors()
- {
- UninstallCursors();
- var curdir = new DirectoryInfo(Path.Combine(Variables.r11Folder, "themes", "cursors"))
- .GetDirectories("*", SearchOption.TopDirectoryOnly);
-
- for (var i = 0; i < curdir.Length; i++)
- {
- try
- {
- Directory.Move(curdir[i].FullName, Path.Combine(Variables.Windir, "cursors", curdir[i].Name));
- Logger.WriteLine("Copied " + curdir[i].Name + " cursors");
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error copying " + curdir[i].Name, ex);
- return false;
- }
- }
- return true;
- }
- private static bool UninstallCursors()
- {
- var dirs = Directory.GetDirectories(Path.Combine(Variables.Windir, "cursors"), "WindowsRectified*");
- for (int i = 0; i < dirs.Length; i++)
- {
- try
- {
- Helper.SafeDirectoryDeletion(dirs[i], false);
- Logger.WriteLine("Deleted existing cursor directory " + dirs[i]);
- }
- catch
- {
- return false;
- }
- }
- return true;
- }
- private static bool UninstallMsstyles()
- {
- // .theme files
- List themefiles = new()
- {
- "black.theme",
- "darkcolorized.theme",
- "darkrectified.theme",
- "lightrectified.theme",
- "darkpartial.theme"
- };
- try
- {
- for (int i = 0; i < themefiles.Count; i++)
- {
- Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "Resources", "Themes", themefiles[i]));
- }
- Logger.WriteLine("Deleted themes.");
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error deleting themes", ex);
- }
-
- // msstyles
- try
- {
- Helper.SafeDirectoryDeletion(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"), false);
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error deleting " + Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"), ex);
- return false;
- }
- return true;
- }
- private static bool InstallMsstyles()
- {
- UninstallMsstyles();
- DirectoryInfo themedir = new(Path.Combine(Variables.r11Folder, "themes", "themes"));
- var msstyleDirList = themedir.GetDirectories("*", SearchOption.TopDirectoryOnly);
- var themefiles = themedir.GetFiles("*.theme");
-
- for (var i = 0; i < themefiles.Length; i++)
- {
- // why would it fail
- File.Copy(themefiles[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", themefiles[i].Name), true);
- }
-
- for (var i = 0; i < msstyleDirList.Length; i++)
- {
- try
- {
- if (Environment.OSVersion.Version.Build >= 22543
- && !msstyleDirList[i].Name.Contains("Legacy"))
- {
- Directory.Move(msstyleDirList[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", msstyleDirList[i].Name));
- Logger.WriteLine("Copied " + msstyleDirList[i].Name + " directory.");
- }
- else if (Environment.OSVersion.Version.Build < 22543)
- {
- Directory.Move(msstyleDirList[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", msstyleDirList[i].Name.Replace("Legacy", "")));
- Logger.WriteLine("Copied " + msstyleDirList[i].Name + " directory.");
- }
- }
- catch (Exception ex)
- {
- Logger.WriteLine("Error copying " + msstyleDirList[i].Name, ex);
- return false;
- }
- }
- return true;
- }
- private static bool UninstallMfe()
- {
- try
- {
- Helper.KillProcess("micaforeveryone.exe");
- Helper.KillProcess("micafix.exe");
- Helper.KillProcess("explorerframe.exe");
- Helper.DeleteTask("mfe");
- Helper.DeleteTask("micafix");
- if (!Helper.SafeDirectoryDeletion(Path.Combine(Variables.Windir, "MicaForEveryone"), false))
- {
- Logger.WriteLine("Deleting " + Path.Combine(Variables.Windir, "MicaForEveryone") + " failed. ");
- return false;
- }
- return true;
- }
- catch { return false; }
- }
-
- ///
- /// applies the theme just before restart to set the mouse cursor properly
- ///
- private static void ApplyScheme()
- {
- var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true);
- string s = "e";
- if (key != null)
- {
- if (InstallOptions.ThemeLight)
- {
- Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "lightrectified.theme"));
- s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 light theme" + '"';
- }
- else if (InstallOptions.ThemeDark)
- {
- Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkrectified.theme"));
- s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 dark theme" + '"';
- }
- else if (InstallOptions.ThemePDark)
- {
- Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkpartial.theme"));
- s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 partial dark theme" + '"';
- }
- else
- {
- Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "black.theme"));
- s = Path.Combine(Variables.r11Folder, "SecureUXHelper.exe") + " apply " + '"' + "Rectify11 Dark theme with Mica" + '"';
- }
- }
- key.SetValue("ApplyTheme", s, RegistryValueKind.String);
- key.SetValue("DeleteJunk", "rmdir /s /q " + Path.Combine(Environment.SpecialFolder.LocalApplicationData.ToString(), "junk"), RegistryValueKind.String);
- key.Close();
- }
- #endregion
- }
+ ///
+ /// uninstalls control center
+ ///
+ private static void UninstallR11Cpl()
+ {
+ string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
+ string startmenuShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk");
+ string desktopShortcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk");
+
+ // delete shortcut
+ Helper.SafeFileDeletion(startmenuShortcut);
+ Helper.SafeFileDeletion(desktopShortcut);
+
+ if (File.Exists(cplPath))
+ {
+ // unregister CPL
+ var proc = new Process();
+ proc.StartInfo.FileName = "regsvr32.exe";
+ proc.StartInfo.Arguments = "/s /u \"" + cplPath + "\"";
+ proc.Start();
+ proc.WaitForExit();
+
+ if (proc.ExitCode != 0)
+ {
+ Logger.Warn("Error while unregistering CPL: " + proc.ExitCode);
+ }
+ }
+ // nuke r11cp
+ Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false);
+
+ //delete folder
+ Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false);
+ }
+
+ ///
+ /// installs mfe
+ ///
+ private static void InstallMfe()
+ {
+ UninstallMfe();
+ Directory.Move(Path.Combine(Variables.r11Folder, "Themes", "MicaForEveryone"), Path.Combine(Variables.Windir, "MicaForEveryone"));
+ Interaction.Shell(Path.Combine(Variables.sys32Folder, "schtasks.exe") + " /create /tn mfe /xml " + Path.Combine(Variables.Windir, "MicaForEveryone", "XML", "mfe.xml"), AppWinStyle.Hide, true);
+
+ string path = Path.Combine(Environment.GetEnvironmentVariable("localappdata"), "Mica For Everyone");
+ Helper.SafeDirectoryDeletion(path, false);
+ string t = InstallOptions.TabbedNotMica ? "T" : "";
+ string val = "";
+ if (InstallOptions.ThemeLight) val = t + "lightrectified.conf";
+ else if (InstallOptions.ThemeDark) val = t + "darkrectified.conf";
+ else if (InstallOptions.ThemePDark) val = t + "darkrectified.conf";
+ else if (InstallOptions.ThemeBlack)
+ {
+ val = t + "black.conf";
+ string amdorarm = NativeMethods.IsArm64() ? "ARM" : "AMD";
+ Interaction.Shell(Path.Combine(Variables.sys32Folder, "schtasks.exe") + " /create /tn micafix /xml " + Path.Combine(Variables.Windir, "MicaForEveryone", "XML", "micafix" + amdorarm + "64.xml"), AppWinStyle.Hide, true);
+ }
+
+ if (!string.IsNullOrWhiteSpace(val))
+ {
+ File.Copy(Path.Combine(Variables.Windir, "MicaForEveryone", "CONF", val),
+ Path.Combine(Variables.Windir, "MicaForEveryone", "MicaForEveryone.conf"), true);
+ }
+ }
+
+ #region Internal
+ private static bool InstallThemeWallpapers()
+ {
+ UninstallThemeWallpapers();
+ Directory.CreateDirectory(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified"));
+ try
+ {
+ var files = Directory.GetFiles(Path.Combine(Variables.r11Folder, "themes", "wallpapers"));
+ for (int j = 0; j < files.Length; j++)
+ {
+ File.Copy(files[j], Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified", Path.GetFileName(files[j])), true);
+ }
+ Logger.WriteLine("Copied wallpapers to " + Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified"));
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error copying wallpapers", ex);
+ }
+ return true;
+ }
+ private static bool UninstallThemeWallpapers()
+ {
+ if (Directory.Exists(Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified")))
+ {
+ try
+ {
+ List wallpapers = new()
+ {
+ "cosmic.png",
+ "img0.png",
+ "img19.png",
+ "metal.png"
+ };
+ string path = Path.Combine(Variables.Windir, "web", "wallpaper", "Rectified");
+ var files = Directory.GetFiles(path);
+ for (int j = 0; j < files.Length; j++)
+ {
+ if (!wallpapers.Contains(Path.GetFileName(files[j])))
+ Helper.SafeFileDeletion(files[j]);
+ }
+ if (Directory.GetFiles(path).Length == 0)
+ {
+ Helper.SafeDirectoryDeletion(path, false);
+ Logger.WriteLine("Deleted " + path);
+ }
+ Logger.WriteLine("Deleted old wallpapers.");
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error deleting old wallpapers", ex);
+ }
+ }
+ return true;
+ }
+ private static bool InstallCursors()
+ {
+ UninstallCursors();
+ var curdir = new DirectoryInfo(Path.Combine(Variables.r11Folder, "themes", "cursors"))
+ .GetDirectories("*", SearchOption.TopDirectoryOnly);
+
+ for (var i = 0; i < curdir.Length; i++)
+ {
+ try
+ {
+ Directory.Move(curdir[i].FullName, Path.Combine(Variables.Windir, "cursors", curdir[i].Name));
+ Logger.WriteLine("Copied " + curdir[i].Name + " cursors");
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error copying " + curdir[i].Name, ex);
+ return false;
+ }
+ }
+ return true;
+ }
+ private static bool UninstallCursors()
+ {
+ var dirs = Directory.GetDirectories(Path.Combine(Variables.Windir, "cursors"), "WindowsRectified*");
+ for (int i = 0; i < dirs.Length; i++)
+ {
+ try
+ {
+ Helper.SafeDirectoryDeletion(dirs[i], false);
+ Logger.WriteLine("Deleted existing cursor directory " + dirs[i]);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ private static bool UninstallMsstyles()
+ {
+ // .theme files
+ List themefiles = new()
+ {
+ "black.theme",
+ "darkcolorized.theme",
+ "darkrectified.theme",
+ "lightrectified.theme",
+ "darkpartial.theme"
+ };
+ try
+ {
+ for (int i = 0; i < themefiles.Count; i++)
+ {
+ Helper.SafeFileDeletion(Path.Combine(Variables.Windir, "Resources", "Themes", themefiles[i]));
+ }
+ Logger.WriteLine("Deleted themes.");
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error deleting themes", ex);
+ }
+
+ // msstyles
+ try
+ {
+ Helper.SafeDirectoryDeletion(Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"), false);
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error deleting " + Path.Combine(Variables.Windir, "Resources", "Themes", "Rectified"), ex);
+ return false;
+ }
+ return true;
+ }
+ private static bool InstallMsstyles()
+ {
+ UninstallMsstyles();
+ DirectoryInfo themedir = new(Path.Combine(Variables.r11Folder, "themes", "themes"));
+ var msstyleDirList = themedir.GetDirectories("*", SearchOption.TopDirectoryOnly);
+ var themefiles = themedir.GetFiles("*.theme");
+
+ for (var i = 0; i < themefiles.Length; i++)
+ {
+ // why would it fail
+ File.Copy(themefiles[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", themefiles[i].Name), true);
+ }
+
+ for (var i = 0; i < msstyleDirList.Length; i++)
+ {
+ try
+ {
+ if (Environment.OSVersion.Version.Build >= 22543
+ && !msstyleDirList[i].Name.Contains("Legacy"))
+ {
+ Directory.Move(msstyleDirList[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", msstyleDirList[i].Name));
+ Logger.WriteLine("Copied " + msstyleDirList[i].Name + " directory.");
+ }
+ else if (Environment.OSVersion.Version.Build < 22543)
+ {
+ Directory.Move(msstyleDirList[i].FullName, Path.Combine(Variables.Windir, "Resources", "Themes", msstyleDirList[i].Name.Replace("Legacy", "")));
+ Logger.WriteLine("Copied " + msstyleDirList[i].Name + " directory.");
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.WriteLine("Error copying " + msstyleDirList[i].Name, ex);
+ return false;
+ }
+ }
+ return true;
+ }
+ private static bool UninstallMfe()
+ {
+ try
+ {
+ Helper.KillProcess("micaforeveryone.exe");
+ Helper.KillProcess("micafix.exe");
+ Helper.KillProcess("explorerframe.exe");
+ Helper.DeleteTask("mfe");
+ Helper.DeleteTask("micafix");
+ if (!Helper.SafeDirectoryDeletion(Path.Combine(Variables.Windir, "MicaForEveryone"), false))
+ {
+ Logger.WriteLine("Deleting " + Path.Combine(Variables.Windir, "MicaForEveryone") + " failed. ");
+ return false;
+ }
+ return true;
+ }
+ catch { return false; }
+ }
+
+ ///
+ /// Applies theme, and schedules removal of
+ ///
+ private static void ApplyScheme()
+ {
+ var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true);
+
+ var config = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Rectify11", true);
+ if (key != null && config != null)
+ {
+ // The goal here is to apply the theme and visual style. For some reason, running the .theme
+ // file only applies cursors, wallpaper, etc but does not change the visual style. Because of that,
+ // RectifyStart applies it on the next boot after theme patcher is installed. It is ran on the next boot
+ // to ensure that the UxTheme patcher is running.
+ if (InstallOptions.ThemeLight)
+ {
+ Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "lightrectified.theme"));
+ config.SetValue("ApplyThemeOnNextRun", "Rectify11 light theme");
+ }
+ else if (InstallOptions.ThemeDark)
+ {
+ Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkrectified.theme"));
+ config.SetValue("ApplyThemeOnNextRun", "Rectify11 dark theme");
+ }
+ else if (InstallOptions.ThemePDark)
+ {
+ Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "darkpartial.theme"));
+ config.SetValue("ApplyThemeOnNextRun", "Rectify11 partial dark theme");
+ }
+ else
+ {
+ Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", "black.theme"));
+ config.SetValue("ApplyThemeOnNextRun", "Rectify11 Dark theme with Mica");
+ }
+
+ config.Close();
+ key.SetValue("DeleteJunk", "rmdir /s /q " + Path.Combine(Environment.SpecialFolder.LocalApplicationData.ToString(), "junk"), RegistryValueKind.String);
+ key.Close();
+ }
+ }
+ #endregion
+ }
}
diff --git a/Rectify11Installer/Properties/Resources.Designer.cs b/Rectify11Installer/Properties/Resources.Designer.cs
index 0545d7d77..69a9e9343 100644
--- a/Rectify11Installer/Properties/Resources.Designer.cs
+++ b/Rectify11Installer/Properties/Resources.Designer.cs
@@ -581,26 +581,6 @@ internal static byte[] ResourceHacker {
}
}
- ///
- /// Looks up a localized resource of type System.Byte[].
- ///
- internal static byte[] secureux_arm64 {
- get {
- object obj = ResourceManager.GetObject("secureux_arm64", resourceCulture);
- return ((byte[])(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Byte[].
- ///
- internal static byte[] secureux_x64 {
- get {
- object obj = ResourceManager.GetObject("secureux_x64", resourceCulture);
- return ((byte[])(obj));
- }
- }
-
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -624,19 +604,9 @@ internal static System.Drawing.Bitmap theme {
///
/// Looks up a localized resource of type System.Byte[].
///
- internal static byte[] ThemeDll_arm64 {
- get {
- object obj = ResourceManager.GetObject("ThemeDll_arm64", resourceCulture);
- return ((byte[])(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Byte[].
- ///
- internal static byte[] ThemeDll_x64 {
+ internal static byte[] ThemeDLL {
get {
- object obj = ResourceManager.GetObject("ThemeDll_x64", resourceCulture);
+ object obj = ResourceManager.GetObject("ThemeDLL", resourceCulture);
return ((byte[])(obj));
}
}
diff --git a/Rectify11Installer/Properties/Resources.resx b/Rectify11Installer/Properties/Resources.resx
index b6aed7829..60f832d07 100644
--- a/Rectify11Installer/Properties/Resources.resx
+++ b/Rectify11Installer/Properties/Resources.resx
@@ -121,7 +121,7 @@
iVBORw0KGgoAAAANSUhEUgAAANQAAADBCAYAAAC3xZ4wAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAAdnJJREFUeF7tvQd4VVd29v/ly5RMSTJf/kkmZZLMZLo944IbmN6rEGqIJnrv3caY
+ DgAACw4BQL7hQQAAdnJJREFUeF7tvQd4VVd29v/ly5RMSTJf/kkmZZLMZLo944IbmN6rEGqIJnrv3caY
3nvvvWM66gUQmGabYmM6iCIkIQEqIIoAAfv/vrucu+/RlY3HGBBz9/O8rHOrCuend+211z73/zztsejU
uL9fnDGz1MJL0xotTp06eMGFKXOgLQvOT9027/yUT+eem6yUMmX73LOTtsw9M3nO3LMTB885PaHRvLNT
Sum38Q//+OsdhGjJpZmNFl2aNmdx6vTtU86N2D3yVL/k9453SupxpGV8u8OhMS0PBEY3+7ROZJP9tSOb
@@ -632,7 +632,7 @@
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAAJnBJREFUeF7tnUlQHce+5m9H9LI7ovcdL+KtO7rv9Wxf+15LsmXJsyVf2xoYhNCE
+ DgAACw4BQL7hQQAAJnBJREFUeF7tnUlQHce+5m9H9LI7ovcdL+KtO7rv9Wxf+15LsmXJsyVf2xoYhNCE
BIh5FCAEmmeJSRKTZkADM0i6m168fb/127xedERv3+udd9nfl5XnqCgSgSSg6pzz/SN+IQfUOWRm5ffL
rDoF/oNKpVKpVCqVSqVSqVQqlUqlUqlUKpVKpVKpVCqVSqVSqVQqlUqlUqlUKpVKpVKpVCqVSqVSqVQq
lUqlUqlUKpVKpVKpVCqVSqVSqVQqlUqlUqlUKpVKpVKpVCqVSqVSqVQqlUqlUqlUKpVKpVKpVCrVcjVY
@@ -2072,7 +2072,7 @@
iVBORw0KGgoAAAANSUhEUgAAAJwAAADCCAYAAAC8PKvKAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAASZVJREFUeF7tvWdYVOfe//u8e86r/znXOdd5t0+7nv+zU/be2THN3ktsqGCjzQwg
+ DgAACw4BQL7hQQAASZVJREFUeF7tvWdYVOfe//u8e86r/znXOdd5t0+7nv+zU/be2THN3ktsqGCjzQwg
2Av2AoIoioJ0ZigmJrHEXqPR2LuI3ZhEw040MZqqJroVZtaQ+3y/91oLF8MaGGEo6tzX9b1msWbNMMz6
8Gt3+49Ae7GaKD/5X9phoAVa0zd3eWmMKC/9H9qPgRZoTduqykvjlfLSPtqPgRZoTddE+bH/s+qLY2Or
rp+ayGPtdKAFWtM0uNK/uK/si3KfWhMM1zpMOx1ogdY0zVV+to371PrhruLRbQNWLtCavLnLTwe5j3wQ
@@ -3194,7 +3194,7 @@
iVBORw0KGgoAAAANSUhEUgAAAOEAAADqCAYAAABUdCK5AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAA4VVJREFUeF7snQecJFW1//9GzO/pM6EooLB5FxQJgsiiT1BJAhIkiQTJOccl58zm
+ DgAACw4BQL7hQQAA4VVJREFUeF7snQecJFW1//9GzO/pM6EooLB5FxQJgsiiT1BJAhIkiQTJOccl58zm
nHOcvJNzzjn35O7pntiTu7vq/M85996qWz2zwPL0PdCpz+f3ObdqZmeHYb77O+fcUP9v+pq+PumXx+P5
anNz8/fa29sXdHZ2/u5Q6ujo+CV9Dn7+T+Qfnb6mr+nro14EGsFDMLW1td2K8WmEagNCtaerqyvW7XbH
er3euL6+vhipWG3M6u3tjcHPie3u7o7FPxeHf34JxtdQ10g4vyr/uulr+pq+CDgE42IE7gGCjUBDeBiy
@@ -4161,7 +4161,7 @@
iVBORw0KGgoAAAANSUhEUgAAANUAAADfCAYAAABh25blAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAAp5xJREFUeF7tnQd4HNXV/pNQbDA9lFBCCzZumCSEEkJxki89hDRSCCSEhIQQWmih
+ DgAACw4BQL7hQQAAp5xJREFUeF7tnQd4HNXV/pNQbDA9lFBCCzZumCSEEkJxki89hDRSCCSEhIQQWmih
m9477uAGBmyMC1Z1L3LvXS6SZUuWJUuW5G5LuzPzP+8pd+6sZJvvC/9gsOZ53ufcmV0vstif33POvXPn
c81H87GvH5WVla1Wr159QllZWafy8vLv7U7r1q37Jt5D7z9T/2jz0XzsvwfAAQyAo7S09EaKDxMkAwiS
oevXr8+rqKjIq6qqyq+trc1V5XljVk1NTS69J2/Dhg159Ofy6c93o/gc6RqFrZX+55qP5uOzdwAg+qL/
@@ -40402,25 +40402,13 @@
..\Resources\config2.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
-
- ..\Resources\secureux-arm64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\Resources\secureux-x64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\Resources\ThemeDll-arm64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\Resources\ThemeDll-x64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
..\Resources\7za.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
iVBORw0KGgoAAAANSUhEUgAAAMUAAADNCAYAAAAIa7SdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
- EAAACxABrSO9dQAAXEVJREFUeF7tnQd4FVX6//3p+l9F7HSQ3psCVpoo0jG00HsvoSVACAlJSELvHQRZ
+ DgAACw4BQL7hQQAAXEVJREFUeF7tnQd4FVX6//3p+l9F7HSQ3psCVpoo0jG00HsvoSVACAlJSELvHQRZ
+66rrrqr61pwRV0VsYMKAtIJNSGUhJCQe/7f7+G847mTmxAQQcO8z/N9zszcNnfm/Zz3fc+ZO/cazzzz
zDPPLrMppf7PLHrmWf4zOLhZym7WY/9nltkSCK3Y2NhrzbIGxTymzXqtZ5798czl0I7T5yYDBM1vO2Gw
3k9Ek9Yzz353Zjup48SyDl1rHF6igF62tvltp1yP2dLvyc8wrazrlhs98+xymuOQljPKsp/Tctk49nVc
@@ -40832,4 +40820,7 @@
..\Resources\themes.7z;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\Resources\ThemeDLL.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/Rectify11Installer/Rectify11Installer.csproj b/Rectify11Installer/Rectify11Installer.csproj
index 02f3716f0..86e383662 100644
--- a/Rectify11Installer/Rectify11Installer.csproj
+++ b/Rectify11Installer/Rectify11Installer.csproj
@@ -83,6 +83,28 @@
Rectify11Installer.Program
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE
+ true
+ full
+ x64
+ 9.0
+ prompt
+ empty.ruleset
+
+
+ bin\x64\Release\
+ TRACE
+ true
+ true
+ x64
+ false
+ On
+ 9.0
+ prompt
+
False
@@ -144,6 +166,7 @@
True
Resources.resx
+
@@ -356,6 +379,7 @@
Designer
+
diff --git a/Rectify11Installer/Rectify11Installer.csproj.user b/Rectify11Installer/Rectify11Installer.csproj.user
index adaeda6c9..c6d5fe995 100644
--- a/Rectify11Installer/Rectify11Installer.csproj.user
+++ b/Rectify11Installer/Rectify11Installer.csproj.user
@@ -1,16 +1,19 @@
-
- output\|publish\
-
-
-
-
-
- en-US
- false
-
-
- false
-
+
+ output\|publish\
+
+
+
+
+
+ en-US
+ false
+
+
+ false
+
+
+ true
+
\ No newline at end of file
diff --git a/Rectify11Installer/Resources/ThemeDll-arm64.dll b/Rectify11Installer/Resources/ThemeDll-arm64.dll
deleted file mode 100644
index 19cbd5a51..000000000
Binary files a/Rectify11Installer/Resources/ThemeDll-arm64.dll and /dev/null differ
diff --git a/Rectify11Installer/Resources/ThemeDll-x64.dll b/Rectify11Installer/Resources/ThemeDll-x64.dll
deleted file mode 100644
index f3dd43a6e..000000000
Binary files a/Rectify11Installer/Resources/ThemeDll-x64.dll and /dev/null differ
diff --git a/Rectify11Installer/Resources/ThemeDll.dll b/Rectify11Installer/Resources/ThemeDll.dll
new file mode 100644
index 000000000..9cb592a6f
Binary files /dev/null and b/Rectify11Installer/Resources/ThemeDll.dll differ
diff --git a/Rectify11Installer/Resources/secureux-arm64.exe b/Rectify11Installer/Resources/secureux-arm64.exe
deleted file mode 100644
index a5218c78e..000000000
Binary files a/Rectify11Installer/Resources/secureux-arm64.exe and /dev/null differ
diff --git a/Rectify11Installer/Resources/secureux-x64.exe b/Rectify11Installer/Resources/secureux-x64.exe
deleted file mode 100644
index 1c640b5ab..000000000
Binary files a/Rectify11Installer/Resources/secureux-x64.exe and /dev/null differ
diff --git a/Rectify11Installer/Win32/RectifyUtil.cs b/Rectify11Installer/Win32/RectifyUtil.cs
new file mode 100644
index 000000000..1496bb187
--- /dev/null
+++ b/Rectify11Installer/Win32/RectifyUtil.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Rectify11Installer.Win32
+{
+ // Helpers for installing themetool. The implementation of these functions can be found in rectify11cpl
+ [Guid("9CD66066-9784-4DA6-A27A-D322FC96D02E")]
+ [ComImport]
+ public class CRectifyUtil
+ {
+
+ }
+
+ [Guid("A7BCDC3B-C5A2-44BB-B8EC-560B24ACAAD8")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IRectifyUtil
+ {
+ public nint GetMicaSettings(ref bool enabled, ref bool tabbed);
+ public nint SetMicaForEveryoneEnabled(ref bool enabled, ref bool tabbed);
+ public nint GetCurrentMenuIndex(ref int index);
+ public nint SetCurrentMenuByIndex(ref int index);
+
+ public nint ApplyTheme(string themeName);
+ public nint InstallThemeTool();
+ public nint UninstallThemeTool();
+ }
+
+ public static class RectifyThemeUtil
+ {
+ private static IRectifyUtil utility = null;
+ public static IRectifyUtil Utility
+ {
+ get
+ {
+ if (utility == null)
+ {
+ Init();
+ }
+
+ return utility;
+ }
+ }
+ public static void Init()
+ {
+ if (utility == null)
+ {
+ utility = (IRectifyUtil)new CRectifyUtil();
+ }
+ }
+ }
+}
diff --git a/RectifyControlPanel2 b/RectifyControlPanel2
index 14c440f1f..5deb40555 160000
--- a/RectifyControlPanel2
+++ b/RectifyControlPanel2
@@ -1 +1 @@
-Subproject commit 14c440f1ffbd3d71f25e360848e067acf859be13
+Subproject commit 5deb40555793ffaa9c38b5c01c62f45cb8888d73
diff --git a/RectifyStart/RectifyStart.cpp b/RectifyStart/RectifyStart.cpp
index 50a5ac301..a8170f9d9 100644
--- a/RectifyStart/RectifyStart.cpp
+++ b/RectifyStart/RectifyStart.cpp
@@ -4,6 +4,8 @@
#include "framework.h"
#include "RectifyStart.h"
#include "..\RectifyControlPanel2\dui70\DirectUI\DirectUI.h"
+#include "..\RectifyControlPanel2\Rectify11CPL\Guid.h"
+#include "..\RectifyControlPanel2\Rectify11CPL\IRectifyUtil_h.h"
#pragma comment(lib,"dui70.lib")
using namespace DirectUI;
@@ -15,6 +17,7 @@ WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
HWNDElement* hwnd_element = NULL;
NativeHWNDHost* pwnd = NULL;
+static HWND hwnd = NULL;
struct EventListener : public IElementListener {
using handler_t = std::function;
@@ -85,6 +88,59 @@ bool GetStartup()
return false;
}
+void ApplyThemeIfNeeded()
+{
+ // Apply theme after rectify11 was installed. For more details see Rectify11Installer/Core/Backend/Themes.cs
+ HKEY Rectify11;
+ if (RegCreateKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Rectify11"), &Rectify11))
+ {
+ MessageBox(hwnd, TEXT("Failed to create rectify11 key"), TEXT("RectifyStart application"), MB_ICONERROR);
+ return;
+ }
+
+ // Buffer to store string read from registry
+ TCHAR szValue[1024];
+ DWORD cbValueLength = sizeof(szValue);
+
+ // Query string value
+ LSTATUS hr = RegQueryValueEx(
+ Rectify11,
+ TEXT("ApplyThemeOnNextRun"),
+ NULL,
+ NULL,
+ reinterpret_cast(&szValue),
+ &cbValueLength);
+ if (hr != ERROR_SUCCESS)
+ {
+ if (hr != ERROR_FILE_NOT_FOUND)
+ {
+ MessageBox(hwnd, TEXT("Failed to query ApplyThemeOnNextRun registry value. The rectify11 theme may not be applied correctly."), TEXT("RectifyStart application"), MB_ICONERROR);
+ }
+ return;
+ }
+
+ IRectifyUtil* util;
+ hr = CoCreateInstance(CLSID_CRectifyUtil, NULL, CLSCTX_INPROC_SERVER, IID_IRectifyUtil,
+ reinterpret_cast(&util));
+
+ if (util == NULL || hr != S_OK)
+ {
+ MessageBox(hwnd, TEXT("Failed to create CRectifyUtil COM Object when trying to apply theme. Please rerun the Rectify11 installer. If that doesn't work, report an issue on github."), TEXT("RectifyStart application: Critical error"), MB_ICONERROR);
+ return;
+ }
+
+ hr = util->ApplyTheme(szValue);
+ if (FAILED(hr))
+ {
+ MessageBox(hwnd, TEXT("Failed to apply the rectify11 theme."), TEXT("RectifyStart application"), MB_ICONERROR);
+ return;
+ }
+
+ util->Release();
+
+ // we are done
+ RegDeleteValue(Rectify11, TEXT("ApplyThemeOnNextRun"));
+}
void HandleCloseButton(Element* elem, Event* iev)
{
if (iev->type == TouchButton::Click)
@@ -139,7 +195,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
CW_USEDEFAULT, CW_USEDEFAULT, 880, 720,
0, WS_EX_TOOLWINDOW | WS_VISIBLE | WS_SYSMENU, 0, &pwnd);
- static HWND hwnd = pwnd->GetHWND();
+ hwnd = pwnd->GetHWND();
+
+ // apply theme after installation
+ ApplyThemeIfNeeded();
// Center the window on the screen
RECT rc;