diff --git a/.gitignore b/.gitignore index b79b5b327..81940c78c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ Rectify11.Phase2.exe *.pdb *.config *.exe +x64/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index c24e6bb5b..ab13db36a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "Rectify11ControlCenter"] - path = Rectify11ControlCenter - url = https://github.com/ojask/Rectify11ControlCenter.git +[submodule "RectifyControlPanel2"] + path = RectifyControlPanel2 + url = https://github.com/Rectify11/RectifyControlPanel2.git diff --git a/Rectify11ControlCenter b/Rectify11ControlCenter deleted file mode 160000 index 4b5196464..000000000 --- a/Rectify11ControlCenter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4b5196464cdd3e6dc43494024328f511f6e88f16 diff --git a/Rectify11Installer.sln b/Rectify11Installer.sln index 7d3e87f19..9650d1375 100644 --- a/Rectify11Installer.sln +++ b/Rectify11Installer.sln @@ -1,12 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33027.164 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rectify11Installer", "Rectify11Installer\Rectify11Installer.csproj", "{F1F7B13F-9EF7-4B77-9500-B062CC9DB17D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rectify11.Phase2", "Rectify11.Phase2\Rectify11.Phase2.csproj", "{8D66B017-3A76-439B-847B-C7379191E109}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rectify11CPL", "RectifyControlPanel2\Rectify11CPL\Rectify11CPL.vcxproj", "{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectUI", "RectifyControlPanel2\dui70\DirectUI\DirectUI.vcxproj", "{0B7DE49A-33C6-41B1-A9CE-D353031F8454}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +50,38 @@ Global {8D66B017-3A76-439B-847B-C7379191E109}.Release|Win32.ActiveCfg = Release|Any CPU {8D66B017-3A76-439B-847B-C7379191E109}.Release|x64.ActiveCfg = Release|Any CPU {8D66B017-3A76-439B-847B-C7379191E109}.Release|x64.Build.0 = Release|Any CPU + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Any CPU.ActiveCfg = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Any CPU.Build.0 = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Win32.ActiveCfg = Debug|Win32 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|Win32.Build.0 = Debug|Win32 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|x64.ActiveCfg = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Debug|x64.Build.0 = Debug|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Any CPU.ActiveCfg = Release|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Any CPU.Build.0 = Release|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Mixed Platforms.Build.0 = Release|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Win32.ActiveCfg = Release|Win32 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|Win32.Build.0 = Release|Win32 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|x64.ActiveCfg = Release|x64 + {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}.Release|x64.Build.0 = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Any CPU.ActiveCfg = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Any CPU.Build.0 = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Mixed Platforms.Build.0 = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Win32.ActiveCfg = Debug|Win32 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|Win32.Build.0 = Debug|Win32 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|x64.ActiveCfg = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Debug|x64.Build.0 = Debug|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Any CPU.ActiveCfg = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Any CPU.Build.0 = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Mixed Platforms.ActiveCfg = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Mixed Platforms.Build.0 = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Win32.ActiveCfg = Release|Win32 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|Win32.Build.0 = Release|Win32 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|x64.ActiveCfg = Release|x64 + {0B7DE49A-33C6-41B1-A9CE-D353031F8454}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Rectify11Installer/Core/Backend/Themes.cs b/Rectify11Installer/Core/Backend/Themes.cs index 988a1d9fe..f221f402a 100644 --- a/Rectify11Installer/Core/Backend/Themes.cs +++ b/Rectify11Installer/Core/Backend/Themes.cs @@ -56,7 +56,7 @@ public static bool Install() try { - Installr11cpl(); + InstallR11Cpl(); Logger.WriteLine("Installr11cpl() succeeded."); } catch (Exception ex) @@ -92,7 +92,8 @@ public static bool Uninstall() return false; string mode = Theme.IsUsingDarkMode ? "dark.theme" : "aero.theme"; - Process.Start(Path.Combine(Variables.Windir, "Resources", "Themes", mode)); + 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); @@ -130,10 +131,7 @@ public static bool Uninstall() } catch { } - // nuke r11cp - Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk")); - Helper.SafeFileDeletion(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk")); - Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false); + UninstallR11Cpl(); Logger.WriteLine("Deleted Rectify11 Control Center"); Logger.WriteLine("Uninstall() succeeded"); @@ -184,23 +182,79 @@ private static bool InstallThemes() /// /// installs control center /// - private static void Installr11cpl() + private static void InstallR11Cpl() { - Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter"), false); - Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter")); - File.WriteAllBytes(Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"), Properties.Resources.Rectify11ControlCenter); + string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll"); + + //create files + Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false); + Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11CPL")); + + File.WriteAllBytes(cplPath, Properties.Resources.Rectify11CPL); + + // create shortcut using ShellLink shortcut = new(); - shortcut.Target = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"); - shortcut.WorkingDirectory = @"%windir%\Rectify11\Rectify11ControlCenter"; - shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe"); + shortcut.Target = "shell:::{542EEE1B-A254-46F7-B980-35BECF6076A4}"; + shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll"); shortcut.IconIndex = 0; shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal; - string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk"); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - shortcut.Save(path); + + string startmenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Windows", "Start Menu", "Programs", "Rectify11 Control Center.lnk"); + if (!Directory.Exists(startmenu)) + Directory.CreateDirectory(startmenu); + try + { + shortcut.Save(startmenu); + } + catch (Exception ex) + { + Logger.WriteLine("Error while saving shortcut: " + ex); + } shortcut.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk")); + shortcut.Dispose(); + + // register CPL + var proc = new Process(); + proc.StartInfo.FileName = "regsvr32.exe"; + proc.StartInfo.Arguments = "/s \"" + cplPath + "\""; + proc.Start(); + proc.WaitForExit(); + + if (proc.ExitCode != 0) + { + 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 + if (File.Exists(startmenuShortcut)) + File.Delete(startmenuShortcut); + if (File.Exists(desktopShortcut)) + File.Delete(desktopShortcut); + + // 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.WriteLine("Error while unregistering CPL: " + proc.ExitCode); + } + + //delete folder + Helper.SafeDirectoryDeletion(Path.Combine(Variables.r11Folder, "Rectify11CPL"), false); } /// diff --git a/Rectify11Installer/Properties/Resources1.Designer.cs b/Rectify11Installer/Properties/Resources.Designer.cs similarity index 99% rename from Rectify11Installer/Properties/Resources1.Designer.cs rename to Rectify11Installer/Properties/Resources.Designer.cs index 9e29f6923..a7c789ce4 100644 --- a/Rectify11Installer/Properties/Resources1.Designer.cs +++ b/Rectify11Installer/Properties/Resources.Designer.cs @@ -683,9 +683,9 @@ internal static System.Drawing.Bitmap perf { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] Rectify11ControlCenter { + internal static byte[] Rectify11CPL { get { - object obj = ResourceManager.GetObject("Rectify11ControlCenter", resourceCulture); + object obj = ResourceManager.GetObject("Rectify11CPL", resourceCulture); return ((byte[])(obj)); } } diff --git a/Rectify11Installer/Properties/Resources.resx b/Rectify11Installer/Properties/Resources.resx index 4bb0dbdeb..2d30ce30e 100644 --- a/Rectify11Installer/Properties/Resources.resx +++ b/Rectify11Installer/Properties/Resources.resx @@ -2497,8 +2497,8 @@ ..\Resources\extras.7z;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Rectify11ControlCenter.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\Rectify11CPL.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/Rectify11Installer/Rectify11Installer.csproj b/Rectify11Installer/Rectify11Installer.csproj index c58acc9d3..d80ea9b23 100644 --- a/Rectify11Installer/Rectify11Installer.csproj +++ b/Rectify11Installer/Rectify11Installer.csproj @@ -138,6 +138,11 @@ + + True + True + Resources.resx + @@ -214,11 +219,6 @@ - - True - True - Resources.resx - True True @@ -236,7 +236,7 @@ ResXFileCodeGenerator Designer - Resources1.Designer.cs + Resources.Designer.cs ResXFileCodeGenerator diff --git a/RectifyControlPanel2 b/RectifyControlPanel2 new file mode 160000 index 000000000..fdfdf7423 --- /dev/null +++ b/RectifyControlPanel2 @@ -0,0 +1 @@ +Subproject commit fdfdf74239ccb0de20ddaf54f9de9ce62544e099