Skip to content

Commit

Permalink
Merge branch 'Rectify11:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Typical0 authored Oct 14, 2023
2 parents 91d63e9 + 241953c commit 67634b2
Show file tree
Hide file tree
Showing 36 changed files with 1,166 additions and 1,478 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: true
lfs: true
- name: Git Sumbodule Update
run: |
git submodule update --init --recursive
git submodule update --recursive --remote
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Restore NuGet Packages
run: |
nuget restore Rectify11Installer.sln
nuget restore Rectify11ControlCenter\Rectify11ControlCenter.sln
- name: Build R11 Control Centre
run: msbuild Rectify11ControlCenter\Rectify11ControlCenter.sln /p:Configuration=Release
- name: Build
run: msbuild Rectify11Installer.sln /p:Configuration=Release /p:platform=x64
- name: Create single exe
Expand All @@ -41,4 +40,4 @@ jobs:
name: Rectify11Installer (x64)
# A file, directory or wildcard pattern that describes what to upload
path: Rectify11Installer\bin\output\Release\Rectify11Installer.exe


6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "RectifyControlPanel2"]
path = RectifyControlPanel2
url = https://github.com/Rectify11/RectifyControlPanel2.git
[submodule "rectify11controlcenter"]
path = rectify11controlcenter
url = https://github.com/ojask/rectify11controlcenter.git
5 changes: 3 additions & 2 deletions Rectify11.Phase2/Resources/rectify11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
<Patch Mui="msieftp.dll" mask="ICONGROUP," HardlinkTarget="%sys32%\msieftp.dll" />
<Patch Mui="msinfo32.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\msinfo32.exe" />
<Patch Mui="mshta.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\mshta.exe" />
<Patch Mui="msra.exe.mui" mask="ICONGROUP,|BITMAP," HardlinkTarget="%lang%\msra.exe" />
<Patch Mui="msra.exe.mui" mask="ICONGROUP,|BITMAP," HardlinkTarget="%lang%\msra.exe.mui" />
<Patch Mui="MultiDigiMon.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\MultiDigiMon.exe" />
<Patch Mui="Mystify.scr" mask="ICONGROUP," HardlinkTarget="%sys32%\Mystify.scr" />
<Patch Mui="ncpa.cpl" mask="ICONGROUP," HardlinkTarget="%sys32%\ncpa.cpl" />
Expand Down Expand Up @@ -319,7 +319,7 @@
<Patch Mui="repair-bde.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\repair-bde.exe" />
<Patch Mui="resmon.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\resmon.exe" />
<Patch Mui="Ribbons.scr" mask="ICONGROUP," HardlinkTarget="%sys32%\Ribbons.scr" />
<Patch Mui="rstrui.exe.mui" mask="ICONGROUP,|BITMAP," HardlinkTarget="%lang%\rstrui.exe.mui" />
<Patch Mui="rstrui.exe" mask="ICONGROUP,|BITMAP," HardlinkTarget="%sys32%\rstrui.exe" />
<Patch Mui="runonce.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\runonce.exe" />
<Patch Mui="sapi.cpl" mask="ICONGROUP," HardlinkTarget="%sys32%\Speech\SpeechUX\sapi.cpl" />
<Patch Mui="sberes.dll" mask="ICONGROUP," HardlinkTarget="%sys32%\sberes.dll" />
Expand Down Expand Up @@ -377,6 +377,7 @@
<Patch Mui="SystemPropertiesRemote.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\SystemPropertiesRemote.exe" />
<Patch Mui="tabcal.exe" mask="ICONGROUP," HardlinkTarget="%sys32%\tabcal.exe" />
<Patch Mui="TabletPC.cpl" mask="ICONGROUP," HardlinkTarget="%sys32%\TabletPC.cpl" />
<Patch Mui="Taskbar.dll" mask="ICONGROUP," HardlinkTarget="%sys32%\Taskbar.dll" />
<Patch Mui="taskbarcpl.dll" mask="ICONGROUP," HardlinkTarget="%sys32%\taskbarcpl.dll" />
<Patch Mui="tcpmonui.dll" mask="BITMAP," HardlinkTarget="%sys32%\tcpmonui.dll" />
<Patch Mui="telephon.cpl" mask="ICONGROUP," HardlinkTarget="%sys32%\telephon.cpl" />
Expand Down
8 changes: 0 additions & 8 deletions Rectify11Installer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
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}"
ProjectSection(ProjectDependencies) = postProject
{0B7DE49A-33C6-41B1-A9CE-D353031F8454} = {0B7DE49A-33C6-41B1-A9CE-D353031F8454}
{50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A} = {50A4AEC2-9A0D-4F1C-8F38-EE7542BBE81A}
EndProjectSection
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
Expand Down
4 changes: 2 additions & 2 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, "wsudo.exe"), Properties.Resources.wsudo, Helper.OperationType.Write))
if (!Helper.SafeFileOperation(Path.Combine(Variables.r11Folder, "NSudoL.exe"), Properties.Resources.NSudoL, 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,7 +235,7 @@ 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, "wsudo.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "NSudoL.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.exe"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "ResourceHacker.ini"));
Helper.SafeFileDeletion(Path.Combine(Variables.r11Folder, "Rectify11.Phase2.exe"));
Expand Down
42 changes: 36 additions & 6 deletions Rectify11Installer/Core/Backend/Icons.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualBasic;
using KPreisser.UI;
using Microsoft.VisualBasic;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -96,7 +97,7 @@ public static bool Install(FrmWizard frm)
if (InstallOptions.iconsList.Contains("mmc.exe.mui"))
{
if (!MMCHelper.PatchAll())
return false;;
return false;
}

if (InstallOptions.iconsList.Contains("odbcad32.exe"))
Expand All @@ -108,7 +109,9 @@ public static bool Install(FrmWizard frm)
// reg files for various file extensions
Helper.ImportReg(Path.Combine(Variables.r11Files, "icons.reg"));

Variables.RestartRequired = true;
ClearIconCache();

Variables.RestartRequired = true;
Logger.WriteLine("Icons.Install() succeeded.");
Logger.WriteLine("══════════════════════════════════════════════");
return true;
Expand Down Expand Up @@ -143,7 +146,7 @@ public static bool Uninstall()
}

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

Logger.WriteLine("Icons.Uninstall() succeeded.");
Logger.WriteLine("══════════════════════════════════════════════");
Expand Down Expand Up @@ -329,8 +332,35 @@ private static bool MatchAndApplyRule(PatchesPatch patch)
return true;
}

#region Internal functions
private static void PatchCmd(PatchType type, string filename, string name, string tempfolder, string filepath, string mask)
/// <summary>
/// clears *.db cache files
/// </summary>
private static void ClearIconCache()
{
try
{
DirectoryInfo di = new(Path.Combine(GetFolderPath(SpecialFolder.LocalApplicationData), "microsoft", "windows", "explorer"));
var files = di.GetFiles("*.db");

for (var i = 0; i < files.Length; i++)
{
files[i].Attributes = FileAttributes.Normal;
if (File.Exists(files[i].FullName))
{
Helper.SafeFileDeletion(files[i].FullName);
}
}
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", true);
key?.SetValue("ResetIconCache", Path.Combine(Variables.sys32Folder, "ie4uinit.exe") + " -show", RegistryValueKind.String);
key.Close();
}
catch (Exception ex)
{
Logger.Warn("Clearing icon cache failed", ex);
}
}
#region Internal functions
private static void PatchCmd(PatchType type, string filename, string name, string tempfolder, string filepath, string mask)
{
if (type == PatchType.x86)
{
Expand Down
19 changes: 3 additions & 16 deletions Rectify11Installer/Core/Backend/Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public bool Install(FrmWizard frm)
{
try
{
frm.InstallerProgress = "Begin creating a restore point";
CreateSystemRestorePoint(false);
frm.InstallerProgress = "Creating a restore point";
CreateSystemRestorePoint();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -87,22 +87,9 @@ public bool Install(FrmWizard frm)
frm.InstallerProgress = "Creating uninstaller";
Common.CreateUninstall();

InstallStatus.IsRectify11Installed = true;
InstallStatus.IsRectify11Installed = true;
Logger.WriteLine("══════════════════════════════════════════════");

if (Variables.CreateRestorePoint)
{
try
{
frm.InstallerProgress = "End creating a restore point";
CreateSystemRestorePoint(true);
}
catch
{
//ignored
}
}

// cleanup
frm.InstallerProgress = "Cleaning up...";
Common.Cleanup();
Expand Down
109 changes: 73 additions & 36 deletions Rectify11Installer/Core/Backend/Themes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,19 @@ public static bool Install()

// 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.SafeFileOperation(Path.Combine(Variables.r11Files, "mmc.exe.manifest"), Path.Combine(Variables.sys32Folder, "mmc.exe.manifest"), Helper.OperationType.Copy);
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.");
Expand Down Expand Up @@ -192,19 +204,15 @@ private static bool InstallThemes()
public static void InstallR11Cpl()
{
UninstallR11Cpl();
string cplPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");

//create files
Directory.CreateDirectory(Path.Combine(Variables.r11Folder, "Rectify11CPL"));

File.WriteAllBytes(cplPath, Properties.Resources.Rectify11CPL);
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.Rectify11CPL);

// create shortcut
using ShellLink shortcut = new();
shortcut.Target = Path.Combine(Variables.sys32Folder, "control.exe");
shortcut.Arguments = "/name Rectify11.SettingsCPL";
shortcut.WorkingDirectory = @"%windir%\system32";
shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11CPL", "Rectify11CPL.dll");
shortcut.Target = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe");
shortcut.WorkingDirectory = @"%windir%\Rectify11\Rectify11ControlCenter";
shortcut.IconPath = Path.Combine(Variables.r11Folder, "Rectify11ControlCenter", "Rectify11ControlCenter.exe");
shortcut.IconIndex = 0;
shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;

Expand All @@ -219,18 +227,7 @@ public static void InstallR11Cpl()
Logger.Warn("Error while saving shortcut: " + ex);
}
shortcut.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rectify11 Control Center.lnk"));

// 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);
}

}
/// <summary>
/// uninstalls control center
Expand All @@ -245,19 +242,22 @@ private static void UninstallR11Cpl()
Helper.SafeFileDeletion(startmenuShortcut);
Helper.SafeFileDeletion(desktopShortcut);

if (!File.Exists(cplPath)) return;

// 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)
if (File.Exists(cplPath))
{
Logger.Warn("Error while unregistering CPL: " + proc.ExitCode);
// 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);
Expand All @@ -278,6 +278,7 @@ private static void InstallMfe()
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";
Expand Down Expand Up @@ -392,7 +393,8 @@ private static bool UninstallMsstyles()
"black.theme",
"darkcolorized.theme",
"darkrectified.theme",
"lightrectified.theme"
"lightrectified.theme",
"darkpartial.theme"
};
try
{
Expand Down Expand Up @@ -436,7 +438,7 @@ private static bool InstallMsstyles()
{
try
{
if (Environment.OSVersion.Version.Build >= 22543
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));
Expand Down Expand Up @@ -474,6 +476,41 @@ private static bool UninstallMfe()
}
catch { return false; }
}

/// <summary>
/// applies the theme just before restart to set the mouse cursor properly
/// </summary>
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
}
}
Loading

0 comments on commit 67634b2

Please sign in to comment.