Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
-edit get grant & working in background
Greedeks5940d1568e2b
diff --git a/.Source/GTweak/Utilities/Control/Settings.cs b/.Source/GTweak/Utilities/Control/Settings.csindex 795fddae..0323d9a7 100644--- a/.Source/GTweak/Utilities/Control/Settings.cs+++ b/.Source/GTweak/Utilities/Control/Settings.cs@@ -85,7 +85,7 @@ namespace GTweak.Utilities.ControlregistryKey?.Close();}- internal static void ChangingParameters<T>(T value, string selection) => Parallel.Invoke(delegate+ internal static void ChangingParameters<T>(T value, string selection) => Task.Run(delegate{RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(@"Software\GTweak");registryKey?.SetValue(selection, value.ToString(), RegistryValueKind.String);diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.csindex dc7800a3..560faa17 100644--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs@@ -1,71 +1,93 @@using Microsoft.Win32;using System;using System.Diagnostics;+using System.Threading.Tasks;+using System.Windows.Input;namespace GTweak.Utilities.Helpers{internal sealed class RegistryHelp{- internal static void DeleteFolderTree(in RegistryKey registrykey, in string subkey)+ internal static void DeleteValue(RegistryKey registrykey, string subkey, string value, bool isTakingOwner = false){- if (registrykey.OpenSubKey(subkey) == null) return;- try { registrykey.DeleteSubKeyTree(subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }- }+ Task.Run(delegate+ {+ if (registrykey.OpenSubKey(subkey) == null || registrykey.OpenSubKey(subkey)?.GetValue(value, null) == null) return;+ try {+ if (isTakingOwner)+ TakingOwnership.GrantAdministratorsAccess($@"MACHINE\{subkey}", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- internal static void DeleteValue(in RegistryKey registrykey, in string subkey, in string value)- {- if (registrykey.OpenSubKey(subkey) == null || registrykey.OpenSubKey(subkey)?.GetValue(value, null) == null) return;- try { registrykey.OpenSubKey(subkey, true)?.DeleteValue(value); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ registrykey.OpenSubKey(subkey, true)?.DeleteValue(value);+ } catch (Exception ex) { Debug.WriteLine(ex.Message); }+ });}- internal static void Write<T>(in RegistryKey registrykey, in string key, in string name, in T data, in RegistryValueKind kind)+ internal static void Write<T>(RegistryKey registrykey, string subkey, string name, T data, RegistryValueKind kind, bool isTakingOwner = false){- try { registrykey.CreateSubKey(key, true)?.SetValue(name, data, kind); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ Task.Run(delegate+ {+ try {+ if (isTakingOwner)+ TakingOwnership.GrantAdministratorsAccess($@"MACHINE\{subkey}", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);++ registrykey.CreateSubKey(subkey, true)?.SetValue(name, data, kind);+ }+ catch (Exception ex) { Debug.WriteLine(ex.Message); }+ });}- internal static void CreateFolder(in RegistryKey registrykey, in string subkey)+ internal static void CreateFolder(RegistryKey registrykey, string subkey){- try { registrykey.CreateSubKey(subkey); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ Task.Run(() =>+ {+ try {+ registrykey.CreateSubKey(subkey);+ }+ catch (Exception ex) { Debug.WriteLine(ex.Message); }+ });}- internal static void DeleteRegristyTree(in RegistryKey registrykey, in string key)+ internal static void DeleteFolderTree(RegistryKey registrykey, string subkey){- try+ Task.Run(() =>{- RegistryKey registryFolder = registrykey.OpenSubKey(key, true);-- if (registryFolder != null)+ try{- foreach (string value in registryFolder.GetValueNames())+ RegistryKey registryFolder = registrykey.OpenSubKey(subkey, true);++ if (registryFolder != null){- try { registryFolder.DeleteValue(value); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ foreach (string value in registryFolder.GetValueNames())+ {+ try { registryFolder.DeleteValue(value); }+ catch (Exception ex) { Debug.WriteLine(ex.Message); }+ }}+ registrykey.DeleteSubKeyTree(subkey, false);}-- Registry.LocalMachine.DeleteSubKeyTree(key, false);- }- catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ catch (Exception ex) { Debug.WriteLine(ex.Message); }+ });}- internal static bool CheckExists(in RegistryKey registrykey, in string key, in bool isNegation = true)+ internal static bool CheckExists(in RegistryKey registrykey, in string subkey, in bool isNegation = true){- bool result = registrykey.OpenSubKey(key) != null;+ bool result = registrykey.OpenSubKey(subkey) != null;return isNegation ? result : !result;}- internal static bool CheckValue(in string key, in string valueName, in string expectedValue, in bool isNegation = true)+ internal static bool CheckValue(in string subkey, in string valueName, in string expectedValue, in bool isNegation = true){- string value = Registry.GetValue(key, valueName, null)?.ToString();+ string value = Registry.GetValue(subkey, valueName, null)?.ToString();bool result = value != null && value == expectedValue;return isNegation ? !result : result;}- internal static bool CheckValueBytes(in string key, in string valueName, in string expectedValue)+ internal static bool CheckValueBytes(in string subkey, in string valueName, in string expectedValue){- if (!(Registry.GetValue(key, valueName, null) is byte[]))+ if (!(Registry.GetValue(subkey, valueName, null) is byte[]))return true;- return string.Concat((byte[])Registry.GetValue(key, valueName, null) ?? Array.Empty<byte>()) != expectedValue;+ return string.Concat((byte[])Registry.GetValue(subkey, valueName, null) ?? Array.Empty<byte>()) != expectedValue;}}diff --git a/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.csindex 21b2a344..26e889d8 100644--- a/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs+++ b/.Source/GTweak/Utilities/Helpers/TaskSchedulerManager.cs@@ -21,7 +21,7 @@ namespace GTweak.Utilities.Helpersinternal static void EnablingTasks(string[] tasklist){- Parallel.Invoke(() =>+ Task.Run(delegate{using Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();foreach (string taskname in tasklist)@@ -41,7 +41,7 @@ namespace GTweak.Utilities.Helpersinternal static void DisablingTasks(string[] tasklist){- Parallel.Invoke(() =>+ Task.Run(delegate{using Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();foreach (string taskname in tasklist)diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.csindex 0ec98592..190101c1 100644--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs@@ -8,7 +8,7 @@ using System;using System.Diagnostics;using System.IO;using System.Linq;-using System.Threading;+using System.Threading.Tasks;namespace GTweak.Utilities.Tweaks{@@ -43,8 +43,6 @@ namespace GTweak.Utilities.Tweaks@"Microsoft\Office\OfficeTelemetryAgentLogOn",@"Microsoft\Office\Office 15 Subscription Heartbeat" };- private static Thread _thread = default;-internal void ViewСonfidentiality(ConfidentialityView confidentialityV){confidentialityV.TglButton1.StateNA =@@ -198,15 +196,10 @@ namespace GTweak.Utilities.Tweaks}break;case "TglButton4":- _thread = new Thread(() =>- {- if (isChoose)- DisablingTasks(SchedulerTasks);- else- EnablingTasks(SchedulerTasks);- })- { IsBackground = true };- _thread.Start();+ if (isChoose)+ DisablingTasks(SchedulerTasks);+ else+ EnablingTasks(SchedulerTasks);break;case "TglButton5":if (isChoose)@@ -257,22 +250,28 @@ namespace GTweak.Utilities.Tweakscase "TglButton9":if (isChoose){- BlockSpyDomain(true);+ Task.Run(delegate+ {+ BlockSpyDomain(true);- try { File.Delete(UsePath.Hosts + @" (Default GTweak)"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ try { File.Delete(UsePath.Hosts + @" (Default GTweak)"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }- File.Move(UsePath.Hosts, UsePath.Hosts + " (Default GTweak)");- new UnarchiveManager(UsePath.Hosts, Resources.hosts);+ File.Move(UsePath.Hosts, UsePath.Hosts + " (Default GTweak)");+ new UnarchiveManager(UsePath.Hosts, Resources.hosts);+ });}else{- try+ Task.Run(delegate{- BlockSpyDomain(false);- File.Copy(UsePath.Hosts + @" (Default GTweak)", UsePath.Hosts, true);- File.Delete(UsePath.Hosts + @" (Default GTweak)");- }- catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ try+ {+ BlockSpyDomain(false);+ File.Copy(UsePath.Hosts + @" (Default GTweak)", UsePath.Hosts, true);+ File.Delete(UsePath.Hosts + @" (Default GTweak)");+ }+ catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }+ });}break;case "TglButton10":@@ -334,14 +333,9 @@ namespace GTweak.Utilities.Tweaks}break;case "TglButton16":- static void LoggingServices(string valueState)- {- TrustedInstaller.CreateProcessAsTrustedInstaller(Control.Settings.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {valueState} /f");- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", int.Parse(valueState), RegistryValueKind.DWord);- }-- _thread = new Thread(() => LoggingServices(isChoose ? "4" : "3")) { IsBackground = true };- _thread.Start();+ string valueState = isChoose ? "4" : "3";+ TrustedInstaller.CreateProcessAsTrustedInstaller(Control.Settings.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {valueState} /f");+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", int.Parse(valueState), RegistryValueKind.DWord, true);break;case "TglButton17":if (isChoose)diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.csindex 4493d220..8ddac81b 100644--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs@@ -6,7 +6,7 @@ using System;using System.Diagnostics;using System.IO;using System.Text;-using System.Threading;+using System.Threading.Tasks;namespace GTweak.Utilities.Tweaks{@@ -165,7 +165,7 @@ namespace GTweak.Utilities.Tweaksprivate static void RestartExplorer(Process launchExplorer){- Thread _thread = new Thread(() =>+ Task.Run(delegate{foreach (Process process in Process.GetProcesses()){@@ -190,9 +190,7 @@ namespace GTweak.Utilities.Tweaks}}- })- { IsBackground = true };- _thread.Start();+ });}internal static void UseInterface(string tweak, bool isChoose)@@ -295,16 +293,19 @@ namespace GTweak.Utilities.Tweakscase "TglButton11":try{- if (isChoose)+ Task.Run(delegate{- new UnarchiveManager($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\Blank.ico", Properties.Resources.Blank);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);- }- else- {- File.Delete($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\Blank.ico");- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");- }+ if (isChoose)+ {+ new UnarchiveManager($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\Blank.ico", Properties.Resources.Blank);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);+ }+ else+ {+ File.Delete($@"{Environment.GetFolderPath(Environment.SpecialFolder.Windows)}\Blank.ico");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");+ }+ });}catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); };break;diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.csindex 7b32bc72..151f3c76 100644--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs@@ -9,7 +9,7 @@ using System.Diagnostics;using System.IO;using System.Security.AccessControl;using System.Security.Principal;-using System.Threading;+using System.Threading.Tasks;namespace GTweak.Utilities.Tweaks{@@ -256,26 +256,24 @@ namespace GTweak.Utilities.Tweaks}break;case "TglButton4":- static void StoreServices(string value)+ Task.Run(delegate{+ string value = isChoose ? "4" : "3";TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WalletService /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\VacSvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\spectrum /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\SharedRealitySvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\perceptionsimulation /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MixedRealityOpenXRSvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MapsBroker /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\EntAppSvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\embeddedmode /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\wlidsvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WEPHOSTSVC /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\StorSvc /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\ClipSVC /t REG_DWORD /v Start /d {value} /f & " +- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\InstallService /t REG_DWORD /v Start /d {value} /f");- }-- Thread _thread = new Thread(() => StoreServices(isChoose ? "4" : "3")) { IsBackground = true };- _thread.Start();+ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\VacSvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\spectrum /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\SharedRealitySvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\perceptionsimulation /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MixedRealityOpenXRSvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MapsBroker /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\EntAppSvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\embeddedmode /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\wlidsvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WEPHOSTSVC /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\StorSvc /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\ClipSVC /t REG_DWORD /v Start /d {value} /f & " ++ $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\InstallService /t REG_DWORD /v Start /d {value} /f");+ });break;case "TglButton5":if (isChoose)@@ -586,68 +584,48 @@ namespace GTweak.Utilities.Tweakscase "TglButton25":if (isChoose){- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"SYSTEM\CurrentControlSet\Services\WarpJITSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 4, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 4, RegistryValueKind.DWord, true);RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "DelayedAutoStart", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", 4, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", 4, RegistryValueKind.DWord, true);}else{- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"SYSTEM\CurrentControlSet\Services\WarpJITSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 2, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 2, RegistryValueKind.DWord, true);RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "DelayedAutoStart", 0, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", 3, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", 3, RegistryValueKind.DWord, true);}break;case "TglButton26":if (isChoose){- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdiServiceHost", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\DPS", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", 4, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", 4, RegistryValueKind.DWord, true);}else{- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdiServiceHost", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\DPS", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", 3, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", 3, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", 3, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", 3, RegistryValueKind.DWord, true);RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", 3, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", 2, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", 2, RegistryValueKind.DWord, true);}break;case "TglButton27":if (isChoose){- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\workfolderssvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\dot3svc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\DevQueryBroker", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\AppMgmt", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", 4, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", 4, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", 4, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", 4, RegistryValueKind.DWord, true);}else{- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\workfolderssvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\dot3svc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\DevQueryBroker", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\AppMgmt", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", 3, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", 3, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", 3, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", 3, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", 3, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", 3, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", 3, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", 3, RegistryValueKind.DWord, true);}break;case "TglButton28":@@ -681,7 +659,7 @@ namespace GTweak.Utilities.Tweaksprivate static void ChangeAccessUpdateFolders(bool isDenyAccess){- Thread _thread = new Thread(() =>+ Task.Run(delegate{void SetFullAccess(string path){@@ -728,9 +706,7 @@ namespace GTweak.Utilities.Tweaks}}catch (Exception ex) { Debug.WriteLine(ex); }- })- { IsBackground = true };- _thread.Start();+ });}}}diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.csindex 721a7815..da809764 100644--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs@@ -156,7 +156,7 @@ namespace GTweak.Utilities.Tweaksinternal void ViewNetshState(){- Parallel.Invoke(() =>+ Task.Run(delegate{string getStateNetsh = default;@@ -358,15 +358,10 @@ namespace GTweak.Utilities.Tweaks}break;case "TglButton12":- Thread _thread = new Thread(() =>- {- if (isChoose)- DisablingTasks(schedulerTasks);- else- EnablingTasks(schedulerTasks);- })- { IsBackground = true };- _thread.Start();+ if (isChoose)+ DisablingTasks(schedulerTasks);+ else+ EnablingTasks(schedulerTasks);break;case "TglButton13":string argStateNetsh = string.Empty, argStateNetshSecond = string.Empty;@@ -383,7 +378,7 @@ namespace GTweak.Utilities.TweaksargStateNetsh = @"default";}- Parallel.Invoke(() =>+ Task.Run(() =>{Process.Start(new ProcessStartInfo(){@@ -490,7 +485,7 @@ namespace GTweak.Utilities.Tweaksprivate static void BluetoothStatusSet(string status = "'off'"){- Thread _thread = new Thread(() =>+ Task.Run(() =>{ProcessStartInfo startInfo = new ProcessStartInfo{@@ -516,15 +511,13 @@ namespace GTweak.Utilities.Tweaksusing Process process = new Process() { StartInfo = startInfo };process.Start();process.Close();- })- { IsBackground = true };- _thread.Start();+ });}private static void SetPowercfg(bool isChoose){- Thread _thread = new Thread(async () =>+ Task.Run(async () =>{Process _powercfg = new Process(){@@ -612,9 +605,7 @@ namespace GTweak.Utilities.Tweaks}}catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }- })- { IsBackground = true };- _thread.Start();+ });}}}diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.csindex fa2e93ad..0613fe87 100644--- a/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs+++ b/.Source/GTweak/Utilities/Tweaks/WindowsDefender.cs@@ -13,15 +13,6 @@ namespace GTweak.Utilities.Tweaks{internal void Enable(){- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WinDefend", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\SecurityHealthService", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SOFTWARE\Microsoft\Windows Defender\Features", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdNisSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\Sense", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdFilter", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdBoot", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdNisDrv", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);-TrustedInstaller.CreateProcessAsTrustedInstaller(Settings.PID, "cmd.exe /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 & " +@@ -50,16 +41,16 @@ namespace GTweak.Utilities.TweaksRegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled", "On", RegistryValueKind.String);- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\System");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Policy Manager");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\MpEngine");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SmartScreen");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Reportin");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\System");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Policy Manager");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\MpEngine");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SmartScreen");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Reportin");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");RunPowerShellCommand("Set-MpPreference -DisableIOAVProtection $false");RunPowerShellCommand("Set-MpPreference -DisableRealtimeMonitoring $false");@@ -83,8 +74,8 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PrivateProfile", "DisableNotifications", 0, RegistryValueKind.DWord);RegistryHelp.CreateFolder(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile");RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DisableNotifications", 0, RegistryValueKind.DWord);- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");- RegistryHelp.DeleteRegristyTree(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");+ RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge");EnableTask("Microsoft\\Windows\\ExploitGuard\\ExploitGuard MDM policy Refresh");EnableTask("Microsoft\\Windows\\Windows Defender\\Windows Defender Cache Maintenance");@@ -92,10 +83,10 @@ namespace GTweak.Utilities.TweaksEnableTask("Microsoft\\Windows\\Windows Defender\\Windows Defender Scheduled Scan");EnableTask("Microsoft\\Windows\\Windows Defender\\Windows Defender Verification");- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter");RegistryHelp.CreateFolder(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config");RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 1, RegistryValueKind.DWord);- RegistryHelp.DeleteRegristyTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS");+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS");RegistryHelp.CreateFolder(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity");RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity", "Enabled", 1, RegistryValueKind.DWord);RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Microsoft\Windows\CurrentVersion\AppHost", "EnableWebContentEvaluation");@@ -116,15 +107,15 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender", "\"%ProgramFiles%\\Windows Defender\\MSASCui.exe\"-runkey", RegistryValueKind.String);RunProcess(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Windows Defender\MpCmdRun.exe", "-SignatureUpdate");- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "Start", "2", RegistryValueKind.DWord);+ 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);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Features", "TamperProtection", "1", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisSvc", "Start", "3", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "Start", "3", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdFilter", "Start", "0", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdBoot", "Start", "0", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisDrv", "Start", "3", RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SecurityHealthService", "Start", "2", RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Features", "TamperProtection", "1", RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisSvc", "Start", "3", RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "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);CloseDefenderSettings();@@ -199,15 +190,14 @@ namespace GTweak.Utilities.TweaksRegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\MpEngine", "DisableGradualRelease", 1, RegistryValueKind.DWord);RegistryHelp.CreateFolder(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection");- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\Software\Policies\Microsoft\Windows Defender\Real-Time Protection", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableIOAVProtection", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableOnAccessProtection", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableScanOnRealtimeEnable", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableScriptScanning", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRawWriteNotification", 1, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableIOAVProtection", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableOnAccessProtection", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableScanOnRealtimeEnable", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableScriptScanning", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRawWriteNotification", 1, RegistryValueKind.DWord, true);RegistryHelp.CreateFolder(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration");RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration", "Notification_Suppress", 1, RegistryValueKind.DWord);@@ -225,10 +215,9 @@ namespace GTweak.Utilities.TweaksRunPowerShellCommand(@"Set-ExecutionPolicy UnRestricted; Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows Defender\Features -Name TamperProtection -Value 0x00000000");RegistryHelp.CreateFolder(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet");- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\Software\Policies\Microsoft\Windows Defender\SpyNet", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "DisableBlockAtFirstSeen", 1, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "SpynetReporting", 0, RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "SubmitSamplesConsent", 2, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "DisableBlockAtFirstSeen", 1, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "SpynetReporting", 0, RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\SpyNet", "SubmitSamplesConsent", 2, RegistryValueKind.DWord, true);RegistryHelp.CreateFolder(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config");RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "EnabledV9", 0, RegistryValueKind.DWord);RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 0, RegistryValueKind.DWord);@@ -276,26 +265,17 @@ namespace GTweak.Utilities.Tweaksif (Directory.Exists(defenderScansPath)) DeleteDir(defenderScansPath);}- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WinDefend", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\SecurityHealthService", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SOFTWARE\Microsoft\Windows Defender\Features", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdNisSvc", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\Sense", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdFilter", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdBoot", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);- TakingOwnership.GrantAdministratorsAccess(@"MACHINE\SYSTEM\CurrentControlSet\Services\WdNisDrv", TakingOwnership.SE_OBJECT_TYPE.SE_REGISTRY_KEY);-await Task.Delay(1000);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WinDefend", "Start", "4", RegistryValueKind.DWord);+ 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);- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Features", "TamperProtection", "0", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisSvc", "Start", "4", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "Start", "4", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdFilter", "Start", "4", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdBoot", "Start", "4", RegistryValueKind.DWord);- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdNisDrv", "Start", "4", 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\WdNisSvc", "Start", "4", RegistryValueKind.DWord, true);+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Sense", "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);RunCmdCommand("sc config WinDefend start= disabled");RunPowerShellCommand("Stop-Service -Name WinDefend; Set-Service -Name WinDefend -StartupType Disabled");diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.csindex 0cb6a3a7..ea04bc24 100644--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs@@ -38,7 +38,7 @@ namespace GTweak.View{ToggleButton toggleButton = (ToggleButton)sender;- Parallel.Invoke(() => ConfidentialityTweaks.UseСonfidentiality(toggleButton.Name, toggleButton.State));+ ConfidentialityTweaks.UseСonfidentiality(toggleButton.Name, toggleButton.State);switch (toggleButton.Name){@@ -48,7 +48,7 @@ namespace GTweak.Viewbreak;}- Parallel.Invoke(async delegate { await Task.Delay(500); new ConfidentialityTweaks().ViewСonfidentiality(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); new ConfidentialityTweaks().ViewСonfidentiality(this); });}private void Page_Loaded(object sender, RoutedEventArgs e)diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.csindex 7f3cf623..3ce36804 100644--- a/.Source/GTweak/View/DataSystemView.xaml.cs+++ b/.Source/GTweak/View/DataSystemView.xaml.cs@@ -138,7 +138,7 @@ namespace GTweak.Viewprivate void BtnHiddenIP_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e){- Parallel.Invoke(delegate { Settings.ChangingParameters(!BtnHiddenIP.IsChecked.Value, "HiddenIP"); });+ Settings.ChangingParameters(!BtnHiddenIP.IsChecked.Value, "HiddenIP");DoubleAnimation doubleAnim = new DoubleAnimation(){diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.csindex 7769c05b..c2a2f54e 100644--- a/.Source/GTweak/View/InterfaceView.xaml.cs+++ b/.Source/GTweak/View/InterfaceView.xaml.cs@@ -63,7 +63,7 @@ namespace GTweak.Viewprivate void TglButton_ChangedState(object sender, EventArgs e){ToggleButton toggleButton = (ToggleButton)sender;- Parallel.Invoke(() => InterfaceTweaks.UseInterface(toggleButton.Name, toggleButton.State));+ InterfaceTweaks.UseInterface(toggleButton.Name, toggleButton.State);switch (toggleButton.Name){@@ -85,7 +85,7 @@ namespace GTweak.Viewbreak;}- Parallel.Invoke(async delegate { await Task.Delay(500); new InterfaceTweaks().ViewInterface(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); new InterfaceTweaks().ViewInterface(this); });}private void Page_Loaded(object sender, RoutedEventArgs e)diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.csindex 3c3be8a1..4653a732 100644--- a/.Source/GTweak/View/ServicesView.xaml.cs+++ b/.Source/GTweak/View/ServicesView.xaml.cs@@ -36,11 +36,11 @@ namespace GTweak.Viewprivate void TglButton_ChangedState(object sender, EventArgs e){ToggleButton toggleButton = (ToggleButton)sender;- Parallel.Invoke(() => ServicesTweaks.UseServices(toggleButton.Name, toggleButton.State));+ ServicesTweaks.UseServices(toggleButton.Name, toggleButton.State);new ViewNotification(300).Show("restart");- Parallel.Invoke(async delegate { await Task.Delay(500); new ServicesTweaks().ViewServices(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); new ServicesTweaks().ViewServices(this); });}private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e)diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.csindex 4fb2d2e2..8d42b24a 100644--- a/.Source/GTweak/View/SystemView.xaml.cs+++ b/.Source/GTweak/View/SystemView.xaml.cs@@ -61,7 +61,7 @@ namespace GTweak.ViewToggleButton toggleButton = (ToggleButton)sender;if (toggleButton.Name != "TglButton8"){- Parallel.Invoke(() => SystemTweaks.UseSystem(toggleButton.Name, toggleButton.State));+ SystemTweaks.UseSystem(toggleButton.Name, toggleButton.State);switch (toggleButton.Name){@@ -80,7 +80,7 @@ namespace GTweak.Viewbreak;}- Parallel.Invoke(async delegate { await Task.Delay(500); new SystemTweaks().ViewSystem(this); });+ Parallel.Invoke(async delegate { await Task.Delay(1000); new SystemTweaks().ViewSystem(this); });}else{diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.csindex 8f85432c..c21a8f1b 100644--- a/.Source/GTweak/Windows/MainWindow.xaml.cs+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs@@ -140,17 +140,14 @@ namespace GTweak#endregion#region Settings Menu- private void BtnNotification_ChangedState(object sender, EventArgs e) => Parallel.Invoke(() => { Settings.ChangingParameters(!BtnNotification.State, "Notification"); });+ private void BtnNotification_ChangedState(object sender, EventArgs e) => Settings.ChangingParameters(!BtnNotification.State, "Notification");- private void BtnUpdate_ChangedState(object sender, EventArgs e) => Parallel.Invoke(() => { Settings.ChangingParameters(!BtnUpdate.State, "Update"); });+ private void BtnUpdate_ChangedState(object sender, EventArgs e) => Settings.ChangingParameters(!BtnUpdate.State, "Update");private void BtnTopMost_ChangedState(object sender, EventArgs e){- Parallel.Invoke(delegate- {- Settings.ChangingParameters(!BtnTopMost.State, "TopMost");- Topmost = Settings.IsTopMost;- });+ Settings.ChangingParameters(!BtnTopMost.State, "TopMost");+ Topmost = !BtnTopMost.State;}private void SliderVolume_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)@@ -161,7 +158,7 @@ namespace GTweakprivate void BtnSoundNtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e){- Parallel.Invoke(() => { Settings.ChangingParameters(!BtnSoundNtn.IsChecked, "Sound"); });+ Settings.ChangingParameters(!BtnSoundNtn.IsChecked, "Sound");}private void LanguageSelectionMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)