Skip to content

Portable Tool for an Ideal Windows Setup

refactored tweak modules & managers to a strictly typed, Enum-based dictionary architecture with dynamic UI parsing.

Greedekse64b2ae07cb3
diff --git a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
index b1316e6e..14fac2d7 100644
--- a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
@@ -9,6 +9,6 @@ namespace GTweak.Core.ViewModel
{
protected override IReadOnlyDictionary<string, object> GetControlStates() => ConfidentialityTweaks.ControlStates;
- protected override void Analyze(ConfidentialityTweaks tweaks) => tweaks?.AnalyzeAndUpdate();
+ protected override void Analyze(ConfidentialityTweaks tweaks) => tweaks?.CheckAll();
}
}
diff --git a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
index 5efdd047..ad85538f 100644
--- a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
@@ -15,7 +15,7 @@ namespace GTweak.Core.ViewModel
public Visibility Win11FeatureAvailable => HardwareData.OS.IsWin11 && HardwareData.OS.Build.CompareTo(22621.2361m) >= 0 ? Visibility.Visible : Visibility.Collapsed;
public Visibility OneDriveAvailable => UninstallingPakages.IsOneDriveInstalled ? Visibility.Visible : Visibility.Collapsed;
- protected override void Analyze(InterfaceTweaks tweaks) => tweaks?.AnalyzeAndUpdate();
+ protected override void Analyze(InterfaceTweaks tweaks) => tweaks?.CheckAll();
protected override IReadOnlyDictionary<string, object> GetControlStates() => InterfaceTweaks.ControlStates;
public InterfaceViewModel()
diff --git a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
index 0fee9433..50c0234b 100644
--- a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
@@ -12,6 +12,6 @@ namespace GTweak.Core.ViewModel
protected override IReadOnlyDictionary<string, object> GetControlStates() => ServicesTweaks.ControlStates;
- protected override void Analyze(ServicesTweaks tweaks) => tweaks?.AnalyzeAndUpdate();
+ protected override void Analyze(ServicesTweaks tweaks) => tweaks?.CheckAll();
}
}
diff --git a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
index eaecfe8f..3502c166 100644
--- a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
@@ -15,6 +15,6 @@ namespace GTweak.Core.ViewModel
protected override IReadOnlyDictionary<string, object> GetControlStates() => SystemTweaks.ControlStates;
- protected override void Analyze(SystemTweaks tweaks) => tweaks?.AnalyzeAndUpdate();
+ protected override void Analyze(SystemTweaks tweaks) => tweaks?.CheckAll();
}
}
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 08f98fd1..b1217fd9 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -224,6 +224,7 @@
<Compile Include="Utilities\Configuration\NetworkProvider.cs" />
<Compile Include="Utilities\Configuration\StorageTypeIdentifier.cs" />
<Compile Include="Utilities\Configuration\HardwareData.cs" />
+ <Compile Include="Utilities\Helpers\ControlDictionaryExtensions.cs" />
<Compile Include="Utilities\Helpers\UnlockHandleHelper.cs" />
<Compile Include="Utilities\Maintenance\ClearingMemory.cs" />
<Compile Include="Utilities\Maintenance\RegistryExporter.cs" />
diff --git a/.Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs b/.Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs
new file mode 100644
index 00000000..c6454d59
--- /dev/null
+++ b/.Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+
+namespace GTweak.Utilities.Helpers
+{
+ internal static class ControlDictionaryExtensions
+ {
+ private static readonly char[] Digits = "0123456789".ToCharArray();
+
+ internal static bool TryGetAction<TAction>(this Dictionary<Enum, TAction> dict, string controlName, out TAction action)
+ {
+ action = default;
+ if (string.IsNullOrEmpty(controlName))
+ {
+ return false;
+ }
+
+ int digitIndex = controlName.IndexOfAny(Digits);
+
+ if (digitIndex >= 0 && int.TryParse(controlName.Substring(digitIndex), out int index))
+ {
+ string prefix = controlName.Substring(0, digitIndex);
+
+ string expectedSuffix = prefix switch
+ {
+ "TglButton" => "Toggle",
+ "Checkbox" => "Checkbox",
+ "Slider" => "Slider",
+ "ColorPicker" => "Color",
+ _ => string.Empty
+ };
+
+ if (string.IsNullOrEmpty(expectedSuffix))
+ {
+ return false;
+ }
+
+ foreach (var kvp in dict)
+ {
+ if (Convert.ToInt32(kvp.Key) == index && kvp.Key.GetType().Name.EndsWith(expectedSuffix))
+ {
+ action = kvp.Value;
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs b/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs
index 6964c478..22b95144 100644
--- a/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs
+++ b/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs
@@ -7,7 +7,7 @@ namespace GTweak.Utilities.Managers
{
private readonly Dictionary<string, object> _controlStates;
- internal GenericCollection<bool> Button { get; }
+ internal GenericCollection<bool> ToggleButton { get; }
internal GenericCollection<bool> Checkbox { get; }
internal GenericCollection<object> Slider { get; }
internal GenericCollection<object> ColorPicker { get; }
@@ -16,7 +16,7 @@ namespace GTweak.Utilities.Managers
{
_controlStates = controlStates ?? new Dictionary<string, object>();
- Button = new GenericCollection<bool>(_controlStates, "TglButton");
+ ToggleButton = new GenericCollection<bool>(_controlStates, "TglButton");
Checkbox = new GenericCollection<bool>(_controlStates, "Checkbox");
Slider = new GenericCollection<object>(_controlStates, "Slider");
ColorPicker = new GenericCollection<object>(_controlStates, "ColorPicker");
diff --git a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs b/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
index 0f3a88fb..2d097b8a 100644
--- a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
+++ b/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using GTweak.Utilities.Controls;
+using GTweak.Utilities.Tweaks;
namespace GTweak.Utilities.Managers
{
@@ -23,31 +24,31 @@ namespace GTweak.Utilities.Managers
internal enum ExplorerAction { None, Refresh, Restart }
- internal static readonly Dictionary<string, ExplorerAction> IntfActions = new Dictionary<string, ExplorerAction>()
+ internal static readonly Dictionary<Enum, ExplorerAction> IntfActions = new Dictionary<Enum, ExplorerAction>()
{
- ["Checkbox1"] = ExplorerAction.Restart,
- ["Checkbox2"] = ExplorerAction.Restart,
- ["Checkbox3"] = ExplorerAction.Restart,
- ["Checkbox4"] = ExplorerAction.Restart,
- ["Checkbox5"] = ExplorerAction.Restart,
- ["Checkbox6"] = ExplorerAction.Restart,
- ["Checkbox7"] = ExplorerAction.Restart,
- ["Checkbox8"] = ExplorerAction.Refresh,
- ["Checkbox9"] = ExplorerAction.Refresh,
- ["Checkbox10"] = ExplorerAction.Refresh,
- ["Checkbox11"] = ExplorerAction.Refresh,
- ["Checkbox12"] = ExplorerAction.Refresh,
- ["Checkbox13"] = ExplorerAction.Refresh,
- ["TglButton5"] = ExplorerAction.Restart,
- ["TglButton6"] = ExplorerAction.Restart,
- ["TglButton11"] = ExplorerAction.Restart,
- ["TglButton12"] = ExplorerAction.Restart,
- ["TglButton13"] = ExplorerAction.Restart,
- ["TglButton17"] = ExplorerAction.Restart,
- ["TglButton19"] = ExplorerAction.Restart,
- ["TglButton23"] = ExplorerAction.Restart,
- ["TglButton24"] = ExplorerAction.Restart,
- ["TglButton27"] = ExplorerAction.Restart
+ [InterfaceCheckbox.ExplorerHome] = ExplorerAction.Restart,
+ [InterfaceCheckbox.ExplorerGallery] = ExplorerAction.Restart,
+ [InterfaceCheckbox.ExplorerOneDrive] = ExplorerAction.Restart,
+ [InterfaceCheckbox.HiddenFiles] = ExplorerAction.Restart,
+ [InterfaceCheckbox.SystemFiles] = ExplorerAction.Restart,
+ [InterfaceCheckbox.FileExtensions] = ExplorerAction.Restart,
+ [InterfaceCheckbox.EmptyDrives] = ExplorerAction.Restart,
+ [InterfaceCheckbox.IconComputer] = ExplorerAction.Refresh,
+ [InterfaceCheckbox.IconNetwork] = ExplorerAction.Refresh,
+ [InterfaceCheckbox.IconRecycleBin] = ExplorerAction.Refresh,
+ [InterfaceCheckbox.IconControlPanel] = ExplorerAction.Refresh,
+ [InterfaceCheckbox.IconUserFiles] = ExplorerAction.Refresh,
+ [InterfaceCheckbox.IconOneDrive] = ExplorerAction.Refresh,
+ [InterfaceToggle.TaskbarDarkTheme] = ExplorerAction.Restart,
+ [InterfaceToggle.AppDarkTheme] = ExplorerAction.Restart,
+ [InterfaceToggle.TaskbarAlignment] = ExplorerAction.Restart,
+ [InterfaceToggle.StartMenuLayout] = ExplorerAction.Restart,
+ [InterfaceToggle.CompactContextMenu] = ExplorerAction.Restart,
+ [InterfaceToggle.TaskbarEndTask] = ExplorerAction.Restart,
+ [InterfaceToggle.TaskbarIconsButtons] = ExplorerAction.Restart,
+ [InterfaceToggle.ComputerFolders] = ExplorerAction.Restart,
+ [InterfaceToggle.Explorer3DObjects] = ExplorerAction.Restart,
+ [InterfaceToggle.BingStartSearch] = ExplorerAction.Restart
};
internal static readonly Dictionary<string, ExplorerAction> PackageActions = new Dictionary<string, ExplorerAction>()
diff --git a/.Source/GTweak/Utilities/Managers/NotificationManager.cs b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
index 3408d639..c318c45d 100644
--- a/.Source/GTweak/Utilities/Managers/NotificationManager.cs
+++ b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
@@ -1,9 +1,11 @@
+using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using GTweak.Utilities.Controls;
+using GTweak.Utilities.Tweaks;
using GTweak.Windows;
namespace GTweak.Utilities.Managers
@@ -12,43 +14,43 @@ namespace GTweak.Utilities.Managers
{
internal enum NoticeAction { None, Logout, Restart }
- internal static readonly Dictionary<string, NoticeAction> ConfActions = new Dictionary<string, NoticeAction>()
+ internal static readonly Dictionary<Enum, NoticeAction> ConfActions = new Dictionary<Enum, NoticeAction>()
{
- ["TglButton8"] = NoticeAction.Restart,
- ["TglButton15"] = NoticeAction.Restart,
- ["TglButton20"] = NoticeAction.Restart
+ [ConfidentialityToggle.HardwareConfigurationData] = NoticeAction.Restart,
+ [ConfidentialityToggle.CovertDataCollectionServices] = NoticeAction.Restart,
+ [ConfidentialityToggle.IntelTelemetry] = NoticeAction.Restart
};
- internal static readonly Dictionary<string, NoticeAction> IntfActions = new Dictionary<string, NoticeAction>()
+ internal static readonly Dictionary<Enum, NoticeAction> IntfActions = new Dictionary<Enum, NoticeAction>()
{
- ["TglButton1"] = NoticeAction.Logout,
- ["TglButton2"] = NoticeAction.Logout,
- ["TglButton3"] = NoticeAction.Logout,
- ["TglButton7"] = NoticeAction.Logout,
- ["TglButton8"] = NoticeAction.Logout,
- ["TglButton9"] = NoticeAction.Logout,
- ["TglButton10"] = NoticeAction.Logout,
- ["TglButton16"] = NoticeAction.Restart,
- ["TglButton18"] = NoticeAction.Logout,
- ["TglButton29"] = NoticeAction.Restart
+ [InterfaceToggle.SystemButtonSize] = NoticeAction.Logout,
+ [InterfaceToggle.CursorFlickerFrequency] = NoticeAction.Logout,
+ [InterfaceToggle.ScrollbarSize] = NoticeAction.Logout,
+ [InterfaceToggle.ContextMenuDelay] = NoticeAction.Logout,
+ [InterfaceToggle.TaskbarPreviewDelay] = NoticeAction.Logout,
+ [InterfaceToggle.IconOverlayBadges] = NoticeAction.Logout,
+ [InterfaceToggle.ShortcutNameSuffix] = NoticeAction.Logout,
+ [InterfaceToggle.CopilotRecall] = NoticeAction.Restart,
+ [InterfaceToggle.SnapLayouts] = NoticeAction.Logout,
+ [InterfaceToggle.AdaptiveBrightness] = NoticeAction.Restart
};
- internal static readonly Dictionary<string, NoticeAction> SysActions = new Dictionary<string, NoticeAction>()
+ internal static readonly Dictionary<Enum, NoticeAction> SysActions = new Dictionary<Enum, NoticeAction>()
{
- ["TglButton2"] = NoticeAction.Logout,
- ["TglButton3"] = NoticeAction.Restart,
- ["TglButton4"] = NoticeAction.Restart,
- ["TglButton5"] = NoticeAction.Restart,
- ["TglButton7"] = NoticeAction.Restart,
- ["TglButton12"] = NoticeAction.Restart,
- ["TglButton13"] = NoticeAction.Restart,
- ["TglButton14"] = NoticeAction.Restart,
- ["TglButton15"] = NoticeAction.Restart,
- ["TglButton20"] = NoticeAction.Restart,
- ["TglButton23"] = NoticeAction.Restart,
- ["TglButton25"] = NoticeAction.Restart,
- ["TglButton27"] = NoticeAction.Restart,
- ["TglButton30"] = NoticeAction.Restart
+ [SystemToggle.StickyKeysFilter] = NoticeAction.Logout,
+ [SystemToggle.WindowsDefender] = NoticeAction.Restart,
+ [SystemToggle.UserAccountControl] = NoticeAction.Restart,
+ [SystemToggle.SecurityNotifications] = NoticeAction.Restart,
+ [SystemToggle.RealtekAudioDelay] = NoticeAction.Restart,
+ [SystemToggle.MemoryDiagnostics] = NoticeAction.Restart,
+ [SystemToggle.NetworkProtocols] = NoticeAction.Restart,
+ [SystemToggle.FileSystemCache] = NoticeAction.Restart,
+ [SystemToggle.StartupDelay] = NoticeAction.Restart,
+ [SystemToggle.WindowsFirewall] = NoticeAction.Restart,
+ [SystemToggle.BackgroundApps] = NoticeAction.Restart,
+ [SystemToggle.DynamicTickHpet] = NoticeAction.Restart,
+ [SystemToggle.InsiderTasks] = NoticeAction.Restart,
+ [SystemToggle.MultiPlaneOverlay] = NoticeAction.Restart
};
private static int _isNotificationOpen;
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 364d72f8..ae03d325 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -12,469 +12,594 @@ using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
+ internal enum ConfidentialityToggle
+ {
+ TargetedAdvertising = 1,
+ DataSynchronization,
+ WindowsTelemetry,
+ SchedulerDataCollection,
+ InstalledAppsData,
+ AppUsageStatistics,
+ HandwritingData,
+ HardwareConfigurationData,
+ HiddenMicrosoftDomains,
+ UserLocationTracking,
+ FeedbackRequests,
+ SpeechSynthesisUpdates,
+ HiddenSystemMonitoring,
+ SystemExperiments,
+ CovertDataCollectionServices,
+ WindowsEventLogging,
+ NvidiaTelemetry,
+ UserBehaviorRecording,
+ OfflineMapsUpdates,
+ IntelTelemetry
+ }
+
internal sealed class ConfidentialityTweaks : FirewallManager
{
internal readonly static Dictionary<string, object> ControlStates = new Dictionary<string, object>();
private readonly ControlWriterManager _сontrolWriter = new ControlWriterManager(ControlStates);
+ private readonly Dictionary<ConfidentialityToggle, (Func<bool> Check, Action<bool> Apply)> _tglTweaks;
- internal void AnalyzeAndUpdate()
- {
- _сontrolWriter.Button[1] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", "0");
-
- _сontrolWriter.Button[2] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", "0");
-
- _сontrolWriter.Button[3] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", "1") || IsTaskEnabled(telemetryTasks);
-
- _сontrolWriter.Button[4] = IsTaskEnabled(dataCollectTasks);
-
- _сontrolWriter.Button[5] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", "1") || IsTaskEnabled(appExpInventoryTasks);
-
- _сontrolWriter.Button[6] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0") || IsTaskEnabled(appExpUsageTasks);
-
- _сontrolWriter.Button[7] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", "1") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC", "Enabled", "0");
-
- _сontrolWriter.Button[8] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", "0") || IsTaskEnabled(ceipTasks);
-
- _сontrolWriter.Button[9] = IsDefaultHosts();
-
- _сontrolWriter.Button[10] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", "1");
-
- _сontrolWriter.Button[11] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", "1") || IsTaskEnabled(feedbackTasks);
-
- _сontrolWriter.Button[12] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", "0") || IsTaskEnabled(speechTasks);
-
- _сontrolWriter.Button[13] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", "4");
-
- _сontrolWriter.Button[14] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", "0");
-
- _сontrolWriter.Button[15] =
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DiagTrack") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dmwappushservice") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagsvc");
-
- _сontrolWriter.Button[16] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", "4");
-
- _сontrolWriter.Button[17] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", "4") || IsTaskEnabled(nvidiaTasks);
-
- _сontrolWriter.Button[18] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", "1");
-
- _сontrolWriter.Button[19] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "MapUpdate", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "AutoUpdateEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", "0") || IsTaskEnabled(mapsTasks);
-
- _сontrolWriter.Button[20] = (RegistryHelp.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start")
- && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start", "4")) || IsTaskEnabled(intelTask);
- }
-
- internal bool IsDefaultHosts()
+ public ConfidentialityTweaks()
{
- try
+ _tglTweaks = new Dictionary<ConfidentialityToggle, (Func<bool> Check, Action<bool> Apply)>
{
- HashSet<string> resourceEntries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
- foreach (string line in Resources.Blocklist.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
- {
- string trimmed = line.Trim();
- if (trimmed.StartsWith("0.0.0.0"))
+ [ConfidentialityToggle.TargetedAdvertising] = (
+ Check: () =>
{
- resourceEntries.Add(trimmed);
- }
- }
-
- if (resourceEntries.Count == 0)
- {
- return true;
- }
-
- HashSet<string> fileEntries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
- foreach (string line in File.ReadLines(PathLocator.Files.Hosts.Original))
- {
- string trimmed = line.Trim();
- if (trimmed.StartsWith("0.0.0.0"))
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", "0");
+ },
+ Apply: (state) =>
{
- fileEntries.Add(trimmed);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", 0, RegistryValueKind.DWord);
+ }
}
- }
-
- return !resourceEntries.IsSubsetOf(fileEntries);
- }
- catch { return true; }
- }
+ ),
- internal void ApplyTweaks(string tweak, bool state)
- {
- INIManager.TempWrite(INIManager.TempTweaksConf, tweak, state);
-
- switch (tweak)
- {
- case "TglButton1":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton2":
- if (state)
+ [ConfidentialityToggle.DataSynchronization] = (
+ Check: () =>
{
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled");
- }
- else
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", "0");
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", 0, RegistryValueKind.DWord);
+ }
}
- break;
- case "TglButton3":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", state ? 1 : 0, RegistryValueKind.DWord);
+ ),
+
+ [ConfidentialityToggle.WindowsTelemetry] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", "1") || IsTaskEnabled(telemetryTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", 1, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, telemetryTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.SchedulerDataCollection] = (
+ Check: () => IsTaskEnabled(dataCollectTasks),
+ Apply: (state) => SetTaskState(state, dataCollectTasks)
+ ),
+
+ [ConfidentialityToggle.InstalledAppsData] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", "1") || IsTaskEnabled(appExpInventoryTasks),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", 1, RegistryValueKind.DWord);
+ }
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", 1, RegistryValueKind.DWord);
- }
- SetTaskState(state, telemetryTasks);
- break;
- case "TglButton4":
- SetTaskState(state, dataCollectTasks);
- break;
- case "TglButton5":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory");
+ SetTaskStateOwner(state, appExpInventoryTasks);
}
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", 1, RegistryValueKind.DWord);
- }
- SetTaskStateOwner(state, appExpInventoryTasks);
- break;
- case "TglButton6":
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", state ? 1 : 0, RegistryValueKind.DWord);
-
- if (state)
+ ),
+
+ [ConfidentialityToggle.AppUsageStatistics] = (
+ Check: () =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry");
- }
- else
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0") || IsTaskEnabled(appExpUsageTasks);
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0, RegistryValueKind.DWord);
- }
- SetTaskStateOwner(state, appExpUsageTasks);
- break;
- case "TglButton7":
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", state ? 0 : 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Input\TIPC", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", state ? 1 : 0, RegistryValueKind.DWord);
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing");
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskStateOwner(state, appExpUsageTasks);
}
- else
+ ),
+
+ [ConfidentialityToggle.HandwritingData] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton8":
- if (state)
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC", "Enabled", "0");
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient");
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Input\TIPC", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", 1, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [ConfidentialityToggle.HardwareConfigurationData] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", "0") || IsTaskEnabled(ceipTasks),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, ceipTasks);
}
- SetTaskState(state, ceipTasks);
- break;
- case "TglButton9":
- BlockSpyDomain(state);
- Task.Run(delegate
+ ),
+
+ [ConfidentialityToggle.HiddenMicrosoftDomains] = (
+ Check: () => IsDefaultHosts(),
+ Apply: (state) =>
{
- try
+ BlockSpyDomain(state);
+
+ Task.Run(delegate
{
- if (state)
+ try
{
- File.Copy(PathLocator.Files.Hosts.Backup, PathLocator.Files.Hosts.Original, true);
-
- if (File.Exists(PathLocator.Files.Hosts.Backup))
+ if (state)
{
- File.Delete(PathLocator.Files.Hosts.Backup);
+ File.Copy(PathLocator.Files.Hosts.Backup, PathLocator.Files.Hosts.Original, true);
+
+ if (File.Exists(PathLocator.Files.Hosts.Backup))
+ {
+ File.Delete(PathLocator.Files.Hosts.Backup);
+ }
+ else
+ {
+ File.WriteAllText(PathLocator.Files.Hosts.Original, string.Empty);
+ }
}
else
{
- File.WriteAllText(PathLocator.Files.Hosts.Original, string.Empty);
- }
- }
- else
- {
- File.Copy(PathLocator.Files.Hosts.Original, PathLocator.Files.Hosts.Backup, true);
+ File.Copy(PathLocator.Files.Hosts.Original, PathLocator.Files.Hosts.Backup, true);
- string existingText = File.Exists(PathLocator.Files.Hosts.Original) ? File.ReadAllText(PathLocator.Files.Hosts.Original) : string.Empty;
+ string existingText = File.Exists(PathLocator.Files.Hosts.Original) ? File.ReadAllText(PathLocator.Files.Hosts.Original) : string.Empty;
- HashSet<string> existingEntries = new HashSet<string>(existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()), StringComparer.OrdinalIgnoreCase);
+ HashSet<string> existingEntries = new HashSet<string>(existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()), StringComparer.OrdinalIgnoreCase);
- StringBuilder blocklist = new StringBuilder();
+ StringBuilder blocklist = new StringBuilder();
- foreach (string line in Resources.Blocklist.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
- {
- string trimmedLine = line.Trim();
- if (!string.IsNullOrEmpty(trimmedLine) && existingEntries.Add(trimmedLine))
+ foreach (string line in Resources.Blocklist.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
{
- blocklist.AppendLine(trimmedLine);
+ string trimmedLine = line.Trim();
+ if (!string.IsNullOrEmpty(trimmedLine) && existingEntries.Add(trimmedLine))
+ {
+ blocklist.AppendLine(trimmedLine);
+ }
}
- }
- if (blocklist.Length > 0)
- {
- FileInfo fileInfo = new FileInfo(PathLocator.Files.Hosts.Original);
-
- if (fileInfo.Exists && fileInfo.IsReadOnly)
+ if (blocklist.Length > 0)
{
- fileInfo.IsReadOnly = false;
- }
+ FileInfo fileInfo = new FileInfo(PathLocator.Files.Hosts.Original);
- string prefix = string.Empty;
- if (existingText.Length > 0)
- {
- string lastLine = existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault()?.Trim() ?? string.Empty;
- prefix = lastLine.StartsWith("0.0.0.0") ? existingText.EndsWith("\n") ? string.Empty : Environment.NewLine : existingText.EndsWith("\n") ? Environment.NewLine : Environment.NewLine + Environment.NewLine;
- }
+ if (fileInfo.Exists && fileInfo.IsReadOnly)
+ {
+ fileInfo.IsReadOnly = false;
+ }
+
+ string prefix = string.Empty;
+ if (existingText.Length > 0)
+ {
+ string lastLine = existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault()?.Trim() ?? string.Empty;
+ prefix = lastLine.StartsWith("0.0.0.0") ? existingText.EndsWith("\n") ? string.Empty : Environment.NewLine : existingText.EndsWith("\n") ? Environment.NewLine : Environment.NewLine + Environment.NewLine;
+ }
- File.AppendAllText(PathLocator.Files.Hosts.Original, $"{prefix}{blocklist.ToString().TrimEnd()}");
+ File.AppendAllText(PathLocator.Files.Hosts.Original, $"{prefix}{blocklist.ToString().TrimEnd()}");
+ }
}
}
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- });
- break;
- case "TglButton10":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider");
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ });
}
- else
+ ),
+
+ [ConfidentialityToggle.UserLocationTracking] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton11":
- if (state)
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", "1");
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications");
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", 1, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [ConfidentialityToggle.FeedbackRequests] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", 1, RegistryValueKind.DWord);
- }
- SetTaskState(state, feedbackTasks);
- break;
- case "TglButton12":
- if (state)
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", "1") || IsTaskEnabled(feedbackTasks);
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate");
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", 1, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, feedbackTasks);
}
- else
+ ),
+
+ [ConfidentialityToggle.SpeechSynthesisUpdates] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", "0") || IsTaskEnabled(speechTasks),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, speechTasks);
}
- SetTaskState(state, speechTasks);
- break;
- case "TglButton13":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton14":
- if (state)
+ ),
+
+ [ConfidentialityToggle.HiddenSystemMonitoring] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ConfidentialityToggle.SystemExperiments] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", "0"),
+ Apply: (state) =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation");
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", 0, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [ConfidentialityToggle.CovertDataCollectionServices] = (
+ Check: () =>
+ {
+ return RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DiagTrack") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dmwappushservice") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagsvc");
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", 0, RegistryValueKind.DWord);
+ (string diagTrack, string dmwappushservice, string diagsvc) =
+ (
+ @"SYSTEM\CurrentControlSet\Services\DiagTrack",
+ @"SYSTEM\CurrentControlSet\Services\dmwappushservice",
+ @"SYSTEM\CurrentControlSet\Services\diagsvc"
+ );
+
+ if (state)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Description", @"@%SystemRoot%\system32\diagtrack.dll,-3002", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "DisplayName", @"@%SystemRoot%\system32\diagtrack.dll,-3001", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,00,01,00,00,00,30,75,00,00,01,00,00,00,30,75,00,00,00,00,00,00,00,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k utcsvc -p", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "RequiredPrivileges", new[] { "SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege", "SeAssignPrimaryTokenPrivilege", "SeImpersonatePrivilege", "SeSystemProfilePrivilege", "SeTcbPrivilege", "SeDebugPrivilege", "SeSecurityPrivilege" }, RegistryValueKind.MultiString);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Start", 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Type", 16, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDll", @"%SystemRoot%\system32\diagtrack.dll", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DelayedAutoStart", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DependOnService", new[] { "rpcss" }, RegistryValueKind.MultiString);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Description", @"@%SystemRoot%\system32\dmwappushsvc.dll,-201", RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DisplayName", @"@%SystemRoot%\system32\dmwappushsvc.dll,-200", RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,04,00,00,00,14,00,00,00,01,00,00,00,10,27,00,00,01,00,00,00,10,27,00,00,01,00,00,00,10,27,00,00,00,00,00,00,10,27,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ImagePath", @"%SystemRoot%\system32\svchost.exe -k netsvcs -p", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Start", 3, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Type", 20, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "StateFlags", 3, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "IdleTimeout(sec)", 120, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDll", @"%SystemRoot%\system32\dmwappushsvc.dll", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Data0", Array.ConvertAll("37,00,39,00,35,00,42,00,36,00,42,00,46,00,39,00,2d,00,39,00,37,00,42,00,36,00,2d,00,34,00,46,00,38,00,39,00,2d,00,42,00,44,00,38,00,44,00,2d,00,32,00,46,00,34,00,32,00,42,00,42,00,42,00,45,00,39,00,39,00,36,00,45,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "GUID", Array.ConvertAll("67,d1,90,bc,70,94,39,41,a9,ba,be,0b,bb,f5,b7,4d".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Data0", Array.ConvertAll("75,90,bc,a3,28,00,92,13".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "DataType0", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "GUID", Array.ConvertAll("16,28,7a,2d,5e,0c,fc,45,9c,e7,57,0e,5e,cd,e9,c9".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Type", 7, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Security", "Security", Array.ConvertAll("01,00,04,80,b0,00,00,00,bc,00,00,00,00,00,00,00,14,00,00,00,02,00,9c,00,07,00,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,ff,01,0f,00,01,01,00,00,00,00,00,05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,00,00,18,00,14,00,00,00,01,02,00,00,00,00,00,0f,02,00,00,00,01,00,00,00,00,00,14,00,14,00,00,00,01,01,00,00,00,00,00,05,04,00,00,00,00,00,14,00,14,00,00,00,01,01,00,00,00,00,00,05,0b,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Description", @"@%systemroot%\system32\DiagSvc.dll,-101", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "DisplayName", @"@%systemroot%\system32\DiagSvc.dll,-100", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,00,01,00,00,00,30,75,00,00,01,00,00,00,30,75,00,00,00,00,00,00,00,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k diagnostics", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "RequiredPrivileges", new[] { "SeTcbPrivilege", "nSeTakeOwnershipPrivilege", "nSeDebugPrivilege", "nSeBackupPrivilege", "nSeImpersonatePrivilege", "nSeLoadDriverPrivilege", "nSeRestorePrivilege", "nSeManageVolumePrivilege" }, RegistryValueKind.MultiString);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Start", 3, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Type", 32, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDll", @"%systemroot%\system32\DiagSvc.dll", RegistryValueKind.ExpandString);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Data0", Array.ConvertAll("46,00,44,00,44,00,34,00,35,00,39,00,32,00,34,00,2d,00,37,00,38,00,34,00,41,00,2d,00,34,00,39,00,39,00,43,00,2d,00,41,00,45,00,45,00,39,00,2d,00,30,00,38,00,31,00,33,00,38,00,35,00,30,00,43,00,45,00,31,00,38,00,32,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "GUID", Array.ConvertAll("67,d1,90,bc,70,94,39,41,a9,ba,be,0b,bb,f5,b7,4d".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
+ }
+ else
+ {
+ foreach (string path in new[] { diagTrack, dmwappushservice, diagsvc })
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, path);
+ }
+ }
}
- break;
- case "TglButton15":
- (string diagTrack, string dmwappushservice, string diagsvc) =
- (
- @"SYSTEM\CurrentControlSet\Services\DiagTrack",
- @"SYSTEM\CurrentControlSet\Services\dmwappushservice",
- @"SYSTEM\CurrentControlSet\Services\diagsvc"
- );
-
- if (state)
+ ),
+
+ [ConfidentialityToggle.WindowsEventLogging] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", "4"),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Description", @"@%SystemRoot%\system32\diagtrack.dll,-3002", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "DisplayName", @"@%SystemRoot%\system32\diagtrack.dll,-3001", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ErrorControl", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,00,01,00,00,00,30,75,00,00,01,00,00,00,30,75,00,00,00,00,00,00,00,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k utcsvc -p", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ObjectName", "LocalSystem", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "RequiredPrivileges", new[] { "SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege", "SeAssignPrimaryTokenPrivilege", "SeImpersonatePrivilege", "SeSystemProfilePrivilege", "SeTcbPrivilege", "SeDebugPrivilege", "SeSecurityPrivilege" }, RegistryValueKind.MultiString);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "ServiceSidType", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Start", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagTrack, "Type", 16, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDll", @"%SystemRoot%\system32\diagtrack.dll", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
-
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DelayedAutoStart", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DependOnService", new[] { "rpcss" }, RegistryValueKind.MultiString);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Description", @"@%SystemRoot%\system32\dmwappushsvc.dll,-201", RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "DisplayName", @"@%SystemRoot%\system32\dmwappushsvc.dll,-200", RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ErrorControl", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,04,00,00,00,14,00,00,00,01,00,00,00,10,27,00,00,01,00,00,00,10,27,00,00,01,00,00,00,10,27,00,00,00,00,00,00,10,27,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ImagePath", @"%SystemRoot%\system32\svchost.exe -k netsvcs -p", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ObjectName", "LocalSystem", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "ServiceSidType", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Start", 3, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "Type", 20, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, dmwappushservice, "StateFlags", 3, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "IdleTimeout(sec)", 120, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDll", @"%SystemRoot%\system32\dmwappushsvc.dll", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Data0", Array.ConvertAll("37,00,39,00,35,00,42,00,36,00,42,00,46,00,39,00,2d,00,39,00,37,00,42,00,36,00,2d,00,34,00,46,00,38,00,39,00,2d,00,42,00,44,00,38,00,44,00,2d,00,32,00,46,00,34,00,32,00,42,00,42,00,42,00,45,00,39,00,39,00,36,00,45,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "GUID", Array.ConvertAll("67,d1,90,bc,70,94,39,41,a9,ba,be,0b,bb,f5,b7,4d".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Action", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Data0", Array.ConvertAll("75,90,bc,a3,28,00,92,13".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "DataType0", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "GUID", Array.ConvertAll("16,28,7a,2d,5e,0c,fc,45,9c,e7,57,0e,5e,cd,e9,c9".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Type", 7, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{dmwappushservice}\Security", "Security", Array.ConvertAll("01,00,04,80,b0,00,00,00,bc,00,00,00,00,00,00,00,14,00,00,00,02,00,9c,00,07,00,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,ff,01,0f,00,01,01,00,00,00,00,00,05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,00,00,18,00,14,00,00,00,01,02,00,00,00,00,00,0f,02,00,00,00,01,00,00,00,00,00,14,00,14,00,00,00,01,01,00,00,00,00,00,05,04,00,00,00,00,00,14,00,14,00,00,00,01,01,00,00,00,00,00,05,0b,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
-
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Description", @"@%systemroot%\system32\DiagSvc.dll,-101", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "DisplayName", @"@%systemroot%\system32\DiagSvc.dll,-100", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ErrorControl", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "FailureActions", Array.ConvertAll("80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,00,01,00,00,00,30,75,00,00,01,00,00,00,30,75,00,00,00,00,00,00,00,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k diagnostics", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ObjectName", "LocalSystem", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "RequiredPrivileges", new[] { "SeTcbPrivilege", "nSeTakeOwnershipPrivilege", "nSeDebugPrivilege", "nSeBackupPrivilege", "nSeImpersonatePrivilege", "nSeLoadDriverPrivilege", "nSeRestorePrivilege", "nSeManageVolumePrivilege" }, RegistryValueKind.MultiString);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "ServiceSidType", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Start", 3, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, diagsvc, "Type", 32, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDll", @"%systemroot%\system32\DiagSvc.dll", RegistryValueKind.ExpandString);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Data0", Array.ConvertAll("46,00,44,00,44,00,34,00,35,00,39,00,32,00,34,00,2d,00,37,00,38,00,34,00,41,00,2d,00,34,00,39,00,39,00,43,00,2d,00,41,00,45,00,45,00,39,00,2d,00,30,00,38,00,31,00,33,00,38,00,35,00,30,00,43,00,45,00,31,00,38,00,32,00,00,00".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "GUID", Array.ConvertAll("67,d1,90,bc,70,94,39,41,a9,ba,be,0b,bb,f5,b7,4d".Split(','), s => Convert.ToByte(s, 16)), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {(state ? "3" : "4")} /f");
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
}
- else
+ ),
+
+
+ [ConfidentialityToggle.NvidiaTelemetry] = (
+ Check: () =>
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, diagTrack);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, dmwappushservice);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, diagsvc);
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", "4") || IsTaskEnabled(nvidiaTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ SetTaskState(state, nvidiaTasks);
}
- break;
- case "TglButton16":
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {(state ? "3" : "4")} /f");
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- break;
- case "TglButton17":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- SetTaskState(state, nvidiaTasks);
- break;
- case "TglButton18":
- if (state)
+ ),
+
+ [ConfidentialityToggle.UserBehaviorRecording] = (
+ Check: () =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera");
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", "1");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", 1, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [ConfidentialityToggle.OfflineMapsUpdates] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "MapUpdate", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "AutoUpdateEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", "0") || IsTaskEnabled(mapsTasks);
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", 1, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", 0, RegistryValueKind.DWord);
+ }
+
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\Maps", "MapUpdate", state ? 1 : 0, RegistryValueKind.DWord);
+
+ SetTaskState(state, mapsTasks);
}
- break;
- case "TglButton19":
- if (state)
+ ),
+
+ [ConfidentialityToggle.IntelTelemetry] = (
+ Check: () =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps");
+ return (RegistryHelp.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start") &&
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start", "4")) || IsTaskEnabled(intelTask);
+ },
+ Apply: (state) =>
+ {
+ if (RegistryHelp.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start"))
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Telemetry", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, intelTask);
}
- else
+ ),
+ };
+ }
+
+ internal void CheckAll()
+ {
+ foreach (var tweak in _tglTweaks)
+ {
+ _сontrolWriter.ToggleButton[(int)tweak.Key] = tweak.Value.Check();
+ }
+ }
+
+ internal void Apply(string tweakName, bool state)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksConf, tweakName, state);
+
+ if (tweakName.StartsWith("TglButton") && int.TryParse(tweakName.Substring(9), out int index))
+ {
+ ConfidentialityToggle tweakKey = (ConfidentialityToggle)index;
+
+ if (_tglTweaks.TryGetValue(tweakKey, out var action))
+ {
+ action.Apply(state);
+ }
+ }
+ }
+
+ private bool IsDefaultHosts()
+ {
+ try
+ {
+ HashSet<string> resourceEntries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
+ foreach (string line in Resources.Blocklist.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
+ {
+ string trimmed = line.Trim();
+ if (trimmed.StartsWith("0.0.0.0"))
{
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", 0, RegistryValueKind.DWord);
+ resourceEntries.Add(trimmed);
}
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\Maps", "MapUpdate", state ? 1 : 0, RegistryValueKind.DWord);
- SetTaskState(state, mapsTasks);
- break;
- case "TglButton20":
- if (RegistryHelp.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start"))
+ }
+
+ if (resourceEntries.Count == 0)
+ {
+ return true;
+ }
+
+ HashSet<string> fileEntries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
+ foreach (string line in File.ReadLines(PathLocator.Files.Hosts.Original))
+ {
+ string trimmed = line.Trim();
+ if (trimmed.StartsWith("0.0.0.0"))
{
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Telemetry", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ fileEntries.Add(trimmed);
}
- SetTaskState(state, intelTask);
- break;
- default:
- break;
+ }
+
+ return !resourceEntries.IsSubsetOf(fileEntries);
}
+ catch { return true; }
}
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index a42504b1..767442f8 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTweak.Utilities.Configuration;
@@ -12,679 +11,875 @@ using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
+ internal enum InterfaceColor
+ {
+ CursorSelection = 1,
+ Tooltip
+ }
+
+ internal enum InterfaceCheckbox
+ {
+ ExplorerHome = 1,
+ ExplorerGallery,
+ ExplorerOneDrive,
+ HiddenFiles,
+ SystemFiles,
+ FileExtensions,
+ EmptyDrives,
+ IconComputer,
+ IconNetwork,
+ IconRecycleBin,
+ IconControlPanel,
+ IconUserFiles,
+ IconOneDrive
+ }
+
+ internal enum InterfaceToggle
+ {
+ SystemButtonSize = 1,
+ CursorFlickerFrequency,
+ ScrollbarSize,
+ TaskbarTransparency,
+ TaskbarDarkTheme,
+ AppDarkTheme,
+ ContextMenuDelay,
+ TaskbarPreviewDelay,
+ IconOverlayBadges,
+ ShortcutNameSuffix,
+ TaskbarAlignment,
+ StartMenuLayout,
+ CompactContextMenu,
+ TipsSuggestions,
+ CompactExplorerMode,
+ CopilotRecall,
+ TaskbarEndTask,
+ SnapLayouts,
+ TaskbarIconsButtons,
+ PersonalizedAds,
+ RestoreFolderWindows,
+ TipsNotifications,
+ ComputerFolders,
+ Explorer3DObjects,
+ JpegWallpaperCompression,
+ DesktopTooltips,
+ BingStartSearch,
+ OpenQuickAccess,
+ AdaptiveBrightness
+ }
+
internal sealed class InterfaceTweaks
{
internal readonly static Dictionary<string, object> ControlStates = new Dictionary<string, object>();
private readonly ControlWriterManager _сontrolWriter = new ControlWriterManager(ControlStates);
+ private readonly Dictionary<InterfaceColor, (Func<string> Check, Action<string> Apply)> _colorTweaks;
+ private readonly Dictionary<InterfaceCheckbox, (Func<bool> Check, Action<bool> Apply)> _cbTweaks;
+ private readonly Dictionary<InterfaceToggle, (Func<bool> Check, Action<bool> Apply)> _tglTweaks;
- internal void AnalyzeAndUpdate()
+ public InterfaceTweaks()
{
- _сontrolWriter.ColorPicker[1] = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "Hilight", "0 120 215");
-
- _сontrolWriter.ColorPicker[2] = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "InfoWindow", "255 255 225");
-
- _сontrolWriter.Checkbox[1] = HardwareData.OS.IsWin11 &&
- ((HardwareData.OS.Build > 22621m && (RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}"))) ||
- (HardwareData.OS.Build <= 22621m && (RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}")))) ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\ShellFolder", "Attributes", unchecked((int)0xB0940064).ToString());
-
- _сontrolWriter.Checkbox[2] = HardwareData.OS.IsWin11 &&
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ _colorTweaks = new Dictionary<InterfaceColor, (Func<string> Check, Action<string> Apply)>
+ {
+ [InterfaceColor.CursorSelection] = (
+ Check: () => RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "Hilight", "0 120 215"),
+ Apply: (value) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Colors", "Hilight", value, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Colors", "HotTrackingColor", value == "0 120 215" ? "0 102 204" : value, RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Checkbox[3] =
- RegistryHelp.CheckValue(@"HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0");
+ [InterfaceColor.Tooltip] = (
+ Check: () => RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "InfoWindow", "255 255 225"),
+ Apply: (value) =>
+ {
+ RegistryHelp.Write(Registry.Users, @".DEFAULT\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.Users, @"S-1-5-19\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.Users, @"S-1-5-20\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ }
+ )
+ };
- foreach ((int i, string n, string v) in new (int index, string name, string value)[] { (4, "Hidden", "1"), (5, "ShowSuperHidden", "1"), (6, "HideFileExt", "0"), (7, "HideDrivesWithNoMedia", "0") })
+ _cbTweaks = new Dictionary<InterfaceCheckbox, (Func<bool> Check, Action<bool> Apply)>
{
- _сontrolWriter.Checkbox[i] = RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", n, v, true);
- }
+ [InterfaceCheckbox.ExplorerHome] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ ((HardwareData.OS.Build > 22621m && (RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}"))) ||
+ (HardwareData.OS.Build <= 22621m && (RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}")))) ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\ShellFolder", "Attributes", unchecked((int)0xB0940064).ToString());
+ },
+ Apply: (state) =>
+ {
+ string baseKey = HardwareData.OS.Build > 22621m ? @"NameSpace" : @"NameSpace_36354489";
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\ShellFolder", "Attributes", unchecked((int)0xB0940064), RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
+ RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}");
+ }
+ }
+ ),
- foreach ((int i, string g) in new (int index, string guid)[] { (8, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"), (9, "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"), (10, "{645FF040-5081-101B-9F08-00AA002F954E}"), (11, "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"), (12, "{59031A47-3F72-44A7-89C5-5595FE6B30EE}"), (13, "{018D5C66-4533-4307-9B53-224DE2ED1FE6}") })
+ [InterfaceCheckbox.ExplorerGallery] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", string.Empty, @"{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", string.Empty, @"{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", RegistryValueKind.String);
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.ExplorerOneDrive] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
+ }
+ ),
+
+ [InterfaceCheckbox.HiddenFiles] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "1", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.SystemFiles] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "1", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.FileExtensions] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.EmptyDrives] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconComputer] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconNetwork] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconRecycleBin] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", "1", false),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconControlPanel] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconUserFiles] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031A47-3F72-44A7-89C5-5595FE6B30EE}", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031A47-3F72-44A7-89C5-5595FE6B30EE}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconOneDrive] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "0", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{018D5C66-4533-4307-9B53-224DE2ED1FE6}", state ? 1 : 0, RegistryValueKind.DWord)
+ )
+ };
+
+ _tglTweaks = new Dictionary<InterfaceToggle, (Func<bool> Check, Action<bool> Apply)>
{
- _сontrolWriter.Checkbox[i] = RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", g, i == 10 ? "1" : "0", i != 10);
- }
+ [InterfaceToggle.SystemButtonSize] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionHeight", "-270") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionWidth", "-270");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionHeight", state ? "-330" : "-270", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionWidth", state ? "-330" : "-270", RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Button[1] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionHeight", "-270") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionWidth", "-270");
-
- _сontrolWriter.Button[2] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "CursorBlinkRate", "530", true);
-
- _сontrolWriter.Button[3] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollHeight", "-210") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollWidth", "-210");
-
- _сontrolWriter.Button[4] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", "0");
-
- _сontrolWriter.Button[5] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", "1");
-
- _сontrolWriter.Button[6] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", "1");
-
- _сontrolWriter.Button[7] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "MenuShowDelay", "20");
-
- _сontrolWriter.Button[8] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseHoverTime", "20");
-
- _сontrolWriter.Button[9] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", "0");
-
- _сontrolWriter.Button[10] =
- RegistryHelp.CheckValueBytes(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "link", "0000");
-
- _сontrolWriter.Button[11] =
- HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0");
-
- _сontrolWriter.Button[12] =
- HardwareData.OS.IsWin11 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1") ||
- HardwareData.OS.Name.IndexOf("home", StringComparison.OrdinalIgnoreCase) < 0 &&
- (RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", "1")));
-
- _сontrolWriter.Button[13] =
- HardwareData.OS.IsWin11 && RegistryHelp.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", true);
-
- _сontrolWriter.Button[14] =
- HardwareData.OS.IsWin11 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", "0"));
-
- _сontrolWriter.Button[15] =
- HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", "1", true);
-
- _сontrolWriter.Button[16] =
- HardwareData.OS.IsWin11 &&
- (RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1"));
-
- _сontrolWriter.Button[17] =
- HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", "1", true);
-
- _сontrolWriter.Button[18] =
- HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", "0");
-
- _сontrolWriter.Button[19] =
- HardwareData.OS.IsWin11 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0")) ||
- HardwareData.OS.IsWin10 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0"));
-
- _сontrolWriter.Button[20] =
- HardwareData.OS.IsWin11 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", "0")) ||
- HardwareData.OS.IsWin10 &&
- (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0"));
-
- _сontrolWriter.Button[21] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", "0", true);
-
- _сontrolWriter.Button[22] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", "0") ||
- (HardwareData.OS.IsWin11 && (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", "0"))) ||
- (HardwareData.OS.IsWin10 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "1"));
-
- _сontrolWriter.Button[23] =
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
-
- _сontrolWriter.Button[24] =
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}") ||
- RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
-
- _сontrolWriter.Button[25] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "JPEGImportQuality", "100");
-
- _сontrolWriter.Button[26] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", "0");
-
- _сontrolWriter.Button[27] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", "1");
-
- _сontrolWriter.Button[28] =
- HardwareData.OS.Build >= 22621m ? RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", "1") :
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", "1");
-
- _сontrolWriter.Button[29] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", "1") ||
- (HardwareData.OS.Build >= 22000m && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", "0"));
- }
+ [InterfaceToggle.CursorFlickerFrequency] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "CursorBlinkRate", "530", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "CursorBlinkRate", state ? "530" : "200", RegistryValueKind.String)
+ ),
+ [InterfaceToggle.ScrollbarSize] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollHeight", "-210") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollWidth", "-210");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollHeight", state ? "-255" : "-210", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollWidth", state ? "-255" : "-210", RegistryValueKind.String);
+ }
+ ),
- internal void ApplyTweaks(string tweak, string value)
- {
- INIManager.TempWrite(INIManager.TempTweaksIntf, tweak, value);
+ [InterfaceToggle.TaskbarTransparency] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", "0"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
- switch (tweak)
- {
- case "ColorPicker1":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Colors", "Hilight", value, RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Colors", "HotTrackingColor", value == "0 120 215" ? "0 102 204" : value, RegistryValueKind.String);
- break;
- case "ColorPicker2":
- RegistryHelp.Write(Registry.Users, @".DEFAULT\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
- RegistryHelp.Write(Registry.Users, @"S-1-5-19\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
- RegistryHelp.Write(Registry.Users, @"S-1-5-20\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
- break;
- default:
- break;
- }
- }
+ [InterfaceToggle.TaskbarDarkTheme] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", "1"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
- internal void ApplyTweaks(string tweak, bool state)
- {
- INIManager.TempWrite(INIManager.TempTweaksIntf, tweak, state);
+ [InterfaceToggle.AppDarkTheme] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", "1"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
- switch (tweak)
- {
- case "Checkbox1":
- string baseKey = HardwareData.OS.Build > 22621m ? @"NameSpace" : @"NameSpace_36354489";
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\ShellFolder", "Attributes", unchecked((int)0xB0940064), RegistryValueKind.DWord);
- }
- else
+ [InterfaceToggle.ContextMenuDelay] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "MenuShowDelay", "20"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "MenuShowDelay", state ? "400" : "20", RegistryValueKind.String)
+ ),
+
+ [InterfaceToggle.TaskbarPreviewDelay] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseHoverTime", "20"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseHoverTime", state ? "400" : "20", RegistryValueKind.String)
+ ),
+
+ [InterfaceToggle.IconOverlayBadges] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}");
- }
- break;
- case "Checkbox2":
- if (state)
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", "0");
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", state ? 1 : 0, RegistryValueKind.DWord);
+
+ try
+ {
+ Task.Run(delegate
+ {
+ if (state)
+ {
+ if (File.Exists(PathLocator.Files.BlankIcon))
+ {
+ File.Delete(PathLocator.Files.BlankIcon);
+ }
+
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
+ }
+ else
+ {
+ ArchiveManager.Unarchive(PathLocator.Files.BlankIcon, Properties.Resources.Blank);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);
+ }
+ });
+ }
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
- else
+ ),
+
+ [InterfaceToggle.ShortcutNameSuffix] = (
+ Check: () => RegistryHelp.CheckValueBytes(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "link", "0000"),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", string.Empty, @"{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", string.Empty, @"{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", RegistryValueKind.String);
- }
- break;
- case "Checkbox3":
- RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
- break;
- case string checkbox when new[] { "Checkbox4", "Checkbox5", "Checkbox6", "Checkbox7" }.Contains(checkbox):
- {
- (string name, int value) = checkbox switch
- {
- "Checkbox4" => ("Hidden", 1),
- "Checkbox5" => ("ShowSuperHidden", 1),
- "Checkbox6" => ("HideFileExt", 0),
- _ => ("HideDrivesWithNoMedia", 0)
- };
-
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", name, state ? 1 - value : value, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link", Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
+ }
}
+ ),
+
+ [InterfaceToggle.TaskbarAlignment] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
- break;
- case string checkbox when new[] { "Checkbox8", "Checkbox9", "Checkbox10", "Checkbox11", "Checkbox12", "Checkbox13" }.Contains(checkbox):
+ [InterfaceToggle.StartMenuLayout] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", checkbox switch
- {
- "Checkbox8" => ("{20D04FE0-3AEA-1069-A2D8-08002B30309D}"),
- "Checkbox9" => ("{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"),
- "Checkbox10" => ("{645FF040-5081-101B-9F08-00AA002F954E}"),
- "Checkbox11" => ("{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"),
- "Checkbox12" => ("{59031A47-3F72-44A7-89C5-5595FE6B30EE}"),
- _ => ("{018D5C66-4533-4307-9B53-224DE2ED1FE6}")
- }, state ? 1 : 0, RegistryValueKind.DWord);
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1") ||
+ HardwareData.OS.Name.IndexOf("home", StringComparison.OrdinalIgnoreCase) < 0 &&
+ (RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", "1")));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", state ? 0 : 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton1":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionHeight", state ? "-330" : "-270", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionWidth", state ? "-330" : "-270", RegistryValueKind.String);
- break;
- case "TglButton2":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "CursorBlinkRate", state ? "530" : "200", RegistryValueKind.String);
- break;
- case "TglButton3":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollHeight", state ? "-255" : "-210", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollWidth", state ? "-255" : "-210", RegistryValueKind.String);
- break;
- case "TglButton4":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton5":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton6":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton7":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "MenuShowDelay", state ? "400" : "20", RegistryValueKind.String);
- break;
- case "TglButton8":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseHoverTime", state ? "400" : "20", RegistryValueKind.String);
- break;
- case "TglButton9":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", state ? 1 : 0, RegistryValueKind.DWord);
-
- try
- {
- Task.Run(delegate
+ if (HardwareData.OS.Name.IndexOf("Home", StringComparison.OrdinalIgnoreCase) < 0)
{
if (state)
{
- if (File.Exists(PathLocator.Files.BlankIcon))
- {
- File.Delete(PathLocator.Files.BlankIcon);
- }
-
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection");
}
else
{
- ArchiveManager.Unarchive(PathLocator.Files.BlankIcon, Properties.Resources.Blank);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", 1, RegistryValueKind.DWord);
}
- });
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- break;
- case "TglButton10":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link");
+ }
}
- else
+ ),
+
+ [InterfaceToggle.CompactContextMenu] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelp.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", true),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link", Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", "", "", RegistryValueKind.String);
+ }
}
- break;
- case "TglButton11":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton12":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", state ? 0 : 1, RegistryValueKind.DWord);
+ ),
- if (HardwareData.OS.Name.IndexOf("Home", StringComparison.OrdinalIgnoreCase) < 0)
+ [InterfaceToggle.TipsSuggestions] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", "0"));
+ },
+ Apply: (state) =>
{
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [InterfaceToggle.CompactExplorerMode] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", "1", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.CopilotRecall] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSAIFabricSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
if (state)
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 0, RegistryValueKind.DWord);
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 1, RegistryValueKind.DWord);
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad");
}
else
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI", "Value", "Deny", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels", "Value", "Deny", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat", "IsUserEligible", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "IsCopilotAvailable", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "CopilotDisabledReason", "FeatureIsDisabled", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings", 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableImageCreator", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableCocreator", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeFill", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeErase", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableRemoveBackground", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad", "DisableAIFeatures", 1, RegistryValueKind.DWord);
}
}
- break;
- case "TglButton13":
- if (state)
+ ),
+
+ [InterfaceToggle.TaskbarEndTask] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", "1", true),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+
+ [InterfaceToggle.SnapLayouts] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", "0"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.TaskbarIconsButtons] = (
+ Check: () =>
{
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}");
- }
- else
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0")) ||
+ HardwareData.OS.IsWin10 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0"));
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", "", "", RegistryValueKind.String);
- }
- break;
- case "TglButton14":
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton15":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton16":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSAIFabricSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- if (state)
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 0, RegistryValueKind.DWord);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 0, RegistryValueKind.DWord);
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 1, RegistryValueKind.DWord);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (HardwareData.OS.IsWin11)
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller(@"/c del /q /f ""%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*Copilot*.lnk""");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state || HardwareData.OS.Build.CompareTo(22635.3785m) < 0)
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", "", "Windows Spotlight", RegistryValueKind.String);
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
+ }
+ else
+ {
+ RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", 1, RegistryValueKind.DWord);
+ }
+ }
+ else if (HardwareData.OS.IsWin10)
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests", "value", 0, RegistryValueKind.DWord);
+ }
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Feeds", "ShellFeedsTaskbarViewMode", state ? 0 : 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", state ? 1 : 0, RegistryValueKind.DWord);
+ }
}
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI", "Value", "Deny", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels", "Value", "Deny", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat", "IsUserEligible", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "IsCopilotAvailable", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "CopilotDisabledReason", "FeatureIsDisabled", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableImageCreator", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableCocreator", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeFill", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeErase", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableRemoveBackground", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad", "DisableAIFeatures", 1, RegistryValueKind.DWord);
+ ),
+
+ [InterfaceToggle.PersonalizedAds] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", "0")) ||
+ HardwareData.OS.IsWin10 &&
+ (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (HardwareData.OS.IsWin10)
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ else if (HardwareData.OS.IsWin11)
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
}
- break;
- case "TglButton17":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton18":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton19":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", state ? 1 : 0, RegistryValueKind.DWord);
+ ),
- if (HardwareData.OS.IsWin11)
+ [InterfaceToggle.RestoreFolderWindows] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", "0", true),
+ Apply: (state) =>
{
- CommandExecutor.RunCommandAsTrustedInstaller(@"/c del /q /f ""%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*Copilot*.lnk""");
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", state ? 1 : 0, RegistryValueKind.DWord);
-
- if (state || HardwareData.OS.Build.CompareTo(22635.3785m) < 0)
+ if (state)
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", "", "Windows Spotlight", RegistryValueKind.String);
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", 1, RegistryValueKind.DWord);
}
else
{
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", 1, RegistryValueKind.DWord);
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers");
}
}
- else if (HardwareData.OS.IsWin10)
+ ),
+
+ [InterfaceToggle.TipsNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", "0") ||
+ (HardwareData.OS.IsWin11 && (RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", "0"))) ||
+ (HardwareData.OS.IsWin10 && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "1"));
+ },
+ Apply: (state) =>
{
if (state)
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled");
}
else
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests", "value", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", 0, RegistryValueKind.DWord);
}
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Feeds", "ShellFeedsTaskbarViewMode", state ? 0 : 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", state ? 1 : 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton20":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- if (HardwareData.OS.IsWin10)
- {
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- }
- else if (HardwareData.OS.IsWin11)
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ if (HardwareData.OS.IsWin10)
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);
+ }
+ }
+ else if (HardwareData.OS.IsWin11)
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
}
- break;
- case "TglButton21":
- if (state)
+ ),
+
+ [InterfaceToggle.ComputerFolders] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", 1, RegistryValueKind.DWord);
- }
- else
+ return RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers");
+ if (state)
+ {
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
+ }
+ else
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
+ }
}
- break;
- case "TglButton22":
- if (state)
+ ),
+
+ [InterfaceToggle.Explorer3DObjects] = (
+ Check: () =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled");
- }
- else
+ return RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}") ||
+ RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ }
+ else
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ }
+
+ CommandExecutor.RunCommand(state ? @"/c rd /s /q ""%userprofile%\3D Objects""" : @"/c mkdir ""%userprofile%\3D Objects""");
}
+ ),
- if (HardwareData.OS.IsWin10)
+ [InterfaceToggle.JpegWallpaperCompression] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "JPEGImportQuality", "100"),
+ Apply: (state) =>
{
if (state)
{
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality");
}
else
{
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality", 100, RegistryValueKind.DWord);
}
}
- else if (HardwareData.OS.IsWin11)
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton23":
- if (state)
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
- }
- else
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
- }
- break;
- case "TglButton24":
- if (state)
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
- }
- else
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
- }
+ ),
- CommandExecutor.RunCommand(state ? @"/c rd /checkbox /q ""%userprofile%\3D Objects""" : @"/c mkdir ""%userprofile%\3D Objects""");
- break;
- case "TglButton25":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality");
- }
- else
+ [InterfaceToggle.DesktopTooltips] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", "0"),
+ Apply: (state) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.BingStartSearch] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", "1"),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality", 100, RegistryValueKind.DWord);
- }
- break;
- case "TglButton26":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton27":
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer");
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", 1, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [InterfaceToggle.OpenQuickAccess] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton28":
- if (HardwareData.OS.Build >= 22621m)
+ return HardwareData.OS.Build >= 22621m ? RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", "1") :
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", "1");
+ },
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", state ? 0 : 1, RegistryValueKind.DWord);
+ if (HardwareData.OS.Build >= 22621m)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", state ? 2 : 1, RegistryValueKind.DWord);
+ }
}
- else
+ ),
+
+ [InterfaceToggle.AdaptiveBrightness] = (
+ Check: () =>
{
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", state ? 2 : 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton29":
- if (state)
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", "1") ||
+ (HardwareData.OS.Build >= 22000m && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", "0"));
+ },
+ Apply: (state) =>
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC");
- if (HardwareData.OS.Build >= 22000m)
+ if (state)
{
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC");
+ if (HardwareData.OS.Build >= 22000m)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption");
+ }
}
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", 1, RegistryValueKind.DWord);
- if (HardwareData.OS.Build >= 22000m)
+ else
{
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", 1, RegistryValueKind.DWord);
+ if (HardwareData.OS.Build >= 22000m)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", 0, RegistryValueKind.DWord);
+ }
}
}
- break;
- default:
- break;
+ ),
+ };
+ }
+
+ internal void CheckAll()
+ {
+ foreach (var tweak in _colorTweaks)
+ {
+ _сontrolWriter.ColorPicker[(int)tweak.Key] = tweak.Value.Check();
+ }
+
+ foreach (var tweak in _cbTweaks)
+ {
+ _сontrolWriter.Checkbox[(int)tweak.Key] = tweak.Value.Check();
+ }
+
+ foreach (var tweak in _tglTweaks)
+ {
+ _сontrolWriter.ToggleButton[(int)tweak.Key] = tweak.Value.Check();
+ }
+ }
+
+ internal void Apply(string controlName, string value)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksIntf, controlName, value);
+
+ if (controlName.StartsWith("ColorPicker") && int.TryParse(controlName.Substring(11), out int index))
+ {
+ if (_colorTweaks.TryGetValue((InterfaceColor)index, out var action))
+ {
+ action.Apply(value);
+ }
+ }
+ }
+
+ internal void Apply(string controlName, bool state)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksIntf, controlName, state);
+
+ if (controlName.StartsWith("TglButton") && int.TryParse(controlName.Substring(9), out int tglIndex))
+ {
+ if (_tglTweaks.TryGetValue((InterfaceToggle)tglIndex, out var action))
+ {
+ action.Apply(state);
+ }
+ }
+ else if (controlName.StartsWith("Checkbox") && int.TryParse(controlName.Substring(8), out int cbIndex))
+ {
+ if (_cbTweaks.TryGetValue((InterfaceCheckbox)cbIndex, out var action))
+ {
+ action.Apply(state);
+ }
}
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 69be789c..2c9c297a 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -10,455 +10,627 @@ using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
+ internal enum ServiceToggle
+ {
+ WindowsSearch = 1,
+ Xbox,
+ WindowsUpdate,
+ WindowsStore,
+ PerformanceCounters,
+ Biometrics,
+ Bluetooth,
+ Printers,
+ Scanner,
+ Fax,
+ TabletMobileMode,
+ SecondaryMonitors,
+ SystemComponents,
+ LocalNetwork,
+ UsbModemsRouters,
+ VpnClients,
+ WindowsMedia,
+ RemoteDesktop,
+ ErrorEventLogging,
+ WebDav,
+ SmartCards,
+ WindowsKiosk,
+ FileEncryption,
+ WindowsLocalization,
+ BackgroundSecurityCheck,
+ BackgroundDiagnostics,
+ CorporateTools,
+ HyperV,
+ PushNotifications,
+ RetailDemo,
+ EdgeUpdates,
+ MultimediaClassScheduler,
+ Geolocation
+ }
+
internal sealed class ServicesTweaks : FirewallManager
{
internal readonly static Dictionary<string, object> ControlStates = new Dictionary<string, object>();
private readonly ControlWriterManager _сontrolWriter = new ControlWriterManager(ControlStates);
+ private readonly Dictionary<ServiceToggle, (Func<bool> Check, Action<bool> Apply)> _tglTweaks;
- internal void AnalyzeAndUpdate()
+ public ServicesTweaks()
{
- _сontrolWriter.Button[1] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WSearch", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fhsvc", "Start", "4");
-
- _сontrolWriter.Button[2] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", "4");
-
- _сontrolWriter.Button[3] = PathLocator.Targets.WindowsUpdate.Mappings.All(f => File.Exists(f.Normal));
-
- _сontrolWriter.Button[4] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WalletService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VacSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\spectrum", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedRealitySvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\perceptionsimulation", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MixedRealityOpenXRSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MapsBroker", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EntAppSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\embeddedmode", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlidsvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WEPHOSTSVC", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\StorSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClipSVC", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InstallService", "Start", "4");
-
- _сontrolWriter.Button[5] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pla", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfHost", "Start", "4");
-
- _сontrolWriter.Button[6] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", "4");
-
- _сontrolWriter.Button[7] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bthserv", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTAGService", "Start", "4");
-
- _сontrolWriter.Button[8] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", "4") || IsTaskEnabled(printTasks);
-
- _сontrolWriter.Button[9] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", "4");
-
- _сontrolWriter.Button[10] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Fax", "Start", "4");
-
- _сontrolWriter.Button[11] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", "4");
-
- _сontrolWriter.Button[12] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", "4");
-
- _сontrolWriter.Button[13] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", "4");
-
- _сontrolWriter.Button[14] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CscService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lmhosts", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FDResPub", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fdPHost", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", "4");
-
- _сontrolWriter.Button[15] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", "4");
-
- _сontrolWriter.Button[16] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", "4");
-
- _сontrolWriter.Button[17] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", "4");
-
- _сontrolWriter.Button[18] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DsSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", "4");
-
- _сontrolWriter.Button[19] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WerSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", "4");
-
- _сontrolWriter.Button[20] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient", "Start", "4");
-
- _сontrolWriter.Button[21] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", "4");
-
- _сontrolWriter.Button[22] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", "4");
-
- _сontrolWriter.Button[23] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BDESVC", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EFS", "Start", "4");
-
- _сontrolWriter.Button[24] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", "4");
-
- _сontrolWriter.Button[25] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", "4");
-
- _сontrolWriter.Button[26] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DPS", "Start", "4");
-
- _сontrolWriter.Button[27] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\dot3svc", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", "4");
-
- _сontrolWriter.Button[28] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HvHost", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvss", "Start", "4");
-
- _сontrolWriter.Button[29] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WpnService", "Start", "4");
-
- _сontrolWriter.Button[30] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", "4");
-
- _сontrolWriter.Button[31] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", "4") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", "4") ||
- RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", string.Empty).IndexOf(PathLocator.Targets.WindowsUpdate.UsoClient.Normal, StringComparison.OrdinalIgnoreCase) >= 0 ||
- IsTaskEnabled(edgeTasks);
-
- _сontrolWriter.Button[32] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MMCSS", "Start", "4");
-
- _сontrolWriter.Button[33] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lfsvc", "Start", "4") || IsTaskEnabled(geoTasks);
- }
+ _tglTweaks = new Dictionary<ServiceToggle, (Func<bool> Check, Action<bool> Apply)>
+ {
+ [ServiceToggle.WindowsSearch] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WSearch", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fhsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSearch", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fhsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
- internal void ApplyTweaks(string tweak, bool state)
- {
- INIManager.TempWrite(INIManager.TempTweaksSvc, tweak, state);
+ [ServiceToggle.Xbox] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- switch (tweak)
- {
- case "TglButton1":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSearch", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fhsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton2":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- SetTaskState(state, xboxTasks);
- break;
- case "TglButton3":
- BlockWindowsUpdate(state);
- ChangeAccessUpdateFolders(state);
-
- foreach ((string Normal, string Block) in PathLocator.Targets.WindowsUpdate.Mappings)
- {
- string currentFilePath = state ? Block : Normal;
- string targetFilePath = state ? Normal : Block;
+ SetTaskState(state, xboxTasks);
+ }
+ ),
- try
+ [ServiceToggle.WindowsUpdate] = (
+ Check: () => PathLocator.Targets.WindowsUpdate.Mappings.All(f => File.Exists(f.Normal)),
+ Apply: (state) =>
+ {
+ BlockWindowsUpdate(state);
+ ChangeAccessUpdateFolders(state);
+
+ foreach ((string Normal, string Block) in PathLocator.Targets.WindowsUpdate.Mappings)
{
- if (state)
- {
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
- $@"(if exist ""{targetFilePath}"" (takeown /f ""{targetFilePath}"" /a && del /f /q /a ""{targetFilePath}"") else (cd .))",
- $@"takeown /f ""{currentFilePath}"" /a",
- $@"rename ""{currentFilePath}"" ""{Path.GetFileName(targetFilePath)}""",
- $@"icacls ""{targetFilePath}"" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",
- $@"icacls ""{targetFilePath}"" /inheritance:r",
- $@"icacls ""{targetFilePath}"" /grant *S-1-5-32-544:F",
- $@"icacls ""{targetFilePath}"" /grant *S-1-5-32-545:R",
- $@"icacls ""{targetFilePath}"" /grant *S-1-5-18:F",
- $@"icacls ""{targetFilePath}"" /grant *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464:F",
- $@"icacls ""{targetFilePath}"" /grant *S-1-15-2-1:R",
- $@"icacls ""{targetFilePath}"" /grant *S-1-15-2-2:R",
- $@"icacls ""{targetFilePath}"" /remove ""{Environment.UserName}"""}))}""");
- }
- else
+ string currentFilePath = state ? Block : Normal;
+ string targetFilePath = state ? Normal : Block;
+
+ try
{
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
- $@"takeown /f ""{currentFilePath}"" /a",
- $@"icacls ""{currentFilePath}"" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18",
- $@"icacls ""{currentFilePath}"" /grant ""{Environment.UserName}"":F",
- $@"(if exist ""{targetFilePath}"" (takeown /f ""{targetFilePath}"" /a && del /f /q /a ""{targetFilePath}"") else (cd .))",
- $@"rename ""{currentFilePath}"" ""{Path.GetFileName(targetFilePath)}"""}))}""");
+ if (state)
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ $@"(if exist ""{targetFilePath}"" (takeown /f ""{targetFilePath}"" /a && del /f /q /a ""{targetFilePath}"") else (cd .))",
+ $@"takeown /f ""{currentFilePath}"" /a",
+ $@"rename ""{currentFilePath}"" ""{Path.GetFileName(targetFilePath)}""",
+ $@"icacls ""{targetFilePath}"" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",
+ $@"icacls ""{targetFilePath}"" /inheritance:r",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-5-32-544:F",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-5-32-545:R",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-5-18:F",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464:F",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-15-2-1:R",
+ $@"icacls ""{targetFilePath}"" /grant *S-1-15-2-2:R",
+ $@"icacls ""{targetFilePath}"" /remove ""{Environment.UserName}"""}))}""");
+ }
+ else
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ $@"takeown /f ""{currentFilePath}"" /a",
+ $@"icacls ""{currentFilePath}"" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18",
+ $@"icacls ""{currentFilePath}"" /grant ""{Environment.UserName}"":F",
+ $@"(if exist ""{targetFilePath}"" (takeown /f ""{targetFilePath}"" /a && del /f /q /a ""{targetFilePath}"") else (cd .))",
+ $@"rename ""{currentFilePath}"" ""{Path.GetFileName(targetFilePath)}"""}))}""");
+ }
}
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ }
+
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wisvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DmEnrollmentSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wuauserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WaaSMedicSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UsoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate\AU", "AutomaticMaintenanceEnabled", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DisableWindowsUpdateAccess", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DoNotConnectToWindowsUpdateInternetLocations", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
+ ),
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wisvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DmEnrollmentSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wuauserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WaaSMedicSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UsoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ [ServiceToggle.WindowsStore] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WalletService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VacSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\spectrum", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedRealitySvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\perceptionsimulation", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MixedRealityOpenXRSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MapsBroker", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EntAppSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\embeddedmode", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlidsvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WEPHOSTSVC", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\StorSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClipSVC", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InstallService", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c {string.Join(" & ", new[] { "WalletService", "VacSvc", "spectrum", "SharedRealitySvc", "perceptionsimulation", "MixedRealityOpenXRSvc", "MapsBroker", "EntAppSvc",
+ "embeddedmode", "wlidsvc", "WEPHOSTSVC", "StorSvc", "ClipSVC", "InstallService" }.Select(s => $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\{s} /v Start /t REG_DWORD /d {(state ? "3" : "4")} /f"))}");
+ }
+ ),
- if (state)
+ [ServiceToggle.PerformanceCounters] = (
+ Check: () =>
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate");
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pla", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfHost", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\pla", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PerfHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
}
- else
+ ),
+
+ [ServiceToggle.Biometrics] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", "4"),
+ Apply: (state) =>
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate\AU", "AutomaticMaintenanceEnabled", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DisableWindowsUpdateAccess", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DoNotConnectToWindowsUpdateInternetLocations", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
}
- break;
- case "TglButton4":
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c {string.Join(" & ", new[] { "WalletService", "VacSvc", "spectrum", "SharedRealitySvc", "perceptionsimulation", "MixedRealityOpenXRSvc", "MapsBroker", "EntAppSvc",
- "embeddedmode", "wlidsvc", "WEPHOSTSVC", "StorSvc", "ClipSVC", "InstallService" }.Select(s => $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\{s} /v Start /t REG_DWORD /d {(state ? "3" : "4")} /f"))}");
- break;
- case "TglButton5":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\pla", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PerfHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton6":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton7":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\bthserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BTAGService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- SetTaskState(state, bluetoothTask);
- break;
- case "TglButton8":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
-
- if (!state)
- {
- CommandExecutor.RunCommandAsTrustedInstaller(@$"/c net stop spooler && del /F /Q %systemroot%\System32\spool\PRINTERS\*.*");
+ ),
+
+ [ServiceToggle.Bluetooth] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bthserv", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTAGService", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\bthserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BTAGService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+
+ SetTaskState(state, bluetoothTask);
}
+ ),
- try
+ [ServiceToggle.Printers] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", "4") || IsTaskEnabled(printTasks);
+ },
+ Apply: (state) =>
{
- using RegistryKey baseKey = Registry.ClassesRoot.OpenSubKey("SystemFileAssociations", true);
- if (baseKey != null)
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+
+ if (!state)
{
- foreach (string subkey in baseKey.GetSubKeyNames())
+ CommandExecutor.RunCommandAsTrustedInstaller(@$"/c net stop spooler && del /F /Q %systemroot%\System32\spool\PRINTERS\*.*");
+ }
+
+ try
+ {
+ using RegistryKey baseKey = Registry.ClassesRoot.OpenSubKey("SystemFileAssociations", true);
+ if (baseKey != null)
{
- try
+ foreach (string subkey in baseKey.GetSubKeyNames())
{
- using RegistryKey assocKey = baseKey.OpenSubKey(subkey, true);
- if (assocKey != null)
+ try
{
- using RegistryKey shellKey = assocKey.OpenSubKey("Shell", true);
- if (shellKey != null)
+ using RegistryKey assocKey = baseKey.OpenSubKey(subkey, true);
+ if (assocKey != null)
{
- if (shellKey.GetSubKeyNames().Any(k => k.Equals("print", StringComparison.OrdinalIgnoreCase)))
+ using RegistryKey shellKey = assocKey.OpenSubKey("Shell", true);
+ if (shellKey != null)
{
- if (state)
+ if (shellKey.GetSubKeyNames().Any(k => k.Equals("print", StringComparison.OrdinalIgnoreCase)))
{
- RegistryHelp.DeleteValue(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly");
- }
- else
- {
- RegistryHelp.Write(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly", string.Empty, RegistryValueKind.String);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly", string.Empty, RegistryValueKind.String);
+ }
}
}
}
}
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
}
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+
+ SetTaskState(state, printTasks);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- SetTaskState(state, printTasks);
- break;
- case "TglButton9":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton10":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Fax", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton11":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton12":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton13":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton14":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Netlogon", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CscService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\lmhosts", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\FDResPub", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fdPHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton15":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\icssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton16":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton17":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton18":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TermService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DsSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton19":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton20":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WebClient", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton21":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CertPropSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton22":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton23":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BDESVC", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\EFS", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton24":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton25":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- break;
- case "TglButton26":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", state ? 2 : 4, RegistryValueKind.DWord, true);
- break;
- case "TglButton27":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- break;
- case "TglButton28":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\HvHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvss", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- break;
- case "TglButton29":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton30":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- SetTaskState(state, retailTasks);
- break;
- case "TglButton31":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", state ? PathLocator.Targets.WindowsUpdate.UsoClient.Normal : "dllhost.exe", RegistryValueKind.String);
- SetTaskState(state, edgeTasks);
- break;
- case "TglButton32":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MMCSS", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
- break;
- case "TglButton33":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\lfsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
- SetTaskState(state, geoTasks);
- break;
- default:
- break;
+ ),
+
+ [ServiceToggle.Scanner] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.Fax] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Fax", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Fax", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.TabletMobileMode] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.SecondaryMonitors] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.SystemComponents] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", "4"),
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.LocalNetwork] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CscService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lmhosts", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FDResPub", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fdPHost", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Netlogon", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CscService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\lmhosts", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\FDResPub", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fdPHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.UsbModemsRouters] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\icssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.VpnClients] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsMedia] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.RemoteDesktop] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DsSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TermService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DsSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.ErrorEventLogging] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WerSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WebDav] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WebClient", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.SmartCards] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CertPropSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsKiosk] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.FileEncryption] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BDESVC", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EFS", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BDESVC", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\EFS", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsLocalization] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.BackgroundSecurityCheck] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.BackgroundDiagnostics] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DPS", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", state ? 2 : 4, RegistryValueKind.DWord, true);
+ }
+ ),
+
+ [ServiceToggle.CorporateTools] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\dot3svc", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ }
+ ),
+
+ [ServiceToggle.HyperV] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HvHost", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvss", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\HvHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvss", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.PushNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WpnService", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.RetailDemo] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", "4"),
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ SetTaskState(state, retailTasks);
+ }
+ ),
+
+ [ServiceToggle.EdgeUpdates] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", "4") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", "4") ||
+ RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", string.Empty).IndexOf(PathLocator.Targets.WindowsUpdate.UsoClient.Normal, StringComparison.OrdinalIgnoreCase) >= 0 ||
+ IsTaskEnabled(edgeTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", state ? PathLocator.Targets.WindowsUpdate.UsoClient.Normal : "dllhost.exe", RegistryValueKind.String);
+
+ SetTaskState(state, edgeTasks);
+ }
+ ),
+
+ [ServiceToggle.MultimediaClassScheduler] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MMCSS", "Start", "4"),
+ Apply: (state) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MMCSS", "Start", state ? 3 : 4, RegistryValueKind.DWord, true)
+ ),
+
+ [ServiceToggle.Geolocation] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lfsvc", "Start", "4") || IsTaskEnabled(geoTasks),
+ Apply: (state) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\lfsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ SetTaskState(state, geoTasks);
+ }
+ ),
+ };
+ }
+
+ internal void CheckAll()
+ {
+ foreach (var tweak in _tglTweaks)
+ {
+ _сontrolWriter.ToggleButton[(int)tweak.Key] = tweak.Value.Check();
+ }
+ }
+
+ internal void Apply(string tweakName, bool state)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksConf, tweakName, state);
+
+ if (tweakName.StartsWith("TglButton") && int.TryParse(tweakName.Substring(9), out int index))
+ {
+ ServiceToggle tweakKey = (ServiceToggle)index;
+
+ if (_tglTweaks.TryGetValue(tweakKey, out var action))
+ {
+ action.Apply(state);
+ }
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index b1339af7..c1388beb 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -27,6 +27,47 @@ namespace GTweak.Utilities.Tweaks
internal const uint SPI_SETMOUSE = 0x0004;
};
+ internal enum SystemSlider
+ {
+ MouseSensitivity = 1,
+ KeyboardDelay,
+ KeyboardSpeed
+ }
+
+ internal enum SystemToggle
+ {
+ PointerPrecision = 1,
+ StickyKeysFilter,
+ WindowsDefender,
+ UserAccountControl,
+ SecurityNotifications,
+ StoreAutoUpdate,
+ RealtekAudioDelay,
+ LockScreenTimeout,
+ HibernationFastStartup,
+ AutoEndTasks,
+ ExeLaunchWarnings,
+ MemoryDiagnostics,
+ NetworkProtocols,
+ FileSystemCache,
+ StartupDelay,
+ QuickAccessHistory,
+ RemovableMediaAutoplay,
+ PowerScheme,
+ BluetoothFunction,
+ WindowsFirewall,
+ GameMode,
+ GameBar,
+ BackgroundApps,
+ ReservedStorage,
+ DynamicTickHpet,
+ HealthCheck,
+ InsiderTasks,
+ SystemDriveDefrag,
+ PauseWindowsUpdates,
+ MultiPlaneOverlay
+ }
+
internal sealed class SystemTweaks : FirewallManager
{
private static bool _isNetshState = false, _isTickState = false;
@@ -34,163 +75,610 @@ namespace GTweak.Utilities.Tweaks
internal readonly static Dictionary<string, object> ControlStates = new Dictionary<string, object>();
private readonly ControlWriterManager _сontrolWriter = new ControlWriterManager(ControlStates);
+ private readonly Dictionary<SystemSlider, (Func<double> Check, Action<uint> Apply)> _sliderTweaks;
+ private readonly Dictionary<SystemToggle, (Func<bool> Check, Action<bool, bool> Apply)> _tglTweaks;
- public SystemTweaks() => _currentPowerGuid = RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes", "ActivePowerScheme", string.Empty);
-
- internal void AnalyzeAndUpdate()
+ public SystemTweaks()
{
- _сontrolWriter.Slider[1] = RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSensitivity", 10);
+ _currentPowerGuid = RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes", "ActivePowerScheme", string.Empty);
+
+ _sliderTweaks = new Dictionary<SystemSlider, (Func<double> Check, Action<uint> Apply)>
+ {
+ [SystemSlider.MouseSensitivity] = (
+ Check: () => RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSensitivity", 10),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETMOUSESPEED, value, value, 2);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSensitivity", value, RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Slider[2] = RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", 1);
+ [SystemSlider.KeyboardDelay] = (
+ Check: () => RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", 1),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETKEYBOARDDELAY, value, value, 2);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Keyboard", "KeyboardDelay", value, RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Slider[3] = RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardSpeed", 31);
+ [SystemSlider.KeyboardSpeed] = (
+ Check: () => RegistryHelp.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardSpeed", 31),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETKEYBOARDSPEED, value, value, 2);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Keyboard", "KeyboardSpeed", value, RegistryValueKind.String);
+ }
+ ),
+ };
+
+ _tglTweaks = new Dictionary<SystemToggle, (Func<bool> Check, Action<bool, bool> Apply)>
+ {
+ [SystemToggle.PointerPrecision] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSpeed", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold1", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold2", "0");
+ },
+ Apply: (state, _) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETMOUSE, 0, state ? new uint[] { 1, 6, 10 } : new uint[3], 2);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSpeed", state ? "1" : "0", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold1", state ? "6" : "0", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold2", state ? "10" : "0", RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Button[1] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSpeed", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold1", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold2", "0");
+ [SystemToggle.StickyKeysFilter] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "26") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "26");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Accessibility\StickyKeys", "Flags", state ? "507" : "26", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Accessibility\Keyboard Response", "Flags", state ? "58" : "26", RegistryValueKind.String);
+ }
+ ),
- _сontrolWriter.Button[2] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "26") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "26");
+ [SystemToggle.WindowsDefender] = (
+ Check: () => File.Exists(PathLocator.Targets.Defender.SmartScreen.Normal),
+ Apply: async (state, canShowWindow) =>
+ {
+ BlockWDefender(state);
+ ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);
+ ArchiveManager.Unarchive(PathLocator.Executable.DisablingWD, Properties.Resources.DisablingWD);
- _сontrolWriter.Button[3] = File.Exists(PathLocator.Targets.Defender.SmartScreen.Normal);
+ if (canShowWindow)
+ {
+ OverlayWindow overlayWindow = new OverlayWindow();
+ overlayWindow.Show();
- _сontrolWriter.Button[4] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "0");
+ BackgroundQueue backgroundQueue = new BackgroundQueue();
+ await backgroundQueue.QueueTask(delegate { NotificationManager.Show(state ? "info" : "warn", state ? "info_wd_noty" : "warn_wd_noty").Perform(); });
+ await backgroundQueue.QueueTask(delegate { WindowsDefender.SetProtectionState(state); });
- _сontrolWriter.Button[5] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1");
+ if (state)
+ {
+ await backgroundQueue.QueueTask(delegate { NotificationManager.Show().WithDelay(300).Restart(); });
+ CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathLocator.Executable.NSudo}\"");
+ }
- _сontrolWriter.Button[6] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", "2");
+ overlayWindow.Close();
+ }
+ else
+ {
+ WindowsDefender.SetProtectionState(state);
+ }
+ }
+ ),
- try
- {
- using RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}");
- if (regKey != null)
- {
- foreach (var subKeyName in regKey.GetSubKeyNames())
+ [SystemToggle.UserAccountControl] = (
+ Check: () =>
{
- if (subKeyName == "Properties")
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", state ? 5 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [SystemToggle.SecurityNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.StoreAutoUpdate] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", "2"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload");
+ }
+ else
{
- continue;
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", 2, RegistryValueKind.DWord);
}
+ }
+ ),
- using RegistryKey subKey = regKey.OpenSubKey(subKeyName);
- if (subKey != null)
+ [SystemToggle.RealtekAudioDelay] = (
+ Check: () =>
+ {
+ try
{
- if (subKey.GetValue("DriverDesc") is string driverDesc && driverDesc.Equals("Realtek High Definition Audio", StringComparison.OrdinalIgnoreCase))
+ using RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}");
+ if (regKey != null)
{
- using RegistryKey powerSettingsKey = subKey.OpenSubKey("PowerSettings");
- if (powerSettingsKey != null)
+ foreach (var subKeyName in regKey.GetSubKeyNames())
{
- if (!(powerSettingsKey.GetValue("ConservationIdleTime") is byte[] conservationIdleTime) || !(powerSettingsKey.GetValue("IdlePowerState") is byte[] idlePowerState) || !(powerSettingsKey.GetValue("PerformanceIdleTime") is byte[] performanceIdleTime))
+ if (subKeyName == "Properties")
{
- _сontrolWriter.Button[7] = false;
+ continue;
}
- else
+
+ using RegistryKey subKey = regKey.OpenSubKey(subKeyName);
+ if (subKey != null)
+ {
+ if (subKey.GetValue("DriverDesc") is string driverDesc && driverDesc.Equals("Realtek High Definition Audio", StringComparison.OrdinalIgnoreCase))
+ {
+ using RegistryKey powerSettingsKey = subKey.OpenSubKey("PowerSettings");
+ if (powerSettingsKey != null)
+ {
+ if (!(powerSettingsKey.GetValue("ConservationIdleTime") is byte[] conservationIdleTime) || !(powerSettingsKey.GetValue("IdlePowerState") is byte[] idlePowerState) || !(powerSettingsKey.GetValue("PerformanceIdleTime") is byte[] performanceIdleTime))
+ {
+ return false;
+ }
+
+ return conservationIdleTime?[0].ToString() != "255" || idlePowerState?[0].ToString() != "0" || performanceIdleTime?[0].ToString() != "255";
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+
+ return false;
+ },
+ Apply: (state, _) =>
+ {
+ try
+ {
+ using RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}");
+ if (regKey != null)
+ {
+ foreach (string subKeyName in regKey.GetSubKeyNames())
+ {
+ using RegistryKey subKey = regKey.OpenSubKey(subKeyName);
+ if (subKey != null)
{
- _сontrolWriter.Button[7] = conservationIdleTime?[0].ToString() != "255" || idlePowerState?[0].ToString() != "0" || performanceIdleTime?[0].ToString() != "255";
+ if (subKey.GetValue("DriverDesc") is string driverDesc && driverDesc.Equals("Realtek High Definition Audio", StringComparison.OrdinalIgnoreCase))
+ {
+ RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "ConservationIdleTime", state ? new byte[] { 0x0a, 0x00, 0x00, 0x00 } : new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "IdlePowerState", state ? new byte[] { 0x03, 0x00, 0x00, 0x00 } : Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
+ RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "PerformanceIdleTime", state ? new byte[] { 0x0a, 0x00, 0x00, 0x00 } : new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, RegistryValueKind.Binary);
+ }
}
}
}
}
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ ),
- _сontrolWriter.Button[8] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", "2");
+ [SystemToggle.LockScreenTimeout] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", "2"),
+ Apply: (state, _) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", state ? 1 : 2, RegistryValueKind.DWord)
+ ),
- _сontrolWriter.Button[9] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", "0");
+ [SystemToggle.HibernationFastStartup] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", state ? 1 : 0, RegistryValueKind.DWord);
+ CommandExecutor.RunCommand(@$"/c powercfg.exe -h {(state ? "on" : "off")}");
+ }
+ ),
- _сontrolWriter.Button[10] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "AutoEndTasks", "1");
+ [SystemToggle.AutoEndTasks] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "AutoEndTasks", "1"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks", "1", RegistryValueKind.String);
+ }
+ }
+ ),
- _сontrolWriter.Button[11] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", "1") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", "0");
+ [SystemToggle.ExeLaunchWarnings] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
- _сontrolWriter.Button[12] = IsTaskEnabled(memoryDiagTasks);
+ [SystemToggle.MemoryDiagnostics] = (
+ Check: () => IsTaskEnabled(memoryDiagTasks),
+ Apply: (state, _) => SetTaskState(state, memoryDiagTasks)
+ ),
- _сontrolWriter.Button[13] = _isNetshState;
+ [SystemToggle.NetworkProtocols] = (
+ Check: () => _isNetshState,
+ Apply: (state, _) =>
+ {
+ _isNetshState = state;
+ string tunnelState = state ? "default" : "disabled";
+ string privacyState = state ? "enabled" : "disabled";
- _сontrolWriter.Button[14] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", "1");
+ CommandExecutor.RunCommand($"/c netsh int teredo set state {tunnelState} & netsh int ipv6 6to4 set state state = {tunnelState} undoonstop = {tunnelState} & " +
+ $"netsh int ipv6 isatap set state state = {tunnelState} & netsh int ipv6 set privacy state = {privacyState} & " +
+ $"netsh int ipv6 set global randomizeidentifier = {privacyState} & netsh int isatap set state {tunnelState}");
+ }
+ ),
- _сontrolWriter.Button[15] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", "0");
+ [SystemToggle.FileSystemCache] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", "1"),
+ Apply: (state, _) => RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
- _сontrolWriter.Button[16] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0");
+ [SystemToggle.StartupDelay] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", "0"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
- _сontrolWriter.Button[17] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", "1");
+ [SystemToggle.QuickAccessHistory] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
- _сontrolWriter.Button[18] =
- !RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "Description", string.Empty).Contains("-18") &&
- !RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "FriendlyName", string.Empty).Contains("-19");
+ [SystemToggle.RemovableMediaAutoplay] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", "1"),
+ Apply: (state, _) => RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
- _сontrolWriter.Button[19] = BluetoothManager.IsEnabled;
+ [SystemToggle.PowerScheme] = (
+ Check: () =>
+ {
+ return !RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "Description", string.Empty).Contains("-18") &&
+ !RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "FriendlyName", string.Empty).Contains("-19");
+ },
+ Apply: (state, _) => SetPowercfg(state)
+ ),
- _сontrolWriter.Button[20] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mpssvc", "Start", "4");
+ [SystemToggle.BluetoothFunction] = (
+ Check: () => BluetoothManager.IsEnabled,
+ Apply: (state, _) => BluetoothManager.SetState(state)
+ ),
- _сontrolWriter.Button[21] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AutoGameModeEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AllowAutoGameMode", "0");
+ [SystemToggle.WindowsFirewall] = (
+ Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mpssvc", "Start", "4"),
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\mpssvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ CommandExecutor.RunCommand($"/c netsh advfirewall set allprofiles state {(state ? "on" : "off")}");
+ if (HardwareData.OS.Build.CompareTo(22621.521m) >= 0)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wtd", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ }
+ }
+ ),
- _сontrolWriter.Button[22] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", "0") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\System\GameConfigStore", "GameDVR_Enabled", "0");
+ [SystemToggle.GameMode] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AutoGameModeEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AllowAutoGameMode", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AutoGameModeEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AllowAutoGameMode", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
- _сontrolWriter.Button[23] =
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", "1") ||
- RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", "2");
+ [SystemToggle.GameBar] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\System\GameConfigStore", "GameDVR_Enabled", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"System\GameConfigStore", "GameDVR_Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
- _сontrolWriter.Button[24] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", "2") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", "0") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", "0");
+ [SystemToggle.BackgroundApps] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", "1") ||
+ RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", "2");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled");
+ RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle");
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", 0, RegistryValueKind.DWord);
+ RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", 2, RegistryValueKind.DWord);
+ }
+ }
+ ),
- _сontrolWriter.Button[25] = _isTickState;
+ [SystemToggle.ReservedStorage] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", "2") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", "0") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo");
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", 2, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 0, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.DynamicTickHpet] = (
+ Check: () => _isTickState,
+ Apply: (state, _) =>
+ {
+ _isTickState = state;
+ CommandExecutor.RunCommand(state ? $"{PathLocator.Executable.BcdEdit} /deletevalue disabledynamictick; {PathLocator.Executable.BcdEdit} /deletevalue useplatformclock" : $"{PathLocator.Executable.BcdEdit} /set disabledynamictick yes; {PathLocator.Executable.BcdEdit} /set useplatformclock false", true);
+ }
+ ),
+
+
+ [SystemToggle.HealthCheck] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHC", "PreviousUninstall", "1", true) ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealthCheck", "installed", "1", true);
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed", 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed");
+ }
+ }
+ ),
- _сontrolWriter.Button[26] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHC", "PreviousUninstall", "1", true) ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealthCheck", "installed", "1", true);
+ [SystemToggle.InsiderTasks] = (
+ Check: () => IsTaskEnabled(winInsiderTasks),
+ Apply: (state, _) => SetTaskState(state, winInsiderTasks)
+ ),
- _сontrolWriter.Button[27] = IsTaskEnabled(winInsiderTasks);
+ [SystemToggle.SystemDriveDefrag] = (
+ Check: () =>
+ {
+ return !IsTaskEnabled(defragTask) || RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", "N") ||
+ RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\defragsvc", "Start", "2");
+ },
+ Apply: (state, _) =>
+ {
+ SetTaskState(true, defragTask);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", state ? "Y" : "N", RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\services\defragsvc", "Start", 2, RegistryValueKind.DWord);
+ }
+ ),
- _сontrolWriter.Button[28] = !IsTaskEnabled(defragTask) ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", "N") ||
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\defragsvc", "Start", "2");
+ [SystemToggle.PauseWindowsUpdates] = (
+ Check: () =>
+ {
+ return DateTime.TryParse(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", string.Empty), null, System.Globalization.DateTimeStyles.RoundtripKind, out var start) &&
+ DateTime.TryParse(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime", string.Empty), null, System.Globalization.DateTimeStyles.RoundtripKind, out var end) &&
+ (end - start).TotalDays >= 3650;
+ },
+ Apply: (state, _) =>
+ {
+ if (!state)
+ {
+ DateTime now = DateTime.UtcNow;
+ string start = now.ToString("yyyy-MM-ddTHH:mm:ssZ");
+ string end = now.AddYears(10).ToString("yyyy-MM-ddTHH:mm:ssZ");
+
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime", end, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused", 1, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
+ CommandExecutor.RunCommand("/c gpupdate /force");
+ }
+ else
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime");
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime");
+ }
+ }
+ ),
- _сontrolWriter.Button[29] =
- DateTime.TryParse(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", string.Empty), null, System.Globalization.DateTimeStyles.RoundtripKind, out var start) &&
- DateTime.TryParse(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime", string.Empty), null, System.Globalization.DateTimeStyles.RoundtripKind, out var end) &&
- (end - start).TotalDays >= 3650;
+ [SystemToggle.MultiPlaneOverlay] = (
+ Check: () =>
+ {
+ return RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", "5") ||
+ (HardwareData.OS.Build >= 26200m && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", "0"));
+ },
+ Apply: (state, _) =>
+ {
+ bool isSupportedBuild = HardwareData.OS.Build >= 26200;
- _сontrolWriter.Button[30] =
- RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", "5") ||
- (HardwareData.OS.Build >= 26200m && RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", "0"));
+ if (state)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode");
+ if (isSupportedBuild)
+ {
+ RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay");
+ }
+ }
+ else
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", 5, RegistryValueKind.DWord);
+ if (isSupportedBuild)
+ {
+ RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", 0, RegistryValueKind.DWord);
+ }
+ }
+ }
+ ),
+ };
}
internal static void ViewNetshState()
@@ -213,361 +701,48 @@ namespace GTweak.Utilities.Tweaks
catch { _isTickState = false; }
}
- [DllImport("user32.dll")]
- private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint _pvParam, uint _fWinIni);
- internal void ApplyTweaks(string tweak, uint value)
+ internal void CheckAll()
{
- INIManager.TempWrite(INIManager.TempTweaksSys, tweak, value);
+ foreach (var tweak in _sliderTweaks)
+ {
+ _сontrolWriter.Slider[(int)tweak.Key] = tweak.Value.Check();
+ }
- switch (tweak)
+ foreach (var tweak in _tglTweaks)
{
- case "Slider1":
- SystemParametersInfo(UIAction.SPI_SETMOUSESPEED, value, value, 2);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSensitivity", value, RegistryValueKind.String);
- break;
- case "Slider2":
- SystemParametersInfo(UIAction.SPI_SETKEYBOARDDELAY, value, value, 2);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Keyboard", "KeyboardDelay", value, RegistryValueKind.String);
- break;
- case "Slider3":
- SystemParametersInfo(UIAction.SPI_SETKEYBOARDSPEED, value, value, 2);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Keyboard", "KeyboardSpeed", value, RegistryValueKind.String);
- break;
- default:
- break;
+ _сontrolWriter.ToggleButton[(int)tweak.Key] = tweak.Value.Check();
}
}
[DllImport("user32.dll")]
- private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint[] _pvParam, uint _fWinIni);
- internal async void ApplyTweaks(string tweak, bool state, bool canShowWindow = true)
+ private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint _pvParam, uint _fWinIni);
+
+ internal void Apply(string controlName, uint value)
{
- INIManager.TempWrite(INIManager.TempTweaksSys, tweak, state);
+ INIManager.TempWrite(INIManager.TempTweaksSys, controlName, value);
- switch (tweak)
+ if (controlName.StartsWith("Slider") && int.TryParse(controlName.Substring(6), out int index))
{
- case "TglButton1":
- SystemParametersInfo(UIAction.SPI_SETMOUSE, 0, state ? new uint[] { 1, 6, 10 } : new uint[3], 2);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSpeed", state ? "1" : "0", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold1", state ? "6" : "0", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold2", state ? "10" : "0", RegistryValueKind.String);
- break;
- case "TglButton2":
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Accessibility\StickyKeys", "Flags", state ? "507" : "26", RegistryValueKind.String);
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Accessibility\Keyboard Response", "Flags", state ? "58" : "26", RegistryValueKind.String);
- break;
- case "TglButton3":
- BlockWDefender(state);
- ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);
- ArchiveManager.Unarchive(PathLocator.Executable.DisablingWD, Properties.Resources.DisablingWD);
-
- if (canShowWindow)
- {
- OverlayWindow overlayWindow = new OverlayWindow();
- overlayWindow.Show();
-
- BackgroundQueue backgroundQueue = new BackgroundQueue();
- await backgroundQueue.QueueTask(delegate { NotificationManager.Show(state ? "info" : "warn", state ? "info_wd_noty" : "warn_wd_noty").Perform(); });
- await backgroundQueue.QueueTask(delegate { WindowsDefender.SetProtectionState(state); });
+ if (_sliderTweaks.TryGetValue((SystemSlider)index, out var action))
+ {
+ action.Apply(value);
+ }
+ }
+ }
- if (state)
- {
- await backgroundQueue.QueueTask(delegate { NotificationManager.Show().WithDelay(300).Restart(); });
- CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathLocator.Executable.NSudo}\"");
- }
+ [DllImport("user32.dll")]
+ private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint[] _pvParam, uint _fWinIni);
- overlayWindow.Close();
- }
- else
- {
- WindowsDefender.SetProtectionState(state);
- }
- break;
- case "TglButton4":
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", state ? 5 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton5":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", 1, RegistryValueKind.DWord);
- }
- break;
- case "TglButton6":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload");
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", 2, RegistryValueKind.DWord);
- }
- break;
- case "TglButton7":
- try
- {
- using RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}");
- if (regKey != null)
- {
- foreach (string subKeyName in regKey.GetSubKeyNames())
- {
- using RegistryKey subKey = regKey.OpenSubKey(subKeyName);
- if (subKey != null)
- {
- if (subKey.GetValue("DriverDesc") is string driverDesc && driverDesc.Equals("Realtek High Definition Audio", StringComparison.OrdinalIgnoreCase))
- {
- RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "ConservationIdleTime", state ? new byte[] { 0x0a, 0x00, 0x00, 0x00 } : new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "IdlePowerState", state ? new byte[] { 0x03, 0x00, 0x00, 0x00 } : Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.LocalMachine, $@"{@"SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}"}\{subKeyName}\PowerSettings", "PerformanceIdleTime", state ? new byte[] { 0x0a, 0x00, 0x00, 0x00 } : new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, RegistryValueKind.Binary);
- }
- }
- }
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- break;
- case "TglButton8":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", state ? 1 : 2, RegistryValueKind.DWord);
- break;
- case "TglButton9":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", state ? 1 : 0, RegistryValueKind.DWord);
- CommandExecutor.RunCommand(@$"/c powercfg.exe -h {(state ? "on" : "off")}");
- break;
- case "TglButton10":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks", "1", RegistryValueKind.String);
- }
- break;
- case "TglButton11":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806");
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton12":
- SetTaskState(state, memoryDiagTasks);
- break;
- case "TglButton13":
- _isNetshState = state;
- string tunnelState = state ? "default" : "disabled";
- string privacyState = state ? "enabled" : "disabled";
-
- CommandExecutor.RunCommand($"/c netsh int teredo set state {tunnelState} & netsh int ipv6 6to4 set state state = {tunnelState} undoonstop = {tunnelState} & " +
- $"netsh int ipv6 isatap set state state = {tunnelState} & netsh int ipv6 set privacy state = {privacyState} & " +
- $"netsh int ipv6 set global randomizeidentifier = {privacyState} & netsh int isatap set state {tunnelState}");
- break;
- case "TglButton14":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton15":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton16":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton17":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", state ? 0 : 1, RegistryValueKind.DWord);
- break;
- case "TglButton18":
- SetPowercfg(state);
- break;
- case "TglButton19":
- BluetoothManager.SetState(state);
- break;
- case "TglButton20":
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\mpssvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- CommandExecutor.RunCommand($"/c netsh advfirewall set allprofiles state {(state ? "on" : "off")}");
- if (HardwareData.OS.Build.CompareTo(22621.521m) >= 0)
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wtd", "Start", state ? 2 : 4, RegistryValueKind.DWord);
- }
- break;
- case "TglButton21":
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AutoGameModeEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AllowAutoGameMode", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton22":
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"System\GameConfigStore", "GameDVR_Enabled", state ? 1 : 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", state ? 1 : 0, RegistryValueKind.DWord);
- break;
- case "TglButton23":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", 0, RegistryValueKind.DWord);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", 2, RegistryValueKind.DWord);
- }
- break;
- case "TglButton24":
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo");
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 1, RegistryValueKind.DWord);
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 0, RegistryValueKind.DWord);
- }
- break;
- case "TglButton25":
- _isTickState = state;
- CommandExecutor.RunCommand(state ? $"{PathLocator.Executable.BcdEdit} /deletevalue disabledynamictick; {PathLocator.Executable.BcdEdit} /deletevalue useplatformclock" : $"{PathLocator.Executable.BcdEdit} /set disabledynamictick yes; {PathLocator.Executable.BcdEdit} /set useplatformclock false", true);
- break;
- case "TglButton26":
- if (state)
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed", 1, RegistryValueKind.DWord);
- }
- else
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed");
- }
- break;
- case "TglButton27":
- SetTaskState(state, winInsiderTasks);
- break;
- case "TglButton28":
- SetTaskState(true, defragTask);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", state ? "Y" : "N", RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\services\defragsvc", "Start", 2, RegistryValueKind.DWord);
- break;
- case "TglButton29":
- if (!state)
- {
- DateTime now = DateTime.UtcNow;
- string start = now.ToString("yyyy-MM-ddTHH:mm:ssZ");
- string end = now.AddYears(10).ToString("yyyy-MM-ddTHH:mm:ssZ");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime", end, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
- CommandExecutor.RunCommand("/c gpupdate /force");
- }
- else
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime");
- }
- break;
- case "TglButton30":
- bool isSupportedBuild = HardwareData.OS.Build >= 26200;
+ internal void Apply(string controlName, bool state, bool canShowWindow = true)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksSys, controlName, state);
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode");
- if (isSupportedBuild)
- {
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay");
- }
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", 5, RegistryValueKind.DWord);
- if (isSupportedBuild)
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", 0, RegistryValueKind.DWord);
- }
- }
- break;
- default:
- break;
+ if (controlName.StartsWith("TglButton") && int.TryParse(controlName.Substring(9), out int index))
+ {
+ if (_tglTweaks.TryGetValue((SystemToggle)index, out var action))
+ {
+ action.Apply(state, canShowWindow);
+ }
}
}
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 647152ba..4323b8a5 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -3,6 +3,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using GTweak.Assets.UserControls;
using GTweak.Core.Base;
+using GTweak.Utilities.Helpers;
using GTweak.Utilities.Managers;
using GTweak.Utilities.Tweaks;
@@ -38,9 +39,9 @@ namespace GTweak.View
DescBlock.TargetState = tglButton.State;
- _confTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
+ _confTweaks.Apply(tglButton.Name, tglButton.State);
- if (NotificationManager.ConfActions.TryGetValue(tglButton.Name, out var action))
+ if (NotificationManager.ConfActions.TryGetAction(tglButton.Name, out NotificationManager.NoticeAction action))
{
NotificationManager.Show().WithDelay(300).Perform(action);
}
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index dddf1b5f..0451ad32 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using GTweak.Assets.UserControls;
using GTweak.Core.Base;
+using GTweak.Utilities.Helpers;
using GTweak.Utilities.Managers;
using GTweak.Utilities.Tweaks;
@@ -51,16 +52,16 @@ namespace GTweak.View
private void ColorPicker_ColorPicked(object sender, EventArgs e)
{
ColorPicker colorPicker = (ColorPicker)sender;
- _intfTweaks.ApplyTweaks(colorPicker.Name, colorPicker.SelectedColorString);
+ _intfTweaks.Apply(colorPicker.Name, colorPicker.SelectedColorString);
NotificationManager.Show().WithDelay(300).Logout();
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
CheckBox checkBox = (CheckBox)sender;
- _intfTweaks.ApplyTweaks(checkBox.Uid, checkBox.IsChecked == false);
+ _intfTweaks.Apply(checkBox.Uid, checkBox.IsChecked == false);
- if (ExplorerManager.IntfActions.TryGetValue(checkBox.Uid, out ExplorerManager.ExplorerAction explorerAction))
+ if (ExplorerManager.IntfActions.TryGetAction(checkBox.Uid, out ExplorerManager.ExplorerAction explorerAction))
{
_explorerAction = explorerAction;
}
@@ -89,14 +90,14 @@ namespace GTweak.View
DescBlock.TargetState = tglButton.State;
- _intfTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
+ _intfTweaks.Apply(tglButton.Name, tglButton.State);
- if (ExplorerManager.IntfActions.TryGetValue(tglButton.Name, out ExplorerManager.ExplorerAction explorerAction) && explorerAction == ExplorerManager.ExplorerAction.Restart)
+ if (ExplorerManager.IntfActions.TryGetAction(tglButton.Name, out ExplorerManager.ExplorerAction explorerAction) && explorerAction == ExplorerManager.ExplorerAction.Restart)
{
ExplorerManager.Restart();
}
- if (NotificationManager.IntfActions.TryGetValue(tglButton.Name, out NotificationManager.NoticeAction noticeAction))
+ if (NotificationManager.IntfActions.TryGetAction(tglButton.Name, out NotificationManager.NoticeAction noticeAction))
{
NotificationManager.Show().WithDelay(300).Perform(noticeAction);
}
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index 96ce0cb4..3bb22b6e 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -38,7 +38,7 @@ namespace GTweak.View
DescBlock.TargetState = tglButton.State;
- _svcTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
+ _svcTweaks.Apply(tglButton.Name, tglButton.State);
NotificationManager.Show().WithDelay(300).Restart();
}
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 9a1df48e..746ce13b 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -3,6 +3,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using GTweak.Assets.UserControls;
using GTweak.Core.Base;
+using GTweak.Utilities.Helpers;
using GTweak.Utilities.Managers;
using GTweak.Utilities.Tweaks;
@@ -46,7 +47,7 @@ namespace GTweak.View
DescBlock.TargetState = null;
}
- private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) => _sysTweaks.ApplyTweaks(((Slider)sender).Name, (uint)((Slider)sender).Value);
+ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) => _sysTweaks.Apply(((Slider)sender).Name, (uint)((Slider)sender).Value);
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
@@ -56,16 +57,16 @@ namespace GTweak.View
if (tglButton.Name != "TglButton3")
{
- _sysTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
+ _sysTweaks.Apply(tglButton.Name, tglButton.State);
- if (NotificationManager.SysActions.TryGetValue(tglButton.Name, out NotificationManager.NoticeAction action))
+ if (NotificationManager.SysActions.TryGetAction(tglButton.Name, out NotificationManager.NoticeAction action))
{
NotificationManager.Show().WithDelay(300).Perform(action);
}
}
else
{
- _sysTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
+ _sysTweaks.Apply(tglButton.Name, tglButton.State);
}
}
}
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml.cs b/.Source/GTweak/Windows/ImportWindow.xaml.cs
index bf2a6400..3653544d 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml.cs
+++ b/.Source/GTweak/Windows/ImportWindow.xaml.cs
@@ -80,11 +80,11 @@ namespace GTweak.Windows
{
INIManager iniManager = new INIManager(PathLocator.Files.Config);
- var allSections = new (string Section, Action<string, bool> TweakAction, IEnumerable<KeyValuePair<string, NotificationManager.NoticeAction>> NoticeActions, IEnumerable<KeyValuePair<string, ExplorerManager.ExplorerAction>> ExplorerMapping)[]
+ var allSections = new (string Section, Action<string, bool> TweakAction, Dictionary<Enum, NotificationManager.NoticeAction> NoticeActions, Dictionary<Enum, ExplorerManager.ExplorerAction> ExplorerMapping)[]
{
- (INIManager.SectionConf, _confTweaks.ApplyTweaks, NotificationManager.ConfActions, null),
- (INIManager.SectionIntf, _intfTweaks.ApplyTweaks, NotificationManager.IntfActions, ExplorerManager.IntfActions),
- (INIManager.SectionSvc, _svcTweaks.ApplyTweaks, null, null),
+ (INIManager.SectionConf, _confTweaks.Apply, NotificationManager.ConfActions, null),
+ (INIManager.SectionIntf, _intfTweaks.Apply, NotificationManager.IntfActions, ExplorerManager.IntfActions),
+ (INIManager.SectionSvc, _svcTweaks.Apply, null, null),
(INIManager.SectionSys, null, NotificationManager.SysActions, null)
};
@@ -121,11 +121,11 @@ namespace GTweak.Windows
{
if (tweak.StartsWith("TglButton") && tweak != "TglButton3")
{
- _sysTweaks.ApplyTweaks(tweak, Convert.ToBoolean(value));
+ _sysTweaks.Apply(tweak, Convert.ToBoolean(value));
- foreach (var act in NotificationManager.SysActions.Where(a => a.Key == tweak))
+ if (NotificationManager.SysActions.TryGetAction(tweak, out NotificationManager.NoticeAction sysAction))
{
- _notyActions.Add(act.Value);
+ _notyActions.Add(sysAction);
}
}
else if (tweak == "TglButton3")
@@ -133,14 +133,14 @@ namespace GTweak.Windows
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(delegate
{
- _sysTweaks.ApplyTweaks(tweak, Convert.ToBoolean(value), false);
+ _sysTweaks.Apply(tweak, Convert.ToBoolean(value), false);
});
_isWDNotyNeed = true;
}
else
{
- _sysTweaks.ApplyTweaks(tweak, Convert.ToUInt32(value));
+ _sysTweaks.Apply(tweak, Convert.ToUInt32(value));
}
}
else
@@ -149,29 +149,23 @@ namespace GTweak.Windows
if (section == INIManager.SectionIntf && tweak.StartsWith("ColorPicker"))
{
- _intfTweaks.ApplyTweaks(tweak, value);
+ _intfTweaks.Apply(tweak, value);
}
else
{
TweakAction?.Invoke(tweak, Convert.ToBoolean(value));
}
- if (NoticeActions is Dictionary<string, NotificationManager.NoticeAction> dict)
+ if (NoticeActions != null && NoticeActions.TryGetAction(tweak, out NotificationManager.NoticeAction noticeAction))
{
- if (dict.TryGetValue(tweak, out NotificationManager.NoticeAction action))
- {
- _notyActions.Add(action);
- }
+ _notyActions.Add(noticeAction);
}
- if (ExplorerMapping is IDictionary<string, ExplorerManager.ExplorerAction> expDict)
+ if (ExplorerMapping != null && ExplorerMapping.TryGetAction(tweak, out ExplorerManager.ExplorerAction expAction))
{
- if (expDict.TryGetValue(tweak, out ExplorerManager.ExplorerAction action))
+ if (expAction > _expAction)
{
- if (action > _expAction)
- {
- _expAction = action;
- }
+ _expAction = expAction;
}
}
@@ -201,4 +195,4 @@ namespace GTweak.Windows
base.OnClosed(e);
}
}
-}
+}
\ No newline at end of file