Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
fix Windows Defender disable processes and create backup files for settings #75 deb v 5.3.8
Greedeksab5953fed08b
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 192fa6ab..f66584f7 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -452,6 +452,7 @@</EmbeddedResource><None Include=".editorconfig" /><None Include="Resources\Blank.gz" />+ <None Include="Resources\DisablingWD.gz" /><None Include="Resources\hosts.gz" /><None Include="Resources\NSudoLC.gz" /><None Include="Resources\UltPower.gz" />diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.csindex 834cd10d..2ea5662f 100644--- a/.Source/GTweak/Properties/AssemblyInfo.cs+++ b/.Source/GTweak/Properties/AssemblyInfo.cs@@ -5,11 +5,11 @@ using System.Windows;[assembly: AssemblyTitle("GTweak")][assembly: AssemblyDescription("Portable Tool for an Ideal Windows Setup")][assembly: AssemblyProduct("GTweak")]-[assembly: AssemblyCopyright("� 2024-2025 Greedeks")]+[assembly: AssemblyCopyright("� 2024-2026 Greedeks")][assembly: AssemblyTrademark("Greedeks")]-[assembly: AssemblyInformationalVersion("Build: 5.3.7")]-[assembly: AssemblyVersion("5.3.68.152")]-[assembly: AssemblyFileVersion("5.3.68.152")]+[assembly: AssemblyInformationalVersion("Build: 5.3.8")]+[assembly: AssemblyVersion("5.3.40.875")]+[assembly: AssemblyFileVersion("5.3.40.875")][assembly: ComVisible(false)]diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.ttindex 92972572..0ce4ec0f 100644--- a/.Source/GTweak/Properties/AssemblyInfo.tt+++ b/.Source/GTweak/Properties/AssemblyInfo.tt@@ -22,7 +22,7 @@ using System.Windows;[assembly: AssemblyMetadata("RepositoryType", "git")]<#+- private const string majorVersion = "Build: 5.3.7";+ private const string majorVersion = "Build: 5.3.8";private string GenerateVersion(){diff --git a/.Source/GTweak/Properties/Resources.Designer.cs b/.Source/GTweak/Properties/Resources.Designer.csindex 19192c6e..e6e3e097 100644--- a/.Source/GTweak/Properties/Resources.Designer.cs+++ b/.Source/GTweak/Properties/Resources.Designer.cs@@ -1,7 +1,7 @@-namespace GTweak.Properties {+namespace GTweak.Properties {using System;- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]internal class Resources {@@ -42,6 +42,13 @@}}+ internal static byte[] DisablingWD {+ get {+ object obj = ResourceManager.GetObject("DisablingWD", resourceCulture);+ return ((byte[])(obj));+ }+ }+internal static byte[] hosts {get {object obj = ResourceManager.GetObject("hosts", resourceCulture);diff --git a/.Source/GTweak/Properties/Resources.resx b/.Source/GTweak/Properties/Resources.resxindex b61fe5b3..b722e928 100644--- a/.Source/GTweak/Properties/Resources.resx+++ b/.Source/GTweak/Properties/Resources.resx@@ -1,4 +1,4 @@-<?xml version="1.0" encoding="utf-8"?>+<?xml version="1.0" encoding="utf-8"?><root><!--Microsoft ResX Schema@@ -121,6 +121,9 @@<data name="Blank" type="System.Resources.ResXFileRef, System.Windows.Forms"><value>..\Resources\Blank.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>+ <data name="DisablingWD" type="System.Resources.ResXFileRef, System.Windows.Forms">+ <value>..\Resources\DisablingWD.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>+ </data><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>diff --git a/.Source/GTweak/Resources/DisablingWD.gz b/.Source/GTweak/Resources/DisablingWD.gznew file mode 100644index 00000000..13399364Binary files /dev/null and b/.Source/GTweak/Resources/DisablingWD.gz differdiff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Utilities/Controls/PathLocator.csindex 605a3401..b66db693 100644--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs+++ b/.Source/GTweak/Utilities/Controls/PathLocator.cs@@ -304,6 +304,8 @@ namespace GTweak.Utilities.Controlsinternal static (string Normal, string Block) WaaSMedic => FindWindowsUpdateExe("WaaSMedicAgent.exe", "BlockUpdateAgent-GTweak.exe");internal static readonly string MpCmdRun = Path.Combine(Folders.SystemDrive, "Program Files", "Windows Defender", "MpCmdRun.exe");++ internal static readonly string DisablingWD = Path.Combine(Folders.DefenderBackup, "DisablingWD.exe");}internal static class Filesdiff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.csindex 99a362f9..c4150925 100644--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs@@ -43,50 +43,60 @@ namespace GTweak.Utilities.Tweaks.DefenderManager{ @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", Registry.LocalMachine },{ @"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\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceConfidence/Analytic", Registry.LocalMachine },+ { @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Operational", Registry.LocalMachine },+ { @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Verbose", Registry.LocalMachine },+ { @"SOFTWARE\Microsoft\Windows defender\CoreService", Registry.LocalMachine },+ { @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard", Registry.LocalMachine },{ @"SOFTWARE\Microsoft\Windows Defender\Cloud", Registry.LocalMachine },{ @"Software\Microsoft\Edge", Registry.CurrentUser },};internal static void ExportRights(){- if (Directory.Exists(PathLocator.Folders.DefenderBackup) == false)+ try{- try- {- Directory.CreateDirectory(PathLocator.Folders.DefenderBackup);+ Directory.CreateDirectory(PathLocator.Folders.DefenderBackup);- var allValues = new Dictionary<string, Dictionary<string, object>>();- var aclDataDict = new Dictionary<string, string>();+ Dictionary<string, Dictionary<string, object>> allValues = new Dictionary<string, Dictionary<string, object>>();+ Dictionary<string, string> aclDataDict = new Dictionary<string, string>();- foreach (var entry in _storageRegPaths)- {- string path = entry.Key;- RegistryKey baseKey = entry.Value;+ if (_storageRegPaths == null || _storageRegPaths.Count == 0)+ {+ return;+ }- using RegistryKey key = baseKey.OpenSubKey(path, false);- if (key == null)- {- continue;- }+ foreach (var entry in _storageRegPaths)+ {+ string path = entry.Key;+ RegistryKey baseKey = entry.Value;- var values = new Dictionary<string, object>();- foreach (string valueName in key.GetValueNames())- {- values[valueName] = key.GetValue(valueName);- }+ using RegistryKey key = baseKey.OpenSubKey(path, false);+ if (key == null)+ {+ continue;+ }- allValues[path] = values;+ Dictionary<string, object> values = new Dictionary<string, object>();+ foreach (string valueName in key.GetValueNames())+ {+ values[valueName] = key.GetValue(valueName);+ }+ allValues[path] = values;+ try+ {RegistrySecurity security = key.GetAccessControl();string aclData = security.GetSecurityDescriptorSddlForm(AccessControlSections.All);aclDataDict[path] = aclData;}-- File.WriteAllText(PathLocator.Files.BackupDataJson, JsonConvert.SerializeObject(allValues, Formatting.Indented));- File.WriteAllText(PathLocator.Files.BackupRightsAcl, JsonConvert.SerializeObject(aclDataDict, Formatting.Indented));+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }}- catch (Exception ex) { ErrorLogging.LogDebug(ex); }++ File.WriteAllText(PathLocator.Files.BackupDataJson, JsonConvert.SerializeObject(allValues, Formatting.Indented));+ File.WriteAllText(PathLocator.Files.BackupRightsAcl, JsonConvert.SerializeObject(aclDataDict, Formatting.Indented));}+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }}internal static void ImportRights()diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.csindex 55d1cfed..7468a40e 100644--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs@@ -405,6 +405,15 @@ namespace GTweak.Utilities.Tweaks.DefenderManager}catch (Exception ex) { ErrorLogging.LogDebug(ex); }}++ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", 0, RegistryValueKind.DWord);+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Run", Path.GetFileNameWithoutExtension(PathLocator.Executable.DisablingWD), $@"""{PathLocator.Executable.DisablingWD}""", RegistryValueKind.String);}private static void ManageExclusions(bool isDisable)@@ -417,7 +426,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManagerprivate static void TerminateProcess(){- string[] processes = { "smartscreen", "mpdefendercoreservice", "msmpeng", "securityhealthservice", "securityhealthsystray", "securityhealthui", "wuauserv", "searchui", "sechealthui", "runtimebroker", "msedge", "ssoncom", "usocoreworker", "defenderbootstrapper", "configsecuritypolicy", "dlpuseragent", "lsass", "mpam-d", "mpam-fe", "mpam-fe_bd", "mpas-d", "mpas-fe", "mpas-fe_bd", "mpav-d", "mpav-fe", "mpav-fe_bd", "mpcmdrun", "mpcopyaccelerator", "mpdlpcmd", "mpdlpservice", "mpextms", "mpsigstub", "mrt", "msmpengcp", "mssense", "nissrv", "offlinescannershell", "securekernel", "securityhealthhost", "senseap", "senseaptoast", "sensecm", "sensegpparser", "senseidentity", "senseimdscollector", "senseir", "sensendr", "sensesampleuploader", "sensetvm", "sensece", "sgrmbroker", "healthattestationclientagent" };+ string[] processes = { "smartscreen", "mpdefendercoreservice", "msmpeng", "securityhealthservice", "securityhealthsystray", "securityhealthui", "wuauserv", "searchui", "sechealthui", "configsecuritypolicy", "runtimebroker", "msedge", "ssoncom", "usocoreworker", "defenderbootstrapper", "configsecuritypolicy", "dlpuseragent", "lsass", "mpam-d", "mpam-fe", "mpam-fe_bd", "mpas-d", "mpas-fe", "mpas-fe_bd", "mpav-d", "mpav-fe", "mpav-fe_bd", "mpcmdrun", "mpcopyaccelerator", "mpdlpcmd", "mpdlpservice", "mpextms", "mpsigstub", "mrt", "msmpengcp", "mssense", "nissrv", "offlinescannershell", "securekernel", "securityhealthhost", "senseap", "senseaptoast", "sensecm", "sensegpparser", "senseidentity", "senseimdscollector", "senseir", "sensendr", "sensesampleuploader", "sensetvm", "sensece", "sgrmbroker", "healthattestationclientagent" };CommandExecutor.RunCommandAsTrustedInstaller($"/c taskkill /f " + string.Join(" ", processes.Select(p => $"/im {p}.exe")));}diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.csindex 008e34da..afab8b81 100644--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs@@ -253,13 +253,13 @@ namespace GTweak.Utilities.TweaksoverlayWindow.Show();ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);+ ArchiveManager.Unarchive(PathLocator.Executable.DisablingWD, Properties.Resources.DisablingWD);BackgroundQueue backgroundQueue = new BackgroundQueue();await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "defender_noty").Perform(); });await backgroundQueue.QueueTask(delegate { WindowsDefender.SetProtectionState(isDisabled); });await backgroundQueue.QueueTask(delegate { NotificationManager.Show().WithDelay(300).Restart(); });- CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathLocator.Executable.NSudo}\"");overlayWindow.Close();}else