Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
reworked WD tweak for NSudo & fix unhandled exceptions in UI updates & #58
Greedeks242d4cadca10
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 2856d23e..ce185313 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -565,6 +565,7 @@<None Include="packages.config" /><None Include="Resources\Blank.gz" /><None Include="Resources\hosts.gz" />+ <None Include="Resources\NSudoLC.gz" /><None Include="Resources\UltPower.gz" /><Resource Include="Assets\Font\Jura-Medium.ttf" /><None Include="app.manifest" />diff --git a/.Source/GTweak/Properties/Resources.Designer.cs b/.Source/GTweak/Properties/Resources.Designer.csindex 71422e31..87811714 100644--- a/.Source/GTweak/Properties/Resources.Designer.cs+++ b/.Source/GTweak/Properties/Resources.Designer.cs@@ -80,6 +80,16 @@ namespace GTweak.Properties {}}+ /// <summary>+ /// Поиск локализованного ресурса типа System.Byte[].+ /// </summary>+ internal static byte[] NSudoLC {+ get {+ object obj = ResourceManager.GetObject("NSudoLC", resourceCulture);+ return ((byte[])(obj));+ }+ }+/// <summary>/// Поиск локализованного ресурса типа System.IO.UnmanagedMemoryStream, аналогичного System.IO.MemoryStream./// </summary>@@ -96,7 +106,7 @@ namespace GTweak.Properties {/// <product>KMS</product>/// <content>/// <![CDATA[- /// <?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>OA3xOriginalProductId=;OA3xOriginalProductKey=;SessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAVgBlAHIAcwBpAG8AbgA9ADEAOwBPAFMAUABsAGEAdABmAG8AcgBtAEkAZAA9ADIAOwBQAFAAPQAwADsARw [остаток строки не уместился]";.+ /// <?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>OA3xOriginalProductId=;OA3xOriginalProductKey=;SessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAVgBlAHIAcwBpAG8AbgA9ADEAOwBPAFMAUABsAGEAdABmAG8AcgBtAEkAZAA9ADIAOwBQAFAAPQAw [остаток строки не уместился]";./// </summary>internal static string Tickets {get {diff --git a/.Source/GTweak/Properties/Resources.resx b/.Source/GTweak/Properties/Resources.resxindex 11c84045..acbfc033 100644--- a/.Source/GTweak/Properties/Resources.resx+++ b/.Source/GTweak/Properties/Resources.resx@@ -124,6 +124,9 @@<data name="hosts" type="System.Resources.ResXFileRef, System.Windows.Forms"><value>..\Resources\hosts.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>+ <data name="NSudoLC" type="System.Resources.ResXFileRef, System.Windows.Forms">+ <value>..\Resources\NSudoLC.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>+ </data><data name="Sound" type="System.Resources.ResXFileRef, System.Windows.Forms"><value>..\Resources\Sound.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>diff --git a/.Source/GTweak/Resources/NSudoLC.gz b/.Source/GTweak/Resources/NSudoLC.gznew file mode 100644index 00000000..e54e0d29Binary files /dev/null and b/.Source/GTweak/Resources/NSudoLC.gz differdiff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Utilities/Controls/PathLocator.csindex 25084431..b979ffec 100644--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs+++ b/.Source/GTweak/Utilities/Controls/PathLocator.cs@@ -13,6 +13,14 @@ namespace GTweak.Utilities.Controlsinternal static readonly string SystemDrive = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));internal static readonly string DefenderBackup = Path.Combine(Environment.SystemDirectory, "Config", "WDBackup_GTweak");++ internal static readonly string WindowsDefender = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Defender");++ internal static readonly string WindowsDefenderX86 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows Defender");++ internal static readonly string WindowsOld = Path.Combine(SystemDrive, "Windows.old");++ internal static readonly string Tasks = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "Tasks");}internal static class Executable@@ -40,6 +48,8 @@ namespace GTweak.Utilities.Controlsinternal static readonly string Explorer = FindExecutablePath("explorer.exe");internal static readonly string OneDrive = FindExecutablePath("onedrivesetup.exe");++ internal static readonly string NSudo = Path.Combine(Folders.DefenderBackup, "NSudoLC.exe");}internal static class Files@@ -57,10 +67,6 @@ namespace GTweak.Utilities.Controlsinternal static readonly string BackupDataJson = Path.Combine(Folders.DefenderBackup, "BackupData.json");internal static readonly string BackupRightsAcl = Path.Combine(Folders.DefenderBackup, "BackupRights.acl");-- internal static readonly string WindowsOld = Path.Combine(Folders.SystemDrive, "Windows.old");-- internal static readonly string Tasks = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "Tasks");}internal static class Registrydiff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.csindex 141a7dbc..57f2b1b7 100644--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs@@ -8,8 +8,6 @@ namespace GTweak.Utilities.Helpers{internal sealed class RegistryHelp : TakingOwnership{- private static readonly SE_OBJECT_TYPE objectType = Environment.Is64BitOperatingSystem ? SE_OBJECT_TYPE.SE_REGISTRY_KEY : SE_OBJECT_TYPE.SE_REGISTRY_WOW64_32KEY;-private static string GeneralRegistry(RegistryKey registrykey){return registrykey.Name switch@@ -32,7 +30,7 @@ namespace GTweak.Utilities.Helperstry{if (isTakingOwner)- GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", objectType);+ GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);registrykey.OpenSubKey(subkey, true)?.DeleteValue(value);}@@ -47,7 +45,7 @@ namespace GTweak.Utilities.Helperstry{if (isTakingOwner)- GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", objectType);+ GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);registrykey.CreateSubKey(subkey, true)?.SetValue(name, data, kind);}@@ -71,7 +69,7 @@ namespace GTweak.Utilities.Helperstry{if (isTakingOwner)- GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", objectType);+ GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);RegistryKey registryFolder = registrykey.OpenSubKey(subkey, true);diff --git a/.Source/GTweak/Utilities/Helpers/TakingOwnership.cs b/.Source/GTweak/Utilities/Helpers/TakingOwnership.csindex 38725350..4b1572a1 100644--- a/.Source/GTweak/Utilities/Helpers/TakingOwnership.cs+++ b/.Source/GTweak/Utilities/Helpers/TakingOwnership.cs@@ -1,5 +1,4 @@using System;-using System.Diagnostics;using System.Runtime.InteropServices;using System.Threading.Tasks;@@ -106,7 +105,6 @@ namespace GTweak.Utilities.HelpersDENY_ACCESS}- private const string SE_DEBUG_NAME = "SeDebugPrivilege";private const string SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege";private static SID_IDENTIFIER_AUTHORITY SECURITY_NT_AUTHORITY =new SID_IDENTIFIER_AUTHORITY() { Value = new byte[] { 0, 0, 0, 0, 0, 5 } };@@ -185,23 +183,6 @@ namespace GTweak.Utilities.HelpersIntPtr OldAcl,ref IntPtr NewAcl);- internal static bool GrantDebugPrivilege()- {- if (!OpenProcessToken(Process.GetCurrentProcess().Handle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, out IntPtr hToken))- return false;-- if (!LookupPrivilegeValueA(null, SE_DEBUG_NAME, out LUID luid))- return false;-- TOKEN_PRIVILEGES tp;- tp.PrivilegeCount = 1;- tp.Privileges = new LUID_AND_ATTRIBUTES[1];- tp.Privileges[0].Luid = luid;- tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;-- return AdjustTokenPrivileges(hToken, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);- }-internal static void GrantAdministratorsAccess(string name, SE_OBJECT_TYPE type){Task.Run(delegatediff --git a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.csindex a097f78c..f7d5c66c 100644--- a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs+++ b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs@@ -94,7 +94,7 @@ namespace GTweak.Utilities.Managersinternal static string GetTaskFullPath(string partialName){- string[] files = Directory.GetFiles(PathLocator.Files.Tasks, "*", SearchOption.AllDirectories);+ string[] files = Directory.GetFiles(PathLocator.Folders.Tasks, "*", SearchOption.AllDirectories);string matchPath = files.FirstOrDefault(path => Path.GetFileName(path).IndexOf(partialName, StringComparison.OrdinalIgnoreCase) >= 0);if (!string.IsNullOrWhiteSpace(matchPath))@@ -109,7 +109,7 @@ namespace GTweak.Utilities.Managersforeach (string path in tasklist){- if (File.Exists(Path.Combine(PathLocator.Files.Tasks, path.TrimStart('\\', '/').Replace('/', '\\'))))+ if (File.Exists(Path.Combine(PathLocator.Folders.Tasks, path.TrimStart('\\', '/').Replace('/', '\\'))))foundExisting.Add(path);}diff --git a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.csindex 24f76c9e..66fe2fbb 100644--- a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs+++ b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs@@ -50,7 +50,7 @@ namespace GTweak.Utilities.Tweaksinternal class ClearingMemory{- internal static bool IsWinOldExists => Directory.Exists(PathLocator.Files.WindowsOld);+ internal static bool IsWinOldExists => Directory.Exists(PathLocator.Folders.WindowsOld);private const int SE_PRIVILEGE_ENABLED = 2;private const string SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege";@@ -185,7 +185,7 @@ namespace GTweak.Utilities.Tweaksif (shouldRemoveWinOld){- string dir = PathLocator.Files.WindowsOld;+ string dir = PathLocator.Folders.WindowsOld;CommandExecutor.RunCommandAsTrustedInstaller($"/c takeown /f \"{dir}\"");CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{dir}\" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18");CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{dir}\" /grant {Environment.UserName}:F");diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.csindex 909bee7a..896d57df 100644--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs@@ -44,12 +44,6 @@ namespace GTweak.Utilities.Tweaks.DefenderManager{ @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational", Registry.LocalMachine },{ @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Security-Diagnostic/Operational", Registry.LocalMachine },{ @"SOFTWARE\Microsoft\Windows Defender\Cloud", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MpCmdRun.exe", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MpCopyAccelerator.exe", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\smartscreen.exe", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\SgrmBroker.exe", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MsMpEng.exe", Registry.LocalMachine },- { @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MpDefenderCoreService.exe", Registry.LocalMachine },{ @"Software\Microsoft\Edge", Registry.CurrentUser },};@@ -91,7 +85,6 @@ namespace GTweak.Utilities.Tweaks.DefenderManager}}-internal static void ImportRights(){if (File.Exists(PathLocator.Files.BackupDataJson) && File.Exists(PathLocator.Files.BackupRightsAcl))diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.csindex 5c795d88..7783df0c 100644--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs@@ -12,6 +12,26 @@ namespace GTweak.Utilities.Tweaks.DefenderManager{internal class WindowsDefender : BackupRights{+ private static readonly Dictionary<string, string> services = new Dictionary<string, string>+ {+ { "WinDefend", "2" },+ { "SecurityHealthService", "2"},+ { "Sense", "3" },+ { "SgrmAgent", "3" },+ { "SgrmBroker", "3" },+ { "MDCoreSvc", "3" },+ { "MsSecCore", "3" },+ { "MsSecFlt", "3" },+ { "MsSecWfp", "3" },+ { "WdFilter", "0" },+ { "WdBoot", "0" },+ { "WdNisDrv", "3" },+ { "WdNisSvc", "3"},+ { "webthreatdefsvc", "3" },+ { "webthreatdefusersvc", "3" },+ { "wscsvc", "3" }+ };+internal static void SetProtectionState(bool isDisabled){if (isDisabled)@@ -22,10 +42,31 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerprivate static void Activate(){- CommandExecutor.RunCommandAsTrustedInstaller("/c reg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /v EnableWebContentEvaluation /f & " +- "reg delete HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /v SmartScreenEnabled /f & " +- "reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter /v EnabledV9 /f & " +- "reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System /v EnableSmartScreen /f & " ++ foreach (var (filePath, originalFileName) in new (string filePath, string originalFileName)[]+ {+ (Path.Combine(PathLocator.Folders.SystemDrive, "Windows", "System32", "BlockSS.exe"), "smartscreen.exe"),+ (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "BlockAntimalware.exe"), "MsMpEng.exe"),+ (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "BlockAntimalwareCore.exe"), "MpDefenderCoreService.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockMpCmdRun.exe"), "MpCmdRun.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockMpCopyAccelerator.exe"), "MpCopyAccelerator.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockDlpUserAgent.exe"), "DlpUserAgent.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockMpDlpCmd.exe"), "MpDlpCmd.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockMpDlpService.exe"), "MpDlpService.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "Blockmpextms.exe"), "mpextms.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockNisSrv.exe"), "NisSrv.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "BlockConfigSecurityPolicy.exe"), "ConfigSecurityPolicy.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefenderX86, "BlockMpCmdRun.exe"), "MpCmdRun.exe"),+ })+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{filePath}\" {originalFileName}");++ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalware.exe\" ren \"%D\\BlockAntimalware.exe\" MsMpEng.exe");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalwareCore.exe\" ren \"%D\\BlockAntimalwareCore.exe\" MpDefenderCoreService.exe");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "BlockWindowsDefenderATP")}\" \"Windows Defender Advanced Threat Protection\"");++ CommandExecutor.RunCommandAsTrustedInstaller("/c reg delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost\" /v EnableWebContentEvaluation /f & " ++ "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\" /v SmartScreenEnabled /f & " ++ "reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter\" /v EnabledV9 /f & " ++ "reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v EnableSmartScreen /f & " +"reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /v DisableAntiSpyware /f & " +"reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /v DisableAntiVirus /f & " +"reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SmartScreen\" /v ConfigureAppInstallControl /f & " +@@ -41,19 +82,12 @@ namespace GTweak.Utilities.Tweaks.DefenderManager"reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableBehaviorMonitoring /f & " +"reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableIntrusionPreventionSystem /f & " +"reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableRealtimeMonitoring /f & " +- "reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT /v DontOfferThroughWUA /f & " +- "reg delete HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT /v DontReportInfectionInformation /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\" / t REG_DWORD /v PUAProtection /d 2 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /t REG_DWORD /v SpyNetReporting /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /t REG_DWORD /v SubmitSamplesConsent /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /t REG_DWORD /v TamperProtection /d 1 /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpDefenderCoreService.exe\" /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\SgrmBroker.exe\" /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\smartscreen.exe\" /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCmdRun.exe\" /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCopyAccelerator.exe\" /f & " +- "reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MsMpEng.exe\" /v Debugger /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MsMpEng.exe\" /t REG_DWORD /v CFGOptions /d 1 /f");+ "reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT\" /v DontOfferThroughWUA /f & " ++ "reg delete \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT\" /v DontReportInfectionInformation /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\" /v PUAProtection /t REG_DWORD /d 2 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /v SpyNetReporting /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /v SubmitSamplesConsent /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /v TamperProtection /t REG_DWORD /d 0 /f");RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled", "On", RegistryValueKind.String);@@ -124,53 +158,24 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerRegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "SecurityHealth", new byte[] { 0002, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }, RegistryValueKind.Binary);RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender", "\"%ProgramFiles%\\Windows Defender\\MSASCui.exe\"-runkey", RegistryValueKind.String);- ManageServices(false);-- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "Start", "2", RegistryValueKind.DWord, true);- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "AutorunsDisabled");- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SecurityHealthService", "Start", "2", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Features", "TamperProtection", "0", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SgrmAgent", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SgrmBroker", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdFilter", "Start", "0", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdBoot", "Start", "0", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisDrv", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisSvc", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MDCoreSvc", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecCore", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecFlt", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecWfp", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\webthreatdefsvc", "Start", "3", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\webthreatdefusersvc", "Start", "3", RegistryValueKind.DWord, true);-ManageExclusions(false);- foreach (var (filePath, originalFileName) in new (string filePath, string originalFileName)[]- {- (Path.Combine(PathLocator.Folders.SystemDrive, "Windows", "System32", "BlockSS.exe"), "smartscreen.exe"),- (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "BlockAntimalware.exe"), "MsMpEng.exe"),- (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "BlockAntimalwareCore.exe"), "MpDefenderCoreService.exe")- })- {- string newFilePath = Path.Combine(Path.GetDirectoryName(filePath), originalFileName);- CommandExecutor.RunCommandAsTrustedInstaller($"/c rename \"{filePath}\" {originalFileName}");- CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{newFilePath}\" /reset");- CommandExecutor.RunCommandAsTrustedInstaller($"/c takeown /f \"{newFilePath}\" /a");- CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{newFilePath}\" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464");- }- CommandExecutor.RunCommandAsTrustedInstaller($"/c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalware.exe\" ren \"%D\\BlockAntimalware.exe\" MsMpEng.exe");- CommandExecutor.RunCommandAsTrustedInstaller($"/c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalwareCore.exe\" ren \"%D\\BlockAntimalwareCore.exe\" MpDefenderCoreService.exe");-- SetTaskState(true, winDefenderTasks);- RunPowerShellCommand(@"Get-AppXpackage Microsoft.WindowsDefender | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register ""$($_.InstallLocation)\AppXManifest.xml""}");-RegistryHelp.Write(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);RegistryHelp.Write(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);RegistryHelp.Write(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "", PathLocator.Folders.SystemDrive + @"Program Files\Windows Defender\shellext.dll", RegistryValueKind.String);RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "ThreadingModel", "Apartment", RegistryValueKind.String);+ foreach (var service in services)+ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\{service.Key} /v Start /t REG_DWORD /d {service.Value} /f");++ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 0 /f");+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 0 /f");+ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /t REG_SZ /d 328010 /f");++ SetTaskState(true, winDefenderTasks);+ RunPowerShellCommand(@"Get-AppXpackage Microsoft.WindowsDefender | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register ""$($_.InstallLocation)\AppXManifest.xml""}");+ImportRights();}@@ -178,27 +183,40 @@ namespace GTweak.Utilities.Tweaks.DefenderManager{ExportRights();- KillProcess(new[] { "smartscreen", "MpDefenderCoreService", "MsMpEng", "SecurityHealthService", "SecurityHealthSystray", "wuauserv", "SearchUI", "RuntimeBroker", "msedge", "ssoncom", "usocoreworker" });+ KillProcess(new[] { "smartscreen", "MpDefenderCoreService", "MsMpEng", "SecurityHealthService", "SecurityHealthSystray", "SecurityHealthUI", "wuauserv", "SearchUI", "SecHealthUI", "RuntimeBroker", "msedge", "ssoncom", "usocoreworker" });foreach (var (filePath, newFileName) in new (string filePath, string newFileName)[]{(Path.Combine(PathLocator.Folders.SystemDrive, "Windows", "System32", "smartscreen.exe"), "BlockSS.exe"),- (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "MsMpEng.exe"), "BlockAntimalware.exe"),- (Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "Windows Defender", "MpDefenderCoreService.exe"), "BlockAntimalwareCore.exe")+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MsMpEng.exe"), "BlockAntimalware.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MpDefenderCoreService.exe"), "BlockAntimalwareCore.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MpCmdRun.exe"), "BlockMpCmdRun.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MpCopyAccelerator.exe"), "BlockMpCopyAccelerator.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "DlpUserAgent.exe"), "BlockDlpUserAgent.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MpDlpCmd.exe"), "BlockMpDlpCmd.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "MpDlpService.exe"), "BlockMpDlpService.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "mpextms.exe"), "Blockmpextms.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "NisSrv.exe"), "BlockNisSrv.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefender, "ConfigSecurityPolicy.exe"), "BlockConfigSecurityPolicy.exe"),+ (Path.Combine(PathLocator.Folders.WindowsDefenderX86, "MpCmdRun.exe"), "BlockMpCmdRun.exe"),})- {- CommandExecutor.RunCommandAsTrustedInstaller($"/c takeown /f \"{filePath}\"");- CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{filePath}\" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18");- CommandExecutor.RunCommandAsTrustedInstaller($"/c icacls \"{filePath}\" /grant {Environment.UserName}:F");- CommandExecutor.RunCommandAsTrustedInstaller($"/c rename \"{filePath}\" {newFileName}");- }- CommandExecutor.RunCommandAsTrustedInstaller($"/c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MsMpEng.exe\" ren \"%D\\MsMpEng.exe\" BlockAntimalware.exe");- CommandExecutor.RunCommandAsTrustedInstaller($"/c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MpDefenderCoreService.exe\" ren \"%D\\MpDefenderCoreService.exe\" BlockAntimalwareCore.exe");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{filePath}\" {newFileName}");++ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MsMpEng.exe\" ren \"%D\\MsMpEng.exe\" BlockAntimalware.exe");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MpDefenderCoreService.exe\" ren \"%D\\MpDefenderCoreService.exe\" BlockAntimalwareCore.exe");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Defender Advanced Threat Protection")}\" BlockWindowsDefenderATP");++ foreach (var service in services)+ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\{service.Key} /v Start /t REG_DWORD /d 4 /f");++ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 3 /f");+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f");+ CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg delete ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /f");RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled", "Off", RegistryValueKind.String);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\System", "EnableSmartScreen", 0, RegistryValueKind.DWord);- CommandExecutor.RunCommandAsTrustedInstaller("/c reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /t REG_SZ /v SmartScreenEnabled /d \"off\" /f");+ CommandExecutor.RunCommandAsTrustedInstaller("/c reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /v SmartScreenEnabled /t REG_SZ /d \"off\" /f");RunPowerShellCommand("Set-MpPreference -DisableIOAVProtection $true");RunPowerShellCommand("Set-MpPreference -DisableRealtimeMonitoring $true");@@ -225,7 +243,6 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerRegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastService", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "HideExclusionsFromLocalAdmins", 0, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "ServiceKeepAlive", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastServiceStartup", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "PUAProtection", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableLocalAdminMerge", 0, RegistryValueKind.DWord);@@ -315,65 +332,33 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerRegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender");RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SecurityHealth");- KillProcess(new[] { "SecurityHealthService", "SecurityHealthSystray" });-- CommandExecutor.RunCommandAsTrustedInstaller("/c taskkill /f /im MsMpEng.exe & reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost /t REG_DWORD /v EnableWebContentEvaluation /d 0 /f & " +- "reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer /t REG_SZ /v SmartScreenEnabled /d \"off\" /f & " +- "reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter /t REG_DWORD /v EnabledV9 /d 0 /f & " +- "reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System /t REG_DWORD /v EnableSmartScreen /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /t REG_DWORD /v DisableAntiSpyware /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /t REG_DWORD /v DisableAntiVirus /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideDisableOnAccessProtection /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideRealtimeScanDirection /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideDisableIOAVProtection /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideDisableBehaviorMonitoring /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideDisableIntrusionPreventionSystem /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v LocalSettingOverrideDisableRealtimeMonitoring /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v DisableBehaviorMonitoring /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v DisableOnAccessProtection /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v DisableScanOnRealtimeEnable /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v DisableIOAVProtection /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /t REG_DWORD /v DisableRealtimeMonitoring /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /t REG_DWORD /v SpyNetReporting /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /t REG_DWORD /v SubmitSamplesConsent /d 2 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\" / t REG_DWORD /v PUAProtection /d 0 /f & " +- "reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT /t REG_DWORD /v DontOfferThroughWUA /d 1 /f & " +- "reg add HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT /t REG_DWORD /v DontReportInfectionInformation /d 1 /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SmartScreen\" /t REG_SZ /v ConfigureAppInstallControl /d \"Anywhere\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SmartScreen\" /t REG_DWORD /v ConfigureAppInstallControlEnabled /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /t REG_DWORD /v TamperProtection /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCmdRun.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCmdRun.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCopyAccelerator.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpCopyAccelerator.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MsMpEng.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MsMpEng.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\SgrmBroker.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\SgrmBroker.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpDefenderCoreService.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\MpDefenderCoreService.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\smartscreen.exe\" /t REG_DWORD /v CFGOptions /d 0 /f & " +- "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\smartscreen.exe\" /t REG_SZ /v Debugger /d \"S:\\none.exe\" /f");-- ManageServices(true);-- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "AutorunsDisabled", "3", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SecurityHealthService", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Features", "TamperProtection", "0", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SgrmAgent", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SgrmBroker", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdFilter", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdBoot", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisDrv", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisSvc", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MDCoreSvc", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecCore", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecFlt", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MsSecWfp", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\webthreatdefsvc", "Start", "4", RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\webthreatdefusersvc", "Start", "4", RegistryValueKind.DWord, true);+ KillProcess(new[] { "SecurityHealthUI", "SecurityHealthService", "SecurityHealthSystray", "SecHealthUI" });++ CommandExecutor.RunCommandAsTrustedInstaller($"/c reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\AppHost\" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\" /v SmartScreenEnabled /t REG_SZ /d \"off\" /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MicrosoftEdge\\PhishingFilter\" /v EnabledV9 /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\" /v EnableSmartScreen /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /v DisableAntiSpyware /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\" /v DisableAntiVirus /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableOnAccessProtection /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideRealtimeScanDirection /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableIOAVProtection /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableBehaviorMonitoring /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableIntrusionPreventionSystem /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v LocalSettingOverrideDisableRealtimeMonitoring /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v DisableIOAVProtection /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Real-Time Protection\" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /v SpyNetReporting /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Spynet\" /v SubmitSamplesConsent /t REG_DWORD /d 2 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\" /v PUAProtection /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows Defender\\Features\" /v TamperProtection /t REG_DWORD /d 0 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT\" /v DontOfferThroughWUA /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\MRT\" /v DontReportInfectionInformation /t REG_DWORD /d 1 /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SmartScreen\" /v ConfigureAppInstallControl /t REG_SZ /d \"Anywhere\" /f & " ++ "reg add \"HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SmartScreen\" /v ConfigureAppInstallControlEnabled /t REG_DWORD /d 0 /f");ManageExclusions(true);@@ -397,52 +382,12 @@ namespace GTweak.Utilities.Tweaks.DefenderManagercontinue;foreach (var filePath in Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly))- CommandExecutor.RunCommandAsTrustedInstaller($"/c takeown /f \"{filePath}\" & icacls \"{filePath}\" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18 & icacls \"{filePath}\" /grant {Environment.UserName}:F & del /q \"{filePath}\"");+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c del /q \"{filePath}\"");}catch (Exception ex) { ErrorLogging.LogDebug(ex); }}}- private static void ManageServices(bool isDisable)- {- Dictionary<string, (int on, int off)> services = new Dictionary<string, (int on, int off)>- {- { "WinDefend", (2, 4) },- { "SecurityHealthService", (2, 4) },- { "Sense", (3, 4) },- { "SgrmAgent", (3, 4) },- { "SgrmBroker", (3, 4) },- { "WdBoot", (0, 4) },- { "WdFilter", (0, 4) },- { "WdNisDrv", (3, 4) },- { "WdNisSvc", (3, 4) },- { "MDCoreSvc", (3, 4) },- { "MsSecCore", (3, 4) },- { "MsSecFlt", (3, 4) },- { "MsSecWfp", (3, 4) },- { "webthreatdefsvc", (3, 4) },- { "webthreatdefusersvc", (3, 4) },- { "wscsvc", (3, 4) }- };-- foreach (var service in services)- {- CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{service.Key}"" /t REG_DWORD /v Start /d {(isDisable ? service.Value.off : service.Value.on)} /f");-- if (service.Key == "WinDefend")- CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{service.Key}"" /t REG_DWORD /v AutorunsDisabled /d {(isDisable ? 3 : 0)} /f");-- if (isDisable)- RunPowerShellCommand($"Stop-Service -Name {service.Key}; Set-Service -Name {service.Key} -StartupType Disabled");- else- RunPowerShellCommand($"Start-Service -Name {service.Key}; Set-Service -Name {service.Key} -StartupType Automatic");-- RunCmdCommand($"sc config {service.Key} start= {(isDisable ? "disabled" : "auto")}");- }-- CommandExecutor.RunCommandAsTrustedInstaller($"\"Set-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\Windows Defender\\Features -Name TamperProtection -Value 0x0000000{(isDisable ? 0 : 1)}\"", true);- }-private static void ManageExclusions(bool isDisable){foreach (string drive in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Removable).Select(d => d.Name))@@ -451,25 +396,15 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerprivate static void KillProcess(params string[] nameList){- TakingOwnership.GrantDebugPrivilege();- foreach (string getName in nameList)+ foreach (string processName in nameList){- foreach (Process process in Process.GetProcessesByName(getName))- {- try- {- process.Kill();- process.WaitForExit(1000);- }- catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }+ foreach (Process process in Process.GetProcessesByName(processName))+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c taskkill /pid {process.Id} /f");}}private static void RunPowerShellCommand(string command) => RunProcess(PathLocator.Executable.PowerShell, "-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand \"" + Convert.ToBase64String(Encoding.Unicode.GetBytes(command)) + "\"");- private static void RunCmdCommand(string command) => RunProcess(PathLocator.Executable.CommandShell, "/d /q /c " + command);-private static void RunProcess(string path, string arguments){trydiff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.csindex c5d1c23f..5591451c 100644--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs@@ -160,8 +160,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", "4");servicesV.TglButton25.StateNA =- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", "4") ||- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc", "Start", "4");+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", "4");servicesV.TglButton26.StateNA =RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", "4") ||@@ -392,8 +391,6 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", isDisabled ? 4 : 3, RegistryValueKind.DWord);break;case "TglButton25":- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", isDisabled ? 4 : 2, RegistryValueKind.DWord, true);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "DelayedAutoStart", isDisabled ? 1 : 0, RegistryValueKind.DWord, true);RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", isDisabled ? 4 : 3, RegistryValueKind.DWord, true);break;case "TglButton26":@@ -430,7 +427,6 @@ namespace GTweak.Utilities.Tweaks{if (isDenyAccess){- TakingOwnership.GrantDebugPrivilege();CommandExecutor.RunCommandAsTrustedInstaller("/c net stop wuauserv & net stop bits & net stop cryptSvc & net stop RuntimeBroker");foreach (string name in new[] { "usocoreworker", "RuntimeBroker", "msedge", "MicrosoftEdgeUpdate", "edgeupdate" })@@ -442,7 +438,7 @@ namespace GTweak.Utilities.Tweaks}}- foreach (string path in new[] { $@"{PathLocator.Folders.SystemDrive}Windows\SoftwareDistribution\Download", $@"{PathLocator.Folders.SystemDrive}Windows\SoftwareDistribution\DataStore", $@"{PathLocator.Folders.SystemDrive}Windows\System32\catroot2", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "Windows", "DeliveryOptimization") })+ foreach (string path in new[] { $@"{PathLocator.Folders.SystemDrive}Windows\SoftwareDistribution\Download", $@"{PathLocator.Folders.SystemDrive}Windows\SoftwareDistribution\DataStore", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "Windows", "DeliveryOptimization") }){if (Directory.Exists(path)){diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.csindex aa06e515..f542729a 100644--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs@@ -274,21 +274,24 @@ namespace GTweak.Utilities.Tweakscatch (Exception ex) { ErrorLogging.LogDebug(ex); }break;case "TglButton8":+ BlockWDefender(isDisabled);if (canShowWindow){WaitingWindow waitingWindow = new WaitingWindow();waitingWindow.Show();+ ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);+BackgroundQueue backgroundQueue = new BackgroundQueue();await backgroundQueue.QueueTask(delegate { new NotificationManager().Show("info", "defender_notification").Perform(); });await backgroundQueue.QueueTask(delegate { WindowsDefender.SetProtectionState(isDisabled); });await backgroundQueue.QueueTask(delegate { new NotificationManager(300).Show().Restart(); });++ CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathLocator.Executable.NSudo}\"");waitingWindow.Close();}elseWindowsDefender.SetProtectionState(isDisabled);-- BlockWDefender(isDisabled);break;case "TglButton9":RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", isDisabled ? 0 : 5, RegistryValueKind.DWord);diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.csindex b2522ccc..d77f3603 100644--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs@@ -4,6 +4,7 @@ using GTweak.Utilities.Managers;using Microsoft.Win32;using System;using System.Collections.Generic;+using System.Diagnostics;using System.IO;using System.Linq;using System.Threading;@@ -207,9 +208,11 @@ namespace GTweak.Utilities.Tweakscatch (Exception ex) { ErrorLogging.LogDebug(ex); }break;case "Edge":- TakingOwnership.GrantDebugPrivilege();- foreach (string process in new string[] { "msedge.exe", "pwahelper.exe", "edgeupdate.exe", "edgeupdatem.exe", "msedgewebview2.exe", "MicrosoftEdgeUpdate.exe", "msedgewebviewhost.exe", "msedgeuserbroker.exe", "usocoreworker.exe", "RuntimeBroker.exe" })- CommandExecutor.RunCommandAsTrustedInstaller($"/c taskkill /f /im {process} /t");+ foreach (string processName in new string[] { "msedge", "pwahelper", "edgeupdate", "edgeupdatem", "msedgewebview2", "MicrosoftEdgeUpdate", "msedgewebviewhost", "msedgeuserbroker", "usocoreworker", "RuntimeBroker" })+ {+ foreach (Process process in Process.GetProcessesByName(processName))+ CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c taskkill /pid {process.Id} /f");+ }RemoveTasks(edgeTasks);diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.csindex bb6f65f8..b75e89e1 100644--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs@@ -41,10 +41,10 @@ namespace GTweak.Viewif (NotificationManager.ConfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))new NotificationManager(300).Show().Perform(action);- Parallel.Invoke(async delegate { await Task.Delay(1000); _confTweaks.AnalyzeAndUpdate(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); Application.Current.Dispatcher.Invoke(() => { _confTweaks.AnalyzeAndUpdate(this); }); });}- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => _confTweaks.AnalyzeAndUpdate(this));+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => Application.Current.Dispatcher.Invoke(() => { _confTweaks.AnalyzeAndUpdate(this); }));}}diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.csindex a1ea1c5e..3bbb6c76 100644--- a/.Source/GTweak/View/InterfaceView.xaml.cs+++ b/.Source/GTweak/View/InterfaceView.xaml.cs@@ -76,10 +76,10 @@ namespace GTweak.Viewif (NotificationManager.IntfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))new NotificationManager(300).Show().Perform(action);- Parallel.Invoke(async delegate { await Task.Delay(1000); _intfTweaks.AnalyzeAndUpdate(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); Application.Current.Dispatcher.Invoke(() => { _intfTweaks.AnalyzeAndUpdate(this); }); });}- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => _intfTweaks.AnalyzeAndUpdate(this));+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => Application.Current.Dispatcher.Invoke(() => { _intfTweaks.AnalyzeAndUpdate(this); }));}}diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.csindex 267d9ef8..47c56481 100644--- a/.Source/GTweak/View/ServicesView.xaml.cs+++ b/.Source/GTweak/View/ServicesView.xaml.cs@@ -3,6 +3,7 @@ using GTweak.Utilities.Managers;using GTweak.Utilities.Tweaks;using System;using System.Threading.Tasks;+using System.Windows;using System.Windows.Controls;using System.Windows.Input;@@ -37,9 +38,9 @@ namespace GTweak.Viewnew NotificationManager(300).Show().Restart();- Parallel.Invoke(async delegate { await Task.Delay(((ToggleButton)sender).Name.Contains("15") ? 2000 : 1000); _svcTweaks.AnalyzeAndUpdate(this); });+ Parallel.Invoke(async delegate { await Task.Delay(((ToggleButton)sender).Name.Contains("15") ? 2000 : 1000); Application.Current.Dispatcher.Invoke(() => { _svcTweaks.AnalyzeAndUpdate(this); }); });}- private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) => Parallel.Invoke(() => _svcTweaks.AnalyzeAndUpdate(this));+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => Application.Current.Dispatcher.Invoke(() => { _svcTweaks.AnalyzeAndUpdate(this); }));}}diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.csindex b3a72645..364894b4 100644--- a/.Source/GTweak/View/SystemView.xaml.cs+++ b/.Source/GTweak/View/SystemView.xaml.cs@@ -52,12 +52,12 @@ namespace GTweak.Viewif (NotificationManager.SysActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))new NotificationManager(300).Show().Perform(action);- Parallel.Invoke(async delegate { await Task.Delay(1000); _sysTweaks.AnalyzeAndUpdate(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); Application.Current.Dispatcher.Invoke(() => { _sysTweaks.AnalyzeAndUpdate(this); }); });}else_sysTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);}- private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => _sysTweaks.AnalyzeAndUpdate(this));+ private void Page_Loaded(object sender, RoutedEventArgs e) => Parallel.Invoke(() => { Application.Current.Dispatcher.Invoke(() => { _sysTweaks.AnalyzeAndUpdate(this); }); });}}