Skip to content

Portable Tool for an Ideal Windows Setup

reorganize project structure

Greedeks8ffc1dbbb7c2
diff --git a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs b/.Source/GTweak/Animations/AnimationFactory.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Animation/FactoryAnimation.cs
rename to .Source/GTweak/Animations/AnimationFactory.cs
index b30ed2c7..a25fd4e0 100644
--- a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
+++ b/.Source/GTweak/Animations/AnimationFactory.cs
@@ -2,9 +2,9 @@ using System;
using System.Windows;
using System.Windows.Media.Animation;
-namespace GTweak.Utilities.Animation
+namespace GTweak.Animations
{
- internal static class FactoryAnimation
+ internal static class AnimationFactory
{
internal static DoubleAnimation CreateIn(double fromValue, double toValue, double seconds, Action onCompleted = null, bool reverse = false, bool useCubicEase = false)
{
diff --git a/.Source/GTweak/Utilities/Animation/BlurAnimation.cs b/.Source/GTweak/Animations/BlurAnimation.cs
similarity index 92%
rename from .Source/GTweak/Utilities/Animation/BlurAnimation.cs
rename to .Source/GTweak/Animations/BlurAnimation.cs
index 35f7200f..745928d7 100644
--- a/.Source/GTweak/Utilities/Animation/BlurAnimation.cs
+++ b/.Source/GTweak/Animations/BlurAnimation.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Media.Effects;
-namespace GTweak.Utilities.Animation
+namespace GTweak.Animations
{
internal class BlurAnimation
{
@@ -24,7 +24,7 @@ namespace GTweak.Utilities.Animation
double fromValue = (double)e.OldValue;
double toValue = (double)e.NewValue;
- blurEffect.BeginAnimation(BlurEffect.RadiusProperty, FactoryAnimation.CreateIn(fromValue, toValue, 0.2));
+ blurEffect.BeginAnimation(BlurEffect.RadiusProperty, AnimationFactory.CreateIn(fromValue, toValue, 0.2));
}
}
}
diff --git a/.Source/GTweak/Utilities/Animation/BrushAnimation.cs b/.Source/GTweak/Animations/BrushAnimation.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Animation/BrushAnimation.cs
rename to .Source/GTweak/Animations/BrushAnimation.cs
index afde2303..6fdb0a56 100644
--- a/.Source/GTweak/Utilities/Animation/BrushAnimation.cs
+++ b/.Source/GTweak/Animations/BrushAnimation.cs
@@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
-namespace GTweak.Utilities.Animation
+namespace GTweak.Animations
{
internal sealed class BrushAnimation : AnimationTimeline
{
diff --git a/.Source/GTweak/Utilities/Animation/NumberAnimation.cs b/.Source/GTweak/Animations/NumberAnimation.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Animation/NumberAnimation.cs
rename to .Source/GTweak/Animations/NumberAnimation.cs
index 983c2a50..b65ce463 100644
--- a/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
+++ b/.Source/GTweak/Animations/NumberAnimation.cs
@@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
-namespace GTweak.Utilities.Animation
+namespace GTweak.Animations
{
internal static class NumberAnimation
{
diff --git a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs b/.Source/GTweak/Animations/TypewriterAnimation.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
rename to .Source/GTweak/Animations/TypewriterAnimation.cs
index 1ea055cb..cb03dc95 100644
--- a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
+++ b/.Source/GTweak/Animations/TypewriterAnimation.cs
@@ -5,7 +5,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
-namespace GTweak.Utilities.Animation
+namespace GTweak.Animations
{
internal sealed class TypewriterAnimation
{
@@ -26,7 +26,7 @@ namespace GTweak.Utilities.Animation
Storyboard.SetTargetProperty(stringAnimation, new PropertyPath(TextBlock.TextProperty));
storyboard.Children.Add(stringAnimation);
- DoubleAnimation opacityAnimation = FactoryAnimation.CreateIn(0, 1, timeSpan.TotalSeconds);
+ DoubleAnimation opacityAnimation = AnimationFactory.CreateIn(0, 1, timeSpan.TotalSeconds);
if (opacityAnimation != null)
{
Storyboard.SetTarget(opacityAnimation, textBlock);
@@ -44,8 +44,6 @@ namespace GTweak.Utilities.Animation
}
}
-
-
private static StringAnimationUsingKeyFrames CreateStringAnimation(in string textToAnimate, in TimeSpan timeSpan)
{
StringAnimationUsingKeyFrames stringAnimation = new StringAnimationUsingKeyFrames
diff --git a/.Source/GTweak/App.xaml.cs b/.Source/GTweak/App.xaml.cs
index c8604105..b06f560e 100644
--- a/.Source/GTweak/App.xaml.cs
+++ b/.Source/GTweak/App.xaml.cs
@@ -3,9 +3,9 @@ using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Threading;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Managers;
using GTweak.Windows;
using Wpf.Ui.Appearance;
@@ -34,12 +34,12 @@ namespace GTweak
{
if (e.Args != null && e.Args.Any(arg => string.Equals(arg ?? string.Empty, "uninstall", StringComparison.OrdinalIgnoreCase)))
{
- SettingsEngine.SelfRemoval();
+ GlobalOptions.SelfRemoval();
return;
}
- SettingsEngine.СheckingParameters();
- ApplicationThemeManager.Apply(string.Equals(SettingsEngine.Theme, SettingsEngine.AvailableThemes.First(), StringComparison.OrdinalIgnoreCase) ? ApplicationTheme.Dark : ApplicationTheme.Light);
+ GlobalOptions.СheckingParameters();
+ ApplicationThemeManager.Apply(string.Equals(GlobalOptions.Theme, GlobalOptions.AvailableThemes.First(), StringComparison.OrdinalIgnoreCase) ? ApplicationTheme.Dark : ApplicationTheme.Light);
RunGuard.CheckingSingleInstance();
await RunGuard.CheckingSystemRequirements();
@@ -54,7 +54,7 @@ namespace GTweak
{
if (e != null)
{
- ErrorLogging.LogWritingFile(e.Exception, true);
+ ErrorLogger.LogWritingFile(e.Exception, true);
e.Handled = true;
Environment.Exit(0);
}
@@ -64,7 +64,7 @@ namespace GTweak
{
if (e?.ExceptionObject is Exception ex)
{
- ErrorLogging.LogWritingFile(ex, true);
+ ErrorLogger.LogWritingFile(ex, true);
}
Environment.Exit(0);
@@ -72,7 +72,7 @@ namespace GTweak
private async void OnHandleDevicesEvents(MonitoringProvider.DeviceType deviceType)
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate { _hardwareProvider.RefreshDevicesData(deviceType); });
}
@@ -91,8 +91,8 @@ namespace GTweak
Source = value switch
{
"be" => GetResourceUri("ru"),
- _ when SettingsEngine.AvailableLangs.Any(locale => string.Equals(locale, value, StringComparison.OrdinalIgnoreCase)) => GetResourceUri(value),
- _ when value.Contains('-') && SettingsEngine.AvailableLangs.Any(locale => string.Equals(locale, value.Split('-')[0], StringComparison.OrdinalIgnoreCase)) => GetResourceUri(value.Split('-')[0]),
+ _ when GlobalOptions.AvailableLangs.Any(locale => string.Equals(locale, value, StringComparison.OrdinalIgnoreCase)) => GetResourceUri(value),
+ _ when value.Contains('-') && GlobalOptions.AvailableLangs.Any(locale => string.Equals(locale, value.Split('-')[0], StringComparison.OrdinalIgnoreCase)) => GetResourceUri(value.Split('-')[0]),
_ => GetResourceUri("en")
}
};
@@ -112,7 +112,7 @@ namespace GTweak
{
set
{
- value ??= SettingsEngine.AvailableThemes.First();
+ value ??= GlobalOptions.AvailableThemes.First();
ResourceDictionary dictionary = new ResourceDictionary
{
diff --git a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
index c58238ec..8e41a45a 100644
--- a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
@@ -8,7 +8,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
namespace GTweak.Assets.UserControls
{
@@ -336,8 +336,8 @@ namespace GTweak.Assets.UserControls
private void ColorPopup_Opened(object sender, EventArgs e)
{
_colorOnOpen = SelectedColor;
- PopupTransform?.BeginAnimation(TranslateTransform.YProperty, FactoryAnimation.CreateIn(-5, 0, 0.3, useCubicEase: true));
- PopupBorder?.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.15));
+ PopupTransform?.BeginAnimation(TranslateTransform.YProperty, AnimationFactory.CreateIn(-5, 0, 0.3, useCubicEase: true));
+ PopupBorder?.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.15));
SubscribeToScrollParents();
}
diff --git a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
index 19144585..01413475 100644
--- a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
+++ b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:local="clr-namespace:GTweak.Assets.UserControls"
mc:Ignorable="d" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None" SnapsToDevicePixels="True" UseLayoutRounding="True"
d:DesignHeight="100" d:DesignWidth="800">
diff --git a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
index 5aa2d114..fc50195a 100644
--- a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
@@ -5,9 +5,9 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Animation;
-using GTweak.Core.Behaviors;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Controls;
+using GTweak.Animations;
+using GTweak.Behaviors;
+using GTweak.Modules.Common;
namespace GTweak.Assets.UserControls
{
@@ -57,7 +57,7 @@ namespace GTweak.Assets.UserControls
TimeSpan duration = safeValue.Length <= 50 ? TimeSpan.FromMilliseconds(200) : safeValue.Length <= 200 ? TimeSpan.FromMilliseconds(400) : TimeSpan.FromMilliseconds(550);
- Caret.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(1.0, 0.0, 0.3, reverse: true));
+ Caret.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(1.0, 0.0, 0.3, reverse: true));
FunctionDescription.Text = string.Empty;
TypewriterAnimation.Create(safeValue, FunctionDescription, duration);
@@ -109,7 +109,7 @@ namespace GTweak.Assets.UserControls
{
try
{
- FunctionDescription.FlowDirection = CultureInfo.GetCultureInfo(SettingsEngine.Language).TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
+ FunctionDescription.FlowDirection = CultureInfo.GetCultureInfo(GlobalOptions.Language).TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
}
catch (CultureNotFoundException) { FunctionDescription.FlowDirection = FlowDirection.LeftToRight; }
}
@@ -130,7 +130,7 @@ namespace GTweak.Assets.UserControls
if (TargetState != null && text != DefaultText)
{
- StatusPanel.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0.0, 1.0, 0.3));
+ StatusPanel.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0.0, 1.0, 0.3));
}
}
});
@@ -169,7 +169,7 @@ namespace GTweak.Assets.UserControls
{
await Task.Delay(TimeSpan.FromSeconds(durationSeconds), token);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
diff --git a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
index ebeafba7..536616c2 100644
--- a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
@@ -8,7 +8,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
namespace GTweak.Assets.UserControls
{
@@ -97,8 +97,8 @@ namespace GTweak.Assets.UserControls
private void Popup_Opened(object sender, EventArgs e)
{
- PopupTransform?.BeginAnimation(TranslateTransform.YProperty, FactoryAnimation.CreateIn(-5, 0, 0.3, useCubicEase: true));
- PopupBorder?.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.15));
+ PopupTransform?.BeginAnimation(TranslateTransform.YProperty, AnimationFactory.CreateIn(-5, 0, 0.3, useCubicEase: true));
+ PopupBorder?.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.15));
SubscribeToScrollParents();
}
diff --git a/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs b/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
index ae67e213..be88a238 100644
--- a/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
@@ -2,7 +2,7 @@ using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
namespace GTweak.Assets.UserControls
{
@@ -49,9 +49,9 @@ namespace GTweak.Assets.UserControls
InitializeComponent();
}
- private void Card_MouseEnter(object sender, MouseEventArgs e) => CardBody.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(1.0, 0.7, 0.2));
+ private void Card_MouseEnter(object sender, MouseEventArgs e) => CardBody.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(1.0, 0.7, 0.2));
- private void Card_MouseLeave(object sender, MouseEventArgs e) => CardBody.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0.7, 1.0, 0.2));
+ private void Card_MouseLeave(object sender, MouseEventArgs e) => CardBody.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0.7, 1.0, 0.2));
private void Card_MouseClick(object sender, MouseButtonEventArgs e)
{
@@ -62,7 +62,7 @@ namespace GTweak.Assets.UserControls
Command.Execute(CommandParameter);
}
- ProgressBar.BeginAnimation(RangeBase.ValueProperty, FactoryAnimation.CreateIn(0, 100, 0.2, () => { ProgressBar.Visibility = Visibility.Collapsed; }, reverse: true));
+ ProgressBar.BeginAnimation(RangeBase.ValueProperty, AnimationFactory.CreateIn(0, 100, 0.2, () => { ProgressBar.Visibility = Visibility.Collapsed; }, reverse: true));
}
}
diff --git a/.Source/GTweak/Assets/UserControls/FlowPanel.cs b/.Source/GTweak/Assets/UserControls/FlowPanel.cs
index 64e569b7..61f0ae1f 100644
--- a/.Source/GTweak/Assets/UserControls/FlowPanel.cs
+++ b/.Source/GTweak/Assets/UserControls/FlowPanel.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
namespace GTweak.Assets.UserControls
{
@@ -362,7 +362,7 @@ namespace GTweak.Assets.UserControls
}
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
return finalSize;
}
}
diff --git a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
index 3911f2d8..a714fc79 100644
--- a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
@@ -5,7 +5,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
namespace GTweak.Assets.UserControls
{
@@ -262,8 +262,8 @@ namespace GTweak.Assets.UserControls
{
if (IsEnabled && DotScale != null)
{
- DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, FactoryAnimation.CreateIn(1, 1.1, 0.15, useCubicEase: true));
- DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, FactoryAnimation.CreateIn(1, 1.1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(1, 1.1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(1, 1.1, 0.15, useCubicEase: true));
}
}
@@ -271,8 +271,8 @@ namespace GTweak.Assets.UserControls
{
if (IsEnabled && DotScale != null)
{
- DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, FactoryAnimation.CreateIn(1.1, 1, 0.15, useCubicEase: true));
- DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, FactoryAnimation.CreateIn(1.1, 1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(1.1, 1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(1.1, 1, 0.15, useCubicEase: true));
}
}
}
diff --git a/.Source/GTweak/Core/Behaviors/ArcAnimationBehavior.cs b/.Source/GTweak/Behaviors/ArcAnimationBehavior.cs
similarity index 90%
rename from .Source/GTweak/Core/Behaviors/ArcAnimationBehavior.cs
rename to .Source/GTweak/Behaviors/ArcAnimationBehavior.cs
index a13ff803..b43821bd 100644
--- a/.Source/GTweak/Core/Behaviors/ArcAnimationBehavior.cs
+++ b/.Source/GTweak/Behaviors/ArcAnimationBehavior.cs
@@ -2,9 +2,9 @@ using System;
using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Threading;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
-namespace GTweak.Core.Behaviors
+namespace GTweak.Behaviors
{
internal class ArcAnimationBehavior
{
@@ -20,7 +20,7 @@ namespace GTweak.Core.Behaviors
{
arc.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
{
- DoubleAnimation animation = FactoryAnimation.CreateIn(arc.EndAngle, (double)e.NewValue, 0.2, useCubicEase: true);
+ DoubleAnimation animation = AnimationFactory.CreateIn(arc.EndAngle, (double)e.NewValue, 0.2, useCubicEase: true);
Timeline.SetDesiredFrameRate(animation, 60);
arc.BeginAnimation(Wpf.Ui.Controls.Arc.EndAngleProperty, animation);
}));
diff --git a/.Source/GTweak/Core/Behaviors/ScrollFadeBehavior.cs b/.Source/GTweak/Behaviors/ScrollFadeBehavior.cs
similarity index 99%
rename from .Source/GTweak/Core/Behaviors/ScrollFadeBehavior.cs
rename to .Source/GTweak/Behaviors/ScrollFadeBehavior.cs
index 343d8994..70ee6e0c 100644
--- a/.Source/GTweak/Core/Behaviors/ScrollFadeBehavior.cs
+++ b/.Source/GTweak/Behaviors/ScrollFadeBehavior.cs
@@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
-namespace GTweak.Core.Behaviors
+namespace GTweak.Behaviors
{
internal static class ScrollFadeBehavior
{
diff --git a/.Source/GTweak/Core/Behaviors/ScrollViewerBehavior.cs b/.Source/GTweak/Behaviors/ScrollViewerBehavior.cs
similarity index 96%
rename from .Source/GTweak/Core/Behaviors/ScrollViewerBehavior.cs
rename to .Source/GTweak/Behaviors/ScrollViewerBehavior.cs
index fd757030..9c88138e 100644
--- a/.Source/GTweak/Core/Behaviors/ScrollViewerBehavior.cs
+++ b/.Source/GTweak/Behaviors/ScrollViewerBehavior.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Controls;
-namespace GTweak.Core.Behaviors
+namespace GTweak.Behaviors
{
internal static class ScrollViewerBehavior
{
diff --git a/.Source/GTweak/Core/Behaviors/TextBoxClearBehavior.cs b/.Source/GTweak/Behaviors/TextBoxClearBehavior.cs
similarity index 98%
rename from .Source/GTweak/Core/Behaviors/TextBoxClearBehavior.cs
rename to .Source/GTweak/Behaviors/TextBoxClearBehavior.cs
index 2f7a4a46..fc408fa5 100644
--- a/.Source/GTweak/Core/Behaviors/TextBoxClearBehavior.cs
+++ b/.Source/GTweak/Behaviors/TextBoxClearBehavior.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Controls;
-namespace GTweak.Core.Behaviors
+namespace GTweak.Behaviors
{
internal class TextBoxClearBehavior
{
diff --git a/.Source/GTweak/Core/Converters/AngleToPercentConverter.cs b/.Source/GTweak/Converters/AngleToPercentConverter.cs
similarity index 96%
rename from .Source/GTweak/Core/Converters/AngleToPercentConverter.cs
rename to .Source/GTweak/Converters/AngleToPercentConverter.cs
index f269efa4..3342c63b 100644
--- a/.Source/GTweak/Core/Converters/AngleToPercentConverter.cs
+++ b/.Source/GTweak/Converters/AngleToPercentConverter.cs
@@ -2,7 +2,7 @@ using System;
using System.Globalization;
using System.Windows.Data;
-namespace GTweak.Core.Converters
+namespace GTweak.Converters
{
internal class AngleToPercentConverter : IValueConverter
{
diff --git a/.Source/GTweak/Core/Converters/PercentToWidthConverter.cs b/.Source/GTweak/Converters/PercentToWidthConverter.cs
similarity index 95%
rename from .Source/GTweak/Core/Converters/PercentToWidthConverter.cs
rename to .Source/GTweak/Converters/PercentToWidthConverter.cs
index e9be6f78..43ddb621 100644
--- a/.Source/GTweak/Core/Converters/PercentToWidthConverter.cs
+++ b/.Source/GTweak/Converters/PercentToWidthConverter.cs
@@ -2,7 +2,7 @@ using System;
using System.Globalization;
using System.Windows.Data;
-namespace GTweak.Core.Converters
+namespace GTweak.Converters
{
internal class PercentToWidthConverter : IMultiValueConverter
{
diff --git a/.Source/GTweak/Core/Converters/UsageToAngleConverter.cs b/.Source/GTweak/Converters/UsageToAngleConverter.cs
similarity index 95%
rename from .Source/GTweak/Core/Converters/UsageToAngleConverter.cs
rename to .Source/GTweak/Converters/UsageToAngleConverter.cs
index 7ed3200a..9c97d1c2 100644
--- a/.Source/GTweak/Core/Converters/UsageToAngleConverter.cs
+++ b/.Source/GTweak/Converters/UsageToAngleConverter.cs
@@ -3,7 +3,7 @@ using System.Globalization;
using System.Windows;
using System.Windows.Data;
-namespace GTweak.Core.Converters
+namespace GTweak.Converters
{
internal class UsageToAngleConverter : IValueConverter
{
diff --git a/.Source/GTweak/Core/Services/ToolsetDownloadService.cs b/.Source/GTweak/Core/Services/ToolsetDownloadService.cs
index 762b9b10..f6a97ace 100644
--- a/.Source/GTweak/Core/Services/ToolsetDownloadService.cs
+++ b/.Source/GTweak/Core/Services/ToolsetDownloadService.cs
@@ -11,7 +11,7 @@ using System.Threading;
using System.Threading.Tasks;
using GTweak.Core.Models;
using GTweak.Core.ViewModel.Components;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Newtonsoft.Json.Linq;
namespace GTweak.Core.Services
@@ -61,7 +61,7 @@ namespace GTweak.Core.Services
if (model.Group.Equals("github", StringComparison.OrdinalIgnoreCase))
{
- string apiUrl = PathLocator.Links.DownloadSources.GitHubLatest(model.DownloadPath);
+ string apiUrl = PathTargets.Links.DownloadSources.GitHubLatest(model.DownloadPath);
using HttpResponseMessage response = await _httpClient.GetAsync(apiUrl, token);
if (!response.IsSuccessStatusCode)
@@ -103,7 +103,7 @@ namespace GTweak.Core.Services
Match match = Regex.Match(projectName, @"projects/([^/]+)");
projectName = match.Success ? match.Groups[1].Value : projectName.Trim('/');
- string bestReleaseUrl = PathLocator.Links.DownloadSources.SourceForgeBest(projectName);
+ string bestReleaseUrl = PathTargets.Links.DownloadSources.SourceForgeBest(projectName);
try
{
using HttpResponseMessage response = await _httpClient.GetAsync(bestReleaseUrl, token);
@@ -117,24 +117,24 @@ namespace GTweak.Core.Services
{
if (string.IsNullOrEmpty(model.FilePattern) || Regex.IsMatch(filename, model.FilePattern, RegexOptions.IgnoreCase))
{
- return PathLocator.Links.DownloadSources.SourceForgeFile(projectName, filename.TrimStart('/'));
+ return PathTargets.Links.DownloadSources.SourceForgeFile(projectName, filename.TrimStart('/'));
}
}
}
}
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
}
try
{
- string rssUrl = PathLocator.Links.DownloadSources.SourceForgeRss(projectName);
+ string rssUrl = PathTargets.Links.DownloadSources.SourceForgeRss(projectName);
using HttpResponseMessage rssResponse = await _httpClient.GetAsync(rssUrl, token);
rssResponse.EnsureSuccessStatusCode();
string rssContent = await rssResponse.Content.ReadAsStringAsync();
- MatchCollection rssMatches = Regex.Matches(rssContent, PathLocator.Links.DownloadSources.SourceForgeRssRegex(projectName), RegexOptions.IgnoreCase);
+ MatchCollection rssMatches = Regex.Matches(rssContent, PathTargets.Links.DownloadSources.SourceForgeRssRegex(projectName), RegexOptions.IgnoreCase);
if (rssMatches.Count > 0)
{
@@ -146,18 +146,18 @@ namespace GTweak.Core.Services
if (Regex.IsMatch(filePath, model.FilePattern, RegexOptions.IgnoreCase))
{
- return PathLocator.Links.DownloadSources.SourceForgeFile(projectName, filePath.TrimStart('/'));
+ return PathTargets.Links.DownloadSources.SourceForgeFile(projectName, filePath.TrimStart('/'));
}
}
}
string firstFilePath = rssMatches[0].Groups[1].Value;
- return PathLocator.Links.DownloadSources.SourceForgeFile(projectName, firstFilePath.TrimStart('/'));
+ return PathTargets.Links.DownloadSources.SourceForgeFile(projectName, firstFilePath.TrimStart('/'));
}
}
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
}
throw new HttpRequestException();
@@ -322,7 +322,7 @@ namespace GTweak.Core.Services
}
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
throw;
}
}
diff --git a/.Source/GTweak/Core/Services/ToolsetIconService.cs b/.Source/GTweak/Core/Services/ToolsetIconService.cs
index d72962f3..fc074d59 100644
--- a/.Source/GTweak/Core/Services/ToolsetIconService.cs
+++ b/.Source/GTweak/Core/Services/ToolsetIconService.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
namespace GTweak.Core.Services
{
@@ -34,7 +34,7 @@ namespace GTweak.Core.Services
if (isWebBased)
{
- urlToDownload = PathLocator.Links.Favicons.Google(iconSource);
+ urlToDownload = PathTargets.Links.Favicons.Google(iconSource);
}
try
@@ -54,7 +54,7 @@ namespace GTweak.Core.Services
{
try
{
- byte[] imageBytes = await _httpClient.GetByteArrayAsync(PathLocator.Links.Favicons.DuckDuckGo(iconSource));
+ byte[] imageBytes = await _httpClient.GetByteArrayAsync(PathTargets.Links.Favicons.DuckDuckGo(iconSource));
ImageSource image = LoadImage(imageBytes);
if (image != null)
@@ -63,7 +63,7 @@ namespace GTweak.Core.Services
return (image, false);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
diff --git a/.Source/GTweak/Core/ViewModel/AddonsViewModel.cs b/.Source/GTweak/Core/ViewModel/AddonsViewModel.cs
index 0fb96591..152a1b28 100644
--- a/.Source/GTweak/Core/ViewModel/AddonsViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/AddonsViewModel.cs
@@ -9,8 +9,8 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using GTweak.Core.Base;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
using Ookii.Dialogs.Wpf;
namespace GTweak.Core.ViewModel
@@ -39,7 +39,7 @@ namespace GTweak.Core.ViewModel
SelectFolderCommand = new RelayCommand(_ => SelectFolder());
UpdateCommand = new RelayCommand(_ => ScanFolder());
- if (!string.IsNullOrWhiteSpace(SettingsEngine.UserAddonsPath) && Directory.Exists(SettingsEngine.UserAddonsPath))
+ if (!string.IsNullOrWhiteSpace(GlobalOptions.UserAddonsPath) && Directory.Exists(GlobalOptions.UserAddonsPath))
{
ScanFolder();
}
@@ -53,7 +53,7 @@ namespace GTweak.Core.ViewModel
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog
{
UseDescriptionForTitle = true,
- SelectedPath = SettingsEngine.UserAddonsPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
+ SelectedPath = GlobalOptions.UserAddonsPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
};
bool? dialogResult = folderDialog.ShowDialog();
@@ -63,12 +63,12 @@ namespace GTweak.Core.ViewModel
string selectedPath = folderDialog.SelectedPath;
if (!string.IsNullOrWhiteSpace(selectedPath) && Directory.Exists(selectedPath))
{
- SettingsEngine.UserAddonsPath = selectedPath;
+ GlobalOptions.UserAddonsPath = selectedPath;
ScanFolder();
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private void RunFile(AddonModel addon)
@@ -85,25 +85,25 @@ namespace GTweak.Core.ViewModel
break;
case ".ps1":
- fileName = PathLocator.Executable.PowerShell;
+ fileName = PathTargets.Executable.PowerShell;
arguments = $"-ExecutionPolicy Bypass -File \"{addon.FilePath}\"";
break;
default:
- fileName = PathLocator.Executable.CommandShell;
+ fileName = PathTargets.Executable.CommandShell;
arguments = $"/k \"{addon.FilePath}\"";
break;
}
Task.Run(() => { CommandExecutor.RunCommandShow(fileName, CommandExecutor.CleanCommand(arguments), addon.RequiresElevation); });
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private void ScanFolder()
{
try
{
- string path = SettingsEngine.UserAddonsPath;
+ string path = GlobalOptions.UserAddonsPath;
if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path))
{
@@ -163,7 +163,7 @@ namespace GTweak.Core.ViewModel
iconImage = Application.Current.Resources[iconRes] as ImageSource;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
iconImage ??= Application.Current.Resources["Img_BatFile"] as ImageSource;
@@ -191,7 +191,7 @@ namespace GTweak.Core.ViewModel
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
\ No newline at end of file
diff --git a/.Source/GTweak/Core/ViewModel/Components/DownloadSession.cs b/.Source/GTweak/Core/ViewModel/Components/DownloadSession.cs
index 1432090d..430d432f 100644
--- a/.Source/GTweak/Core/ViewModel/Components/DownloadSession.cs
+++ b/.Source/GTweak/Core/ViewModel/Components/DownloadSession.cs
@@ -7,8 +7,8 @@ using System.Windows.Input;
using GTweak.Core.Base;
using GTweak.Core.Models;
using GTweak.Core.Services;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Managers;
namespace GTweak.Core.ViewModel.Components
{
@@ -80,7 +80,7 @@ namespace GTweak.Core.ViewModel.Components
return;
}
- string destinationFolder = SettingsEngine.DownloadPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
+ string destinationFolder = GlobalOptions.DownloadPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string destinationPath = Path.Combine(destinationFolder, GetFileNameFromUrl(finalUrl));
if (!File.Exists($"{destinationPath}.download"))
@@ -110,7 +110,7 @@ namespace GTweak.Core.ViewModel.Components
NotificationManager.Show("warn", "error_download_noty").Perform();
break;
default:
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
break;
}
}
diff --git a/.Source/GTweak/Core/ViewModel/Components/ToolsetItem.cs b/.Source/GTweak/Core/ViewModel/Components/ToolsetItem.cs
index 534c3ba7..09baa3eb 100644
--- a/.Source/GTweak/Core/ViewModel/Components/ToolsetItem.cs
+++ b/.Source/GTweak/Core/ViewModel/Components/ToolsetItem.cs
@@ -8,7 +8,7 @@ using GTweak.Core.Base;
using GTweak.Core.Models;
using GTweak.Core.Services;
using GTweak.Core.ViewModel.Components;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
namespace GTweak.Core.Item
{
@@ -77,7 +77,7 @@ namespace GTweak.Core.Item
AuthorIconSource = Image;
IsSquareIcon = !string.Equals(_model.Group, "github", StringComparison.OrdinalIgnoreCase) && !IsFallback;
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
diff --git a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
index 14fac2d7..6974e1ca 100644
--- a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Tweaks;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
index 9d7c0e73..28cd6142 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
@@ -6,8 +6,8 @@ using System.Linq;
using System.Windows;
using System.Windows.Media;
using GTweak.Core.Base;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
namespace GTweak.Core.ViewModel
{
@@ -64,12 +64,12 @@ namespace GTweak.Core.ViewModel
public bool IsIpHidden
{
- get => SettingsEngine.IsHiddenIpAddress;
+ get => GlobalOptions.IsHiddenIpAddress;
set
{
- if (SettingsEngine.IsHiddenIpAddress != value)
+ if (GlobalOptions.IsHiddenIpAddress != value)
{
- SettingsEngine.IsHiddenIpAddress = value;
+ GlobalOptions.IsHiddenIpAddress = value;
OnPropertyChanged();
RefreshStates();
}
@@ -127,7 +127,7 @@ namespace GTweak.Core.ViewModel
{
if (NetworkProvider.isIPAddressFormatValid || (_ipAddressModel?.Data?.Any(char.IsDigit) == true))
{
- IpBlurRadius = SettingsEngine.IsHiddenIpAddress ? 20 : 0;
+ IpBlurRadius = GlobalOptions.IsHiddenIpAddress ? 20 : 0;
IpSectionVisibility = Visibility.Visible;
_ipAddressModel.IsEnabled = true;
}
diff --git a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
index 8440f73b..92df4edd 100644
--- a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
@@ -3,8 +3,8 @@ using System.Windows;
using System.Windows.Media;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Tweaks;
namespace GTweak.Core.ViewModel
{
@@ -13,7 +13,7 @@ namespace GTweak.Core.ViewModel
public IReadOnlyDictionary<string, ImageSource> Icons { get; }
public Visibility Win11FeatureOnly => HardwareData.OS.IsWin11 ? Visibility.Visible : Visibility.Collapsed;
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;
+ public Visibility OneDriveAvailable => AppxPackageHandler.IsOneDriveInstalled ? Visibility.Visible : Visibility.Collapsed;
protected override void Analyze(InterfaceTweaks tweaks) => tweaks?.CheckAll();
protected override IReadOnlyDictionary<string, object> GetControlStates() => InterfaceTweaks.ControlStates;
@@ -22,22 +22,22 @@ namespace GTweak.Core.ViewModel
{
Icons = new Dictionary<string, ImageSource>
{
- { "Home", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.Home) },
- { "Gallery", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.Gallery) },
- { "OneDrive", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.OneDrive) },
- { "PC", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.PC) },
- { "Network", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.Network) },
- { "Trash", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.Trash) },
- { "Panel", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.Panel) },
- { "UserFile", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.UserFile) },
- { "OneDriveFile", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.OneDrive, 64) },
- { "FolderObjects3D", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderObjects3D, 40) },
- { "FolderDesktop", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderDesktop, 40) },
- { "FolderDownloads", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderDownloads, 40) },
- { "FolderDocuments", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderDocuments, 40) },
- { "FolderPictures", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderPictures, 40) },
- { "FolderMusic", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderMusic, 40) },
- { "FolderVideo", IconExtractProvider.GetStockIcon(IconExtractProvider.StockIconType.FolderVideo, 40) }
+ { "Home", IconProvider.GetStockIcon(IconProvider.StockIconType.Home) },
+ { "Gallery", IconProvider.GetStockIcon(IconProvider.StockIconType.Gallery) },
+ { "OneDrive", IconProvider.GetStockIcon(IconProvider.StockIconType.OneDrive) },
+ { "PC", IconProvider.GetStockIcon(IconProvider.StockIconType.PC) },
+ { "Network", IconProvider.GetStockIcon(IconProvider.StockIconType.Network) },
+ { "Trash", IconProvider.GetStockIcon(IconProvider.StockIconType.Trash) },
+ { "Panel", IconProvider.GetStockIcon(IconProvider.StockIconType.Panel) },
+ { "UserFile", IconProvider.GetStockIcon(IconProvider.StockIconType.UserFile) },
+ { "OneDriveFile", IconProvider.GetStockIcon(IconProvider.StockIconType.OneDrive, 64) },
+ { "FolderObjects3D", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderObjects3D, 40) },
+ { "FolderDesktop", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderDesktop, 40) },
+ { "FolderDownloads", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderDownloads, 40) },
+ { "FolderDocuments", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderDocuments, 40) },
+ { "FolderPictures", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderPictures, 40) },
+ { "FolderMusic", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderMusic, 40) },
+ { "FolderVideo", IconProvider.GetStockIcon(IconProvider.StockIconType.FolderVideo, 40) }
};
}
}
diff --git a/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs b/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
index 6cd145e3..396c4fac 100644
--- a/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
@@ -7,8 +7,8 @@ using System.Windows.Input;
using System.Windows.Media;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
using GTweak.View;
namespace GTweak.Core.ViewModel
@@ -30,30 +30,30 @@ namespace GTweak.Core.ViewModel
public string DisplayProfileName => _hardwareProvider.GetProfileName();
- public string DisplayTweakVersion => SettingsEngine.CurrentRelease.Full;
+ public string DisplayTweakVersion => GlobalOptions.CurrentRelease.Full;
- public string CurrentVersion => SettingsEngine.CurrentRelease.Short;
+ public string CurrentVersion => GlobalOptions.CurrentRelease.Short;
public string DownloadVersion => NetworkProvider.DownloadVersion;
public bool StateButtonTheme
{
- get => !string.Equals(SettingsEngine.Theme, SettingsEngine.AvailableThemes.First(), StringComparison.OrdinalIgnoreCase);
+ get => !string.Equals(GlobalOptions.Theme, GlobalOptions.AvailableThemes.First(), StringComparison.OrdinalIgnoreCase);
set
{
- App.Theme = SettingsEngine.Theme = value == false ? SettingsEngine.AvailableThemes.First() : SettingsEngine.AvailableThemes.Last();
+ App.Theme = GlobalOptions.Theme = value == false ? GlobalOptions.AvailableThemes.First() : GlobalOptions.AvailableThemes.Last();
OnPropertyChanged();
}
}
public bool IsViewNotification
{
- get => SettingsEngine.IsViewNotification;
+ get => GlobalOptions.IsViewNotification;
set
{
- if (SettingsEngine.IsViewNotification != value)
+ if (GlobalOptions.IsViewNotification != value)
{
- SettingsEngine.IsViewNotification = value;
+ GlobalOptions.IsViewNotification = value;
OnPropertyChanged();
}
}
@@ -61,12 +61,12 @@ namespace GTweak.Core.ViewModel
public bool IsUpdateCheckRequired
{
- get => SettingsEngine.IsUpdateCheckRequired;
+ get => GlobalOptions.IsUpdateCheckRequired;
set
{
- if (SettingsEngine.IsUpdateCheckRequired != value)
+ if (GlobalOptions.IsUpdateCheckRequired != value)
{
- SettingsEngine.IsUpdateCheckRequired = value;
+ GlobalOptions.IsUpdateCheckRequired = value;
OnPropertyChanged();
}
}
@@ -74,12 +74,12 @@ namespace GTweak.Core.ViewModel
public bool IsTopMost
{
- get => SettingsEngine.IsTopMost;
+ get => GlobalOptions.IsTopMost;
set
{
- if (SettingsEngine.IsTopMost != value)
+ if (GlobalOptions.IsTopMost != value)
{
- SettingsEngine.IsTopMost = value;
+ GlobalOptions.IsTopMost = value;
OnPropertyChanged();
}
}
@@ -87,12 +87,12 @@ namespace GTweak.Core.ViewModel
public bool IsPlayingSound
{
- get => SettingsEngine.IsPlayingSound;
+ get => GlobalOptions.IsPlayingSound;
set
{
- if (SettingsEngine.IsPlayingSound != value)
+ if (GlobalOptions.IsPlayingSound != value)
{
- SettingsEngine.IsPlayingSound = value;
+ GlobalOptions.IsPlayingSound = value;
OnPropertyChanged();
}
}
@@ -100,13 +100,13 @@ namespace GTweak.Core.ViewModel
public int CurrentVolume
{
- get => SettingsEngine.Volume;
+ get => GlobalOptions.Volume;
set
{
- if (SettingsEngine.Volume != value)
+ if (GlobalOptions.Volume != value)
{
- SettingsEngine.Volume = value;
- SettingsEngine.waveOutSetVolume(IntPtr.Zero, ((uint)(double)(ushort.MaxValue / 100 * value) & 0x0000ffff) | ((uint)(double)(ushort.MaxValue / 100 * value) << 16));
+ GlobalOptions.Volume = value;
+ GlobalOptions.waveOutSetVolume(IntPtr.Zero, ((uint)(double)(ushort.MaxValue / 100 * value) & 0x0000ffff) | ((uint)(double)(ushort.MaxValue / 100 * value) << 16));
OnPropertyChanged();
}
}
@@ -121,7 +121,7 @@ namespace GTweak.Core.ViewModel
{
_model.SelectedLanguage = value;
OnPropertyChanged();
- SettingsEngine.Language = value;
+ GlobalOptions.Language = value;
App.Language = value;
}
}
@@ -177,12 +177,12 @@ namespace GTweak.Core.ViewModel
Languages.Clear();
ResourceDictionary dictionary = new ResourceDictionary { Source = new Uri($"Languages/LanguageCatalog.xaml", UriKind.Relative) };
- foreach (string code in SettingsEngine.AvailableLangs)
+ foreach (string code in GlobalOptions.AvailableLangs)
{
Languages.Add(new MainWinModel.LanguageItem { Code = code, Display = dictionary[$"{code.Replace("-", "_")}"] as string ?? code });
}
- SelectedLanguage = SettingsEngine.AvailableLangs.Contains(SettingsEngine.Language) ? SettingsEngine.Language : SettingsEngine.AvailableLangs.FirstOrDefault();
+ SelectedLanguage = GlobalOptions.AvailableLangs.Contains(GlobalOptions.Language) ? GlobalOptions.Language : GlobalOptions.AvailableLangs.FirstOrDefault();
}
}
}
diff --git a/.Source/GTweak/Core/ViewModel/PackagesViewModel.cs b/.Source/GTweak/Core/ViewModel/PackagesViewModel.cs
index 09d2ccaf..a67d11ad 100644
--- a/.Source/GTweak/Core/ViewModel/PackagesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/PackagesViewModel.cs
@@ -7,8 +7,8 @@ using System.Windows;
using System.Windows.Threading;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Tweaks;
namespace GTweak.Core.ViewModel
{
@@ -27,7 +27,7 @@ namespace GTweak.Core.ViewModel
BuildCollection();
- UninstallingPakages.DataChanged += delegate
+ AppxPackageHandler.DataChanged += delegate
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
@@ -44,10 +44,10 @@ namespace GTweak.Core.ViewModel
{
DisplayState.Clear();
- foreach (var kv in UninstallingPakages.PackagesDetails)
+ foreach (var kv in AppxPackageHandler.PackagesDetails)
{
string name = kv.Key;
- UninstallingPakages.PackagesInfo details = kv.Value;
+ AppxPackageHandler.PackagesInfo details = kv.Value;
PackagesModel pkg = new PackagesModel
{
@@ -62,17 +62,17 @@ namespace GTweak.Core.ViewModel
private void UpdatePackageState(PackagesModel item)
{
- if (item != null && !string.IsNullOrWhiteSpace(item.Name) && UninstallingPakages.PackagesDetails?.TryGetValue(item?.Name, out var val) == true && val != null)
+ if (item != null && !string.IsNullOrWhiteSpace(item.Name) && AppxPackageHandler.PackagesDetails?.TryGetValue(item?.Name, out var val) == true && val != null)
{
item.IsUnavailable = !val.IsUnavailable;
switch (item?.Name.ToLowerInvariant())
{
case "onedrive":
- item.Installed = UninstallingPakages.IsOneDriveInstalled;
+ item.Installed = AppxPackageHandler.IsOneDriveInstalled;
return;
case "edge":
- item.Installed = UninstallingPakages.IsEdgeInstalled;
+ item.Installed = AppxPackageHandler.IsEdgeInstalled;
return;
default:
break;
@@ -82,7 +82,7 @@ namespace GTweak.Core.ViewModel
if (scripts != null && scripts?.Count > 0)
{
- item.Installed = scripts.Any(pattern => UninstallingPakages.InstalledPackagesCache.Any(pkg => Regex.IsMatch(pkg, $"^{Regex.Escape(pattern)}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)));
+ item.Installed = scripts.Any(pattern => AppxPackageHandler.InstalledPackagesCache.Any(pkg => Regex.IsMatch(pkg, $"^{Regex.Escape(pattern)}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)));
}
else
{
diff --git a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
index 50c0234b..b2f2aaae 100644
--- a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
@@ -2,13 +2,13 @@ using System.Collections.Generic;
using System.Windows;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Tweaks;
namespace GTweak.Core.ViewModel
{
internal class ServicesViewModel : ViewModelPageBase<ServicesModel, ServicesTweaks>
{
- public Visibility EdgeAvailable => UninstallingPakages.IsEdgeInstalled ? Visibility.Visible : Visibility.Collapsed;
+ public Visibility EdgeAvailable => AppxPackageHandler.IsEdgeInstalled ? Visibility.Visible : Visibility.Collapsed;
protected override IReadOnlyDictionary<string, object> GetControlStates() => ServicesTweaks.ControlStates;
diff --git a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
index 3502c166..7e055722 100644
--- a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
@@ -2,9 +2,9 @@ using System.Collections.Generic;
using System.Windows;
using GTweak.Core.Base;
using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/ToolsetViewModel.cs b/.Source/GTweak/Core/ViewModel/ToolsetViewModel.cs
index d4d76585..2da7bebe 100644
--- a/.Source/GTweak/Core/ViewModel/ToolsetViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ToolsetViewModel.cs
@@ -10,7 +10,7 @@ using GTweak.Core.Base;
using GTweak.Core.Item;
using GTweak.Core.Models;
using GTweak.Core.Services;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Ookii.Dialogs.Wpf;
namespace GTweak.Core.ViewModel
@@ -72,7 +72,7 @@ namespace GTweak.Core.ViewModel
ToolsView?.Refresh();
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private bool FilterTools(object obj)
@@ -97,7 +97,7 @@ namespace GTweak.Core.ViewModel
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog
{
UseDescriptionForTitle = true,
- SelectedPath = SettingsEngine.DownloadPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
+ SelectedPath = GlobalOptions.DownloadPath ?? Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
};
if (folderDialog.ShowDialog() == true)
@@ -106,28 +106,28 @@ namespace GTweak.Core.ViewModel
if (!string.IsNullOrWhiteSpace(selectedPath) && Directory.Exists(selectedPath))
{
- SettingsEngine.DownloadPath = selectedPath;
+ GlobalOptions.DownloadPath = selectedPath;
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private void OpenFolder()
{
try
{
- if (Directory.Exists(SettingsEngine.DownloadPath))
+ if (Directory.Exists(GlobalOptions.DownloadPath))
{
Process.Start(new ProcessStartInfo
{
- FileName = SettingsEngine.DownloadPath,
+ FileName = GlobalOptions.DownloadPath,
UseShellExecute = true,
Verb = "open"
});
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
\ No newline at end of file
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 104d9d0a..1ebe226f 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -190,9 +190,9 @@
<Compile Include="Assets\ShaderEffects\ColorWheelEffect.cs" />
<Compile Include="Core\Base\IViewPageBase.cs" />
<Compile Include="Core\Base\ViewModelPageBase.cs" />
- <Compile Include="Core\Converters\AngleToPercentConverter.cs" />
- <Compile Include="Core\Converters\PercentToWidthConverter.cs" />
- <Compile Include="Core\Converters\UsageToAngleConverter.cs" />
+ <Compile Include="Converters\AngleToPercentConverter.cs" />
+ <Compile Include="Converters\PercentToWidthConverter.cs" />
+ <Compile Include="Converters\UsageToAngleConverter.cs" />
<Compile Include="Core\Services\FuzzySearchService.cs" />
<Compile Include="Core\ViewModel\Components\DownloadSession.cs" />
<Compile Include="Core\ViewModel\Components\ToolsetItem.cs" />
@@ -214,30 +214,29 @@
<Compile Include="Core\ViewModel\ServicesViewModel.cs" />
<Compile Include="Core\ViewModel\SystemViewModel.cs" />
<Compile Include="Core\ViewModel\ToolsetViewModel.cs" />
- <Compile Include="Utilities\Animation\BlurAnimation.cs" />
- <Compile Include="Core\Behaviors\ArcAnimationBehavior.cs" />
- <Compile Include="Core\Behaviors\ScrollFadeBehavior.cs" />
- <Compile Include="Core\Behaviors\ScrollViewerBehavior.cs" />
- <Compile Include="Core\Behaviors\TextBoxClearBehavior.cs" />
- <Compile Include="Utilities\Configuration\IconExtractProvider.cs" />
- <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" />
- <Compile Include="Utilities\Managers\BluetoothManager.cs" />
- <Compile Include="Utilities\Tweaks\ConfidentialityTweaks.cs" />
- <Compile Include="Utilities\Tweaks\DefenderManager\AclPermissionsBackup.cs" />
- <Compile Include="Utilities\Tweaks\DefenderManager\WindowsDefender.cs" />
- <Compile Include="Utilities\Tweaks\InterfaceTweaks.cs" />
- <Compile Include="Utilities\Maintenance\NTFSCompressor.cs" />
- <Compile Include="Utilities\Tweaks\ServicesTweaks.cs" />
- <Compile Include="Utilities\Maintenance\SystemRestoreService.cs" />
- <Compile Include="Utilities\Tweaks\SystemTweaks.cs" />
- <Compile Include="Utilities\Tweaks\UninstallingPakages.cs" />
- <Compile Include="Utilities\Maintenance\WinLicenseHandler.cs" />
+ <Compile Include="Behaviors\ArcAnimationBehavior.cs" />
+ <Compile Include="Behaviors\ScrollFadeBehavior.cs" />
+ <Compile Include="Behaviors\ScrollViewerBehavior.cs" />
+ <Compile Include="Behaviors\TextBoxClearBehavior.cs" />
+ <Compile Include="Modules\Configuration\IconProvider.cs" />
+ <Compile Include="Modules\Configuration\NetworkProvider.cs" />
+ <Compile Include="Modules\Configuration\StorageTypeIdentifier.cs" />
+ <Compile Include="Modules\Configuration\HardwareData.cs" />
+ <Compile Include="Modules\Helpers\ControlDictionaryExtensions.cs" />
+ <Compile Include="Modules\Helpers\UnlockHandleHelper.cs" />
+ <Compile Include="Modules\Maintenance\MemoryCleaner.cs" />
+ <Compile Include="Modules\Maintenance\RegistryExporter.cs" />
+ <Compile Include="Modules\Managers\BluetoothManager.cs" />
+ <Compile Include="Modules\Tweaks\ConfidentialityTweaks.cs" />
+ <Compile Include="Modules\Tweaks\Defender\AclPermissionsBackup.cs" />
+ <Compile Include="Modules\Tweaks\Defender\DefenderTweaks.cs" />
+ <Compile Include="Modules\Tweaks\InterfaceTweaks.cs" />
+ <Compile Include="Modules\Maintenance\NTFSCompressor.cs" />
+ <Compile Include="Modules\Tweaks\ServicesTweaks.cs" />
+ <Compile Include="Modules\Maintenance\SystemRestoreService.cs" />
+ <Compile Include="Modules\Tweaks\SystemTweaks.cs" />
+ <Compile Include="Modules\Tweaks\AppxPackageHandler.cs" />
+ <Compile Include="Modules\Maintenance\WinLicenseHandler.cs" />
<Compile Include="View\AddonsView.xaml.cs">
<DependentUpon>AddonsView.xaml</DependentUpon>
</Compile>
@@ -454,33 +453,34 @@
</Compile>
<Compile Include="Core\Base\ViewModelBase.cs" />
<Compile Include="Core\RelayCommand.cs" />
- <Compile Include="Utilities\Animation\BrushAnimation.cs" />
- <Compile Include="Utilities\Animation\FactoryAnimation.cs" />
- <Compile Include="Utilities\Animation\NumberAnimation.cs" />
- <Compile Include="Utilities\Animation\TypewriterAnimation.cs" />
- <Compile Include="Utilities\Configuration\MonitoringProvider.cs" />
- <Compile Include="Utilities\Configuration\HardwareProvider.cs" />
- <Compile Include="Utilities\Controls\ErrorLogging.cs" />
- <Compile Include="Utilities\Controls\PathLocator.cs" />
- <Compile Include="Utilities\Controls\RunGuard.cs" />
- <Compile Include="Utilities\Controls\SettingsEngine.cs" />
- <Compile Include="Utilities\Helpers\BackgroundQueue.cs" />
- <Compile Include="Utilities\Helpers\CommandExecutor.cs" />
- <Compile Include="Utilities\Helpers\DisablingWinKeys.cs" />
- <Compile Include="Utilities\Helpers\RegistryHelp.cs" />
- <Compile Include="Utilities\Helpers\TakingOwnership.cs" />
- <Compile Include="Utilities\Helpers\TrustedInstaller.cs" />
- <Compile Include="Utilities\Managers\ArchiveManager.cs" />
- <Compile Include="Utilities\Managers\ControlWriterManager.cs" />
- <Compile Include="Utilities\Managers\ExplorerManager.cs" />
- <Compile Include="Utilities\Managers\FirewallManager.cs" />
- <Compile Include="Utilities\Managers\INIManager.cs" />
- <Compile Include="Utilities\Managers\NotificationManager.cs" />
- <Compile Include="Utilities\Managers\OverlayDialogManager.cs" />
- <Compile Include="Utilities\Managers\TaskSchedulerManager.cs" />
- <Compile Include="Utilities\Managers\TimerControlManager.cs" />
- <Compile Include="Utilities\Storage\TaskStorage.cs" />
- <Compile Include="Utilities\Storage\WinKeyStorage.cs" />
+ <Compile Include="Animations\BlurAnimation.cs" />
+ <Compile Include="Animations\BrushAnimation.cs" />
+ <Compile Include="Animations\AnimationFactory.cs" />
+ <Compile Include="Animations\NumberAnimation.cs" />
+ <Compile Include="Animations\TypewriterAnimation.cs" />
+ <Compile Include="Modules\Configuration\MonitoringProvider.cs" />
+ <Compile Include="Modules\Configuration\HardwareProvider.cs" />
+ <Compile Include="Modules\Common\ErrorLogger.cs" />
+ <Compile Include="Modules\Common\PathTargets.cs" />
+ <Compile Include="Modules\Common\RunGuard.cs" />
+ <Compile Include="Modules\Common\GlobalOptions.cs" />
+ <Compile Include="Modules\Managers\BackgroundQueueManager.cs" />
+ <Compile Include="Modules\Helpers\CommandExecutor.cs" />
+ <Compile Include="Modules\Helpers\KeyboardHookBlocker.cs" />
+ <Compile Include="Modules\Helpers\RegistryHelper.cs" />
+ <Compile Include="Modules\Helpers\TakingOwnership.cs" />
+ <Compile Include="Modules\Helpers\TrustedInstaller.cs" />
+ <Compile Include="Modules\Managers\ArchiveManager.cs" />
+ <Compile Include="Modules\Managers\ControlWriterManager.cs" />
+ <Compile Include="Modules\Managers\ExplorerManager.cs" />
+ <Compile Include="Modules\Managers\FirewallManager.cs" />
+ <Compile Include="Modules\Managers\INIManager.cs" />
+ <Compile Include="Modules\Managers\NotificationManager.cs" />
+ <Compile Include="Modules\Managers\OverlayDialogManager.cs" />
+ <Compile Include="Modules\Managers\TaskSchedulerManager.cs" />
+ <Compile Include="Modules\Managers\TimerControlManager.cs" />
+ <Compile Include="Modules\Storage\TaskStorage.cs" />
+ <Compile Include="Modules\Storage\WinKeyStorage.cs" />
<Compile Include="Windows\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
diff --git a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs b/.Source/GTweak/Modules/Common/ErrorLogger.cs
similarity index 90%
rename from .Source/GTweak/Utilities/Controls/ErrorLogging.cs
rename to .Source/GTweak/Modules/Common/ErrorLogger.cs
index 73781783..366220b8 100644
--- a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs
+++ b/.Source/GTweak/Modules/Common/ErrorLogger.cs
@@ -5,12 +5,12 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Helpers;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
-namespace GTweak.Utilities.Controls
+namespace GTweak.Modules.Common
{
- internal static class ErrorLogging
+ internal static class ErrorLogger
{
[Conditional("DEBUG")]
internal static void LogDebug(Exception ex, [CallerMemberName] string memberName = "") => Debug.WriteLine($"Debug: {ex.Message}\nStack Trace: {ex.StackTrace}\nMember: {memberName}\n");
@@ -41,15 +41,15 @@ namespace GTweak.Utilities.Controls
{
try
{
- using (FileStream stream = new FileStream(PathLocator.Files.ErrorLog, FileMode.Create, FileAccess.Write, FileShare.Read))
+ using (FileStream stream = new FileStream(PathTargets.Files.ErrorLog, FileMode.Create, FileAccess.Write, FileShare.Read))
using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8))
{
string separator = "---------------------------------------------------------";
Exception currentEx = ex;
byte exLevel = 1;
- await writer.WriteLineAsync($"{(isFatal ? "GTweak has crashed!" : "GTweak has encountered an error.")}\n{separator}\nIf you wish to report this, please open an issue here:\n{PathLocator.Links.GitHub}/GTweak/issues\n{separator}\n");
- await writer.WriteLineAsync($"{separator}\n[{DateTime.Now}]\nOS: {(string.IsNullOrEmpty(HardwareData.OS?.Name) ? "Unknown" : HardwareData.OS.Name)}\nVersion: {(string.IsNullOrEmpty(HardwareData.OS?.Version) ? "Unknown" : HardwareData.OS.Version)}\n{SettingsEngine.CurrentRelease.Full}\n{separator}\n");
+ await writer.WriteLineAsync($"{(isFatal ? "GTweak has crashed!" : "GTweak has encountered an error.")}\n{separator}\nIf you wish to report this, please open an issue here:\n{PathTargets.Links.GitHub}/GTweak/issues\n{separator}\n");
+ await writer.WriteLineAsync($"{separator}\n[{DateTime.Now}]\nOS: {(string.IsNullOrEmpty(HardwareData.OS?.Name) ? "Unknown" : HardwareData.OS.Name)}\nVersion: {(string.IsNullOrEmpty(HardwareData.OS?.Version) ? "Unknown" : HardwareData.OS.Version)}\n{GlobalOptions.CurrentRelease.Full}\n{separator}\n");
while (currentEx != null)
{
@@ -104,12 +104,12 @@ namespace GTweak.Utilities.Controls
await EnsureLogFileAssociation();
- if (File.Exists(PathLocator.Files.ErrorLog))
+ if (File.Exists(PathTargets.Files.ErrorLog))
{
try
{
await Task.Delay(50);
- Process.Start(new ProcessStartInfo { FileName = PathLocator.Files.ErrorLog, UseShellExecute = true });
+ Process.Start(new ProcessStartInfo { FileName = PathTargets.Files.ErrorLog, UseShellExecute = true });
}
catch (Exception processEx) { LogDebug(processEx); }
}
diff --git a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs b/.Source/GTweak/Modules/Common/GlobalOptions.cs
similarity index 78%
rename from .Source/GTweak/Utilities/Controls/SettingsEngine.cs
rename to .Source/GTweak/Modules/Common/GlobalOptions.cs
index 53659f7f..aa56d896 100644
--- a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
+++ b/.Source/GTweak/Modules/Common/GlobalOptions.cs
@@ -5,16 +5,16 @@ using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
using GTweak.Windows;
using Microsoft.Win32;
using Ookii.Dialogs.Wpf;
-namespace GTweak.Utilities.Controls
+namespace GTweak.Modules.Common
{
- internal sealed class SettingsEngine
+ internal sealed class GlobalOptions
{
[DllImport("winmm.dll")]
internal static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
@@ -63,14 +63,14 @@ namespace GTweak.Utilities.Controls
};
_cachedSettings[key] = value;
- RegistryHelp.Write(Registry.CurrentUser, PathLocator.Registry.SubKey, key, regValue, kind);
+ RegistryHelper.Write(Registry.CurrentUser, PathTargets.Registry.SubKey, key, regValue, kind);
}
internal static void СheckingParameters()
{
foreach (var kv in _defaultSettings)
{
- if (RegistryHelp.ValueExists(PathLocator.Registry.BaseKey, kv.Key) == false)
+ if (RegistryHelper.ValueExists(PathTargets.Registry.BaseKey, kv.Key) == false)
{
ChangingParameters(kv.Key, kv.Value);
}
@@ -78,9 +78,9 @@ namespace GTweak.Utilities.Controls
{
_cachedSettings[kv.Key] = kv.Value switch
{
- bool valueBool => RegistryHelp.GetValue(PathLocator.Registry.BaseKey, kv.Key, valueBool ? 1 : 0) is int i ? i != 0 : valueBool,
- int valueInt => RegistryHelp.GetValue(PathLocator.Registry.BaseKey, kv.Key, valueInt),
- _ => RegistryHelp.GetValue(PathLocator.Registry.BaseKey, kv.Key, kv.Value?.ToString())
+ bool valueBool => RegistryHelper.GetValue(PathTargets.Registry.BaseKey, kv.Key, valueBool ? 1 : 0) is int i ? i != 0 : valueBool,
+ int valueInt => RegistryHelper.GetValue(PathTargets.Registry.BaseKey, kv.Key, valueInt),
+ _ => RegistryHelper.GetValue(PathTargets.Registry.BaseKey, kv.Key, kv.Value?.ToString())
};
}
}
@@ -116,19 +116,19 @@ namespace GTweak.Utilities.Controls
try
{
- PathLocator.Files.Config = vistaSaveFileDialog.FileName;
+ PathTargets.Files.Config = vistaSaveFileDialog.FileName;
- if (Path.GetExtension(PathLocator.Files.Config)?.ToLower() != ".ini")
+ if (Path.GetExtension(PathTargets.Files.Config)?.ToLower() != ".ini")
{
- PathLocator.Files.Config = Path.ChangeExtension(PathLocator.Files.Config, ".ini");
+ PathTargets.Files.Config = Path.ChangeExtension(PathTargets.Files.Config, ".ini");
}
- if (File.Exists(PathLocator.Files.Config))
+ if (File.Exists(PathTargets.Files.Config))
{
- File.Delete(PathLocator.Files.Config);
+ File.Delete(PathTargets.Files.Config);
}
- INIManager iniManager = new INIManager(PathLocator.Files.Config);
+ INIManager iniManager = new INIManager(PathTargets.Files.Config);
iniManager.Write("GTweak", "Author", "Greedeks");
iniManager.Write("GTweak", "FormatVersion", "4");
iniManager.WriteAll(INIManager.SectionConf, INIManager.TempTweaksConf);
@@ -136,7 +136,7 @@ namespace GTweak.Utilities.Controls
iniManager.WriteAll(INIManager.SectionSvc, INIManager.TempTweaksSvc);
iniManager.WriteAll(INIManager.SectionSys, INIManager.TempTweaksSys);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
@@ -153,12 +153,12 @@ namespace GTweak.Utilities.Controls
return;
}
- PathLocator.Files.Config = vistaOpenFileDialog.FileName;
- INIManager iniManager = new INIManager(PathLocator.Files.Config);
+ PathTargets.Files.Config = vistaOpenFileDialog.FileName;
+ INIManager iniManager = new INIManager(PathTargets.Files.Config);
if (iniManager.GetKeysOrValue("GTweak", false).Contains("Greedeks") && iniManager.GetKeysOrValue("GTweak").Contains("FormatVersion") && iniManager.GetKeysOrValue("GTweak", false).Contains("4"))
{
- if (File.ReadLines(PathLocator.Files.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(PathLocator.Files.Config).Any(line => line.Contains("Slider")) || File.ReadLines(PathLocator.Files.Config).Any(line => line.Contains("ColorPicker")))
+ if (File.ReadLines(PathTargets.Files.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(PathTargets.Files.Config).Any(line => line.Contains("Slider")) || File.ReadLines(PathTargets.Files.Config).Any(line => line.Contains("ColorPicker")))
{
new ImportWindow(Path.GetFileName(vistaOpenFileDialog.FileName)).ShowDialog();
}
@@ -177,14 +177,14 @@ namespace GTweak.Utilities.Controls
{
try
{
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, PathLocator.Registry.SubKey);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Tracing\GTweak_RASAPI32");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Tracing\GTweak_RASMANCS");
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, PathTargets.Registry.SubKey);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Tracing\GTweak_RASAPI32");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Tracing\GTweak_RASMANCS");
CommandExecutor.RunCommand("/c " + CommandExecutor.CleanCommand(string.Join(" & ", new[] { $@"taskkill /f /im ""{CurrentName}""", "choice /c y /valueInt /d y /t 3", $@"del ""{CurrentLocation}""",
- $@"rd /s /q ""{PathLocator.Folders.Workspace}""", $@"rd /s /q ""{Environment.SystemDirectory}\config\systemprofile\AppData\Local\GTweak""" })));
+ $@"rd /s /q ""{PathTargets.Folders.Workspace}""", $@"rd /s /q ""{Environment.SystemDirectory}\config\systemprofile\AppData\Local\GTweak""" })));
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
internal static void SelfReboot() => CommandExecutor.RunCommand($"/c taskkill /f /im \"{CurrentName}\" & choice /c y /valueInt /d y /t 1 & start \"\" \"{CurrentLocation}\"");
diff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Modules/Common/PathTargets.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Controls/PathLocator.cs
rename to .Source/GTweak/Modules/Common/PathTargets.cs
index 3a12a602..8ee0708a 100644
--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs
+++ b/.Source/GTweak/Modules/Common/PathTargets.cs
@@ -3,9 +3,9 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
-namespace GTweak.Utilities.Controls
+namespace GTweak.Modules.Common
{
- internal class PathLocator
+ internal class PathTargets
{
internal static class Registry
{
@@ -178,7 +178,7 @@ namespace GTweak.Utilities.Controls
return candidateRel;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
@@ -232,7 +232,7 @@ namespace GTweak.Utilities.Controls
break;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
if (found)
@@ -240,7 +240,7 @@ namespace GTweak.Utilities.Controls
break;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
if (found)
@@ -276,11 +276,11 @@ namespace GTweak.Utilities.Controls
return candidate;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
exeCache.TryAdd(name, string.Empty);
diff --git a/.Source/GTweak/Utilities/Controls/RunGuard.cs b/.Source/GTweak/Modules/Common/RunGuard.cs
similarity index 86%
rename from .Source/GTweak/Utilities/Controls/RunGuard.cs
rename to .Source/GTweak/Modules/Common/RunGuard.cs
index 70ed8e92..e07c9da8 100644
--- a/.Source/GTweak/Utilities/Controls/RunGuard.cs
+++ b/.Source/GTweak/Modules/Common/RunGuard.cs
@@ -6,11 +6,11 @@ using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Helpers;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
using GTweak.Windows;
-namespace GTweak.Utilities.Controls
+namespace GTweak.Modules.Common
{
internal static class RunGuard
{
@@ -68,6 +68,6 @@ namespace GTweak.Utilities.Controls
new MessageWindow(MessageWindow.MessageWindowType.NotAdmin).ShowDialog();
}
- internal static void CheckingDefenderExclusions() => CommandExecutor.RunCommandAsTrustedInstaller($@"$ErrorActionPreference = 'Stop'; $target = '{SettingsEngine.CurrentLocation}'; try {{ $mp = Get-MpPreference; if ($mp.ExclusionProcess -notcontains $target) {{ Add-MpPreference -ExclusionProcess $target }}; if ($mp.ExclusionPath -notcontains $target) {{ Add-MpPreference -ExclusionPath $target }} }} catch {{}}", true);
+ internal static void CheckingDefenderExclusions() => CommandExecutor.RunCommandAsTrustedInstaller($@"$ErrorActionPreference = 'Stop'; $target = '{GlobalOptions.CurrentLocation}'; try {{ $mp = Get-MpPreference; if ($mp.ExclusionProcess -notcontains $target) {{ Add-MpPreference -ExclusionProcess $target }}; if ($mp.ExclusionPath -notcontains $target) {{ Add-MpPreference -ExclusionPath $target }} }} catch {{}}", true);
}
}
diff --git a/.Source/GTweak/Utilities/Configuration/HardwareData.cs b/.Source/GTweak/Modules/Configuration/HardwareData.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Configuration/HardwareData.cs
rename to .Source/GTweak/Modules/Configuration/HardwareData.cs
index 937b0eab..0945d36a 100644
--- a/.Source/GTweak/Utilities/Configuration/HardwareData.cs
+++ b/.Source/GTweak/Modules/Configuration/HardwareData.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Windows.Media;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
internal class HardwareData
{
diff --git a/.Source/GTweak/Utilities/Configuration/HardwareProvider.cs b/.Source/GTweak/Modules/Configuration/HardwareProvider.cs
similarity index 93%
rename from .Source/GTweak/Utilities/Configuration/HardwareProvider.cs
rename to .Source/GTweak/Modules/Configuration/HardwareProvider.cs
index fa2fc55b..5ed61f6b 100644
--- a/.Source/GTweak/Utilities/Configuration/HardwareProvider.cs
+++ b/.Source/GTweak/Modules/Configuration/HardwareProvider.cs
@@ -12,11 +12,11 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
using Microsoft.Win32;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
internal sealed class HardwareProvider : NetworkProvider
{
@@ -33,7 +33,7 @@ namespace GTweak.Utilities.Configuration
{
try
{
- string avatarPath = RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\{WindowsIdentity.GetCurrent().User?.Value}", "Image1080", string.Empty);
+ string avatarPath = RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\{WindowsIdentity.GetCurrent().User?.Value}", "Image1080", string.Empty);
if (!string.IsNullOrWhiteSpace(avatarPath) && File.Exists(avatarPath) && new FileInfo(avatarPath).Length != 0)
{
@@ -46,7 +46,7 @@ namespace GTweak.Utilities.Configuration
return bmp;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
return (ImageSource)Application.Current.Resources["Icon_ProfileAvatar"];
}
@@ -123,10 +123,10 @@ namespace GTweak.Utilities.Configuration
{
try
{
- string wallpaperPath = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper", string.Empty);
+ string wallpaperPath = RegistryHelper.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper", string.Empty);
string filePath = !string.IsNullOrWhiteSpace(wallpaperPath) && File.Exists(wallpaperPath) ? wallpaperPath :
- Directory.GetFiles(PathLocator.Folders.WallpaperCache, "TranscodedWallpaper*").Select(f => new FileInfo(f)).Where(f => f.Exists).OrderByDescending(f => f.LastWriteTime).FirstOrDefault()?.FullName ?? string.Empty;
+ Directory.GetFiles(PathTargets.Folders.WallpaperCache, "TranscodedWallpaper*").Select(f => new FileInfo(f)).Where(f => f.Exists).OrderByDescending(f => f.LastWriteTime).FirstOrDefault()?.FullName ?? string.Empty;
if (!string.IsNullOrWhiteSpace(filePath))
{
@@ -147,7 +147,7 @@ namespace GTweak.Utilities.Configuration
}
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
Wallpaper = null;
}
}
@@ -155,8 +155,8 @@ namespace GTweak.Utilities.Configuration
internal void GetOperatingSystemInfo()
{
string regPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion";
- int revisionNumber = RegistryHelp.GetValue(regPath, "UBR", 0);
- string release = RegistryHelp.GetValue(regPath, "DisplayVersion", string.Empty);
+ int revisionNumber = RegistryHelper.GetValue(regPath, "UBR", 0);
+ string release = RegistryHelper.GetValue(regPath, "DisplayVersion", string.Empty);
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\cimv2", "select Caption, Description, OSArchitecture, BuildNumber, Version from Win32_OperatingSystem", new EnumerationOptions { ReturnImmediately = true }))
{
@@ -185,7 +185,7 @@ namespace GTweak.Utilities.Configuration
{
try
{
- string output = CommandExecutor.GetCommandOutput(PathLocator.Executable.BcdEdit).GetAwaiter().GetResult();
+ string output = CommandExecutor.GetCommandOutput(PathTargets.Executable.BcdEdit).GetAwaiter().GetResult();
Bios.Mode = output.IndexOf("efi", StringComparison.OrdinalIgnoreCase) >= 0 ? "UEFI" : "Legacy Boot";
}
catch { Bios.Mode = string.Empty; }
@@ -239,7 +239,7 @@ namespace GTweak.Utilities.Configuration
{
bool isPci = rootPath.IndexOf("PCI", StringComparison.OrdinalIgnoreCase) >= 0;
- List<string> devices = RegistryHelp.GetSubKeyNames<List<string>>(Registry.LocalMachine, rootPath);
+ List<string> devices = RegistryHelper.GetSubKeyNames<List<string>>(Registry.LocalMachine, rootPath);
if (devices == null)
{
continue;
@@ -248,7 +248,7 @@ namespace GTweak.Utilities.Configuration
foreach (string deviceId in devices)
{
string devicePath = rootPath + @"\" + deviceId;
- List<string> instances = RegistryHelp.GetSubKeyNames<List<string>>(Registry.LocalMachine, devicePath);
+ List<string> instances = RegistryHelper.GetSubKeyNames<List<string>>(Registry.LocalMachine, devicePath);
if (instances == null)
{
continue;
@@ -256,14 +256,14 @@ namespace GTweak.Utilities.Configuration
foreach (string instanceId in instances)
{
- string driverRef = RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\{devicePath}\{instanceId}", "Driver", string.Empty);
+ string driverRef = RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\{devicePath}\{instanceId}", "Driver", string.Empty);
if (string.IsNullOrEmpty(driverRef))
{
continue;
}
- string driverDesc = RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{driverRef}", "DriverDesc", string.Empty);
+ string driverDesc = RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{driverRef}", "DriverDesc", string.Empty);
if (string.IsNullOrEmpty(driverDesc) || driverDesc.TrimStart().StartsWith("@", StringComparison.Ordinal))
{
@@ -538,7 +538,7 @@ namespace GTweak.Utilities.Configuration
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
return letters;
}
@@ -561,7 +561,7 @@ namespace GTweak.Utilities.Configuration
totalFreeSpace += drive.TotalFreeSpace;
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
if (totalSize > 0)
@@ -601,11 +601,11 @@ namespace GTweak.Utilities.Configuration
using RegistryKey subKey = regKey.OpenSubKey(subKeyName + @"\Properties");
if (subKey != null)
{
- string value24 = RegistryHelp.GetValue(propsPath, "{a45c254e-df1c-4efd-8020-67d146a850e0},24", string.Empty);
- string value8 = RegistryHelp.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},8", string.Empty);
- string value5 = RegistryHelp.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},5", string.Empty);
- string value6 = RegistryHelp.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},6", string.Empty);
- string valueID = RegistryHelp.GetValue(propsPath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},2", string.Empty);
+ string value24 = RegistryHelper.GetValue(propsPath, "{a45c254e-df1c-4efd-8020-67d146a850e0},24", string.Empty);
+ string value8 = RegistryHelper.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},8", string.Empty);
+ string value5 = RegistryHelper.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},5", string.Empty);
+ string value6 = RegistryHelper.GetValue(propsPath, "{a8b865dd-2e3d-4094-ad97-e593a70c75d6},6", string.Empty);
+ string valueID = RegistryHelper.GetValue(propsPath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},2", string.Empty);
if (!string.IsNullOrEmpty(valueID) && valueID.IndexOf(deviceID, StringComparison.OrdinalIgnoreCase) >= 0 &&
((!string.IsNullOrEmpty(value5) && value5.IndexOf("wdma_usb.inf", StringComparison.OrdinalIgnoreCase) >= 0) ||
@@ -613,8 +613,8 @@ namespace GTweak.Utilities.Configuration
(!string.IsNullOrEmpty(value6) && value6.IndexOf("USBAudio.inf", StringComparison.OrdinalIgnoreCase) >= 0) ||
(!string.IsNullOrEmpty(value24) && value24.IndexOf("usb", StringComparison.OrdinalIgnoreCase) >= 0)))
{
- string nameValue6 = RegistryHelp.GetValue(propsPath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},6", string.Empty).Trim();
- string typeNameValue2 = RegistryHelp.GetValue(propsPath, "{a45c254e-df1c-4efd-8020-67d146a850e0},2", string.Empty).Trim();
+ string nameValue6 = RegistryHelper.GetValue(propsPath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},6", string.Empty).Trim();
+ string typeNameValue2 = RegistryHelper.GetValue(propsPath, "{a45c254e-df1c-4efd-8020-67d146a850e0},2", string.Empty).Trim();
string name = nameValue6.Length > 10 && !string.Equals(nameValue6, typeNameValue2, StringComparison.OrdinalIgnoreCase) ? nameValue6 : $"{typeNameValue2} {nameValue6}";
return (true, name, isCapture);
diff --git a/.Source/GTweak/Utilities/Configuration/IconExtractProvider.cs b/.Source/GTweak/Modules/Configuration/IconProvider.cs
similarity index 97%
rename from .Source/GTweak/Utilities/Configuration/IconExtractProvider.cs
rename to .Source/GTweak/Modules/Configuration/IconProvider.cs
index e00011ac..78edf507 100644
--- a/.Source/GTweak/Utilities/Configuration/IconExtractProvider.cs
+++ b/.Source/GTweak/Modules/Configuration/IconProvider.cs
@@ -6,9 +6,9 @@ using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
- internal static class IconExtractProvider
+ internal static class IconProvider
{
internal enum StockIconType
{
diff --git a/.Source/GTweak/Utilities/Configuration/MonitoringProvider.cs b/.Source/GTweak/Modules/Configuration/MonitoringProvider.cs
similarity index 96%
rename from .Source/GTweak/Utilities/Configuration/MonitoringProvider.cs
rename to .Source/GTweak/Modules/Configuration/MonitoringProvider.cs
index 47d5de1f..a780906b 100644
--- a/.Source/GTweak/Utilities/Configuration/MonitoringProvider.cs
+++ b/.Source/GTweak/Modules/Configuration/MonitoringProvider.cs
@@ -7,10 +7,10 @@ using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Threading;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Microsoft.Win32;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
internal class MonitoringProvider : HardwareData
{
@@ -148,7 +148,7 @@ namespace GTweak.Utilities.Configuration
Interlocked.Increment(ref running);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).ToArray()).ConfigureAwait(false);
RunningServicesCount = running.ToString();
@@ -203,7 +203,7 @@ namespace GTweak.Utilities.Configuration
success = true;
}).ConfigureAwait(false);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
finally
{
if (!success)
@@ -257,7 +257,7 @@ namespace GTweak.Utilities.Configuration
_watcherHandler.Add((managementEvent, handler));
}).ConfigureAwait(false);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
internal void StopDeviceMonitoring()
@@ -270,7 +270,7 @@ namespace GTweak.Utilities.Configuration
watcher?.Stop();
watcher?.Dispose();
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
_watcherHandler?.Clear();
SystemEvents.DisplaySettingsChanged -= OnDisplaySettingsChanged;
diff --git a/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs b/.Source/GTweak/Modules/Configuration/NetworkProvider.cs
similarity index 92%
rename from .Source/GTweak/Utilities/Configuration/NetworkProvider.cs
rename to .Source/GTweak/Modules/Configuration/NetworkProvider.cs
index 159ff628..da25fd98 100644
--- a/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs
+++ b/.Source/GTweak/Modules/Configuration/NetworkProvider.cs
@@ -6,11 +6,11 @@ using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
internal class NetworkProvider : MonitoringProvider
{
@@ -43,7 +43,7 @@ namespace GTweak.Utilities.Configuration
string country = jObject["country_code"]?.ToString() ?? jObject["countryCode"]?.ToString() ?? jObject["addr"]?.ToString() ?? string.Empty;
return new IPMetadata { Ip = ip, Country = country.Trim() };
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
return new IPMetadata { Ip = string.Empty, Country = string.Empty };
@@ -118,7 +118,7 @@ namespace GTweak.Utilities.Configuration
{
bool hadLimited = false, hadBlock = false;
- foreach (string url in PathLocator.Links.IpServices)
+ foreach (string url in PathTargets.Links.IpServices)
{
try
{
@@ -178,9 +178,9 @@ namespace GTweak.Utilities.Configuration
internal async Task ValidateVersionUpdates()
{
- if (SettingsEngine.IsUpdateCheckRequired && await IsNetworkAvailable())
+ if (GlobalOptions.IsUpdateCheckRequired && await IsNetworkAvailable())
{
- foreach (string api in PathLocator.Links.ReleaseApi)
+ foreach (string api in PathTargets.Links.ReleaseApi)
{
try
{
@@ -198,7 +198,7 @@ namespace GTweak.Utilities.Configuration
{
GitMetadata latest = JsonConvert.DeserializeObject<GitMetadata>(json);
foundVersion = latest?.CurrentVersion;
- foundUrl = PathLocator.Links.LatestUpdate.GitHub;
+ foundUrl = PathTargets.Links.LatestUpdate.GitHub;
}
else
{
@@ -210,16 +210,16 @@ namespace GTweak.Utilities.Configuration
Match match = Regex.Match(latest.Description ?? "", @"\[.*?\]\(/uploads/(?<hash>.+?)\)");
if (match.Success)
{
- foundUrl = $"{PathLocator.Links.LatestUpdate.GitLabBase}{match.Groups["hash"].Value}";
+ foundUrl = $"{PathTargets.Links.LatestUpdate.GitLabBase}{match.Groups["hash"].Value}";
}
}
}
if (!string.IsNullOrEmpty(foundUrl))
{
- PathLocator.Links.LatestUpdate.Resolved = foundUrl;
+ PathTargets.Links.LatestUpdate.Resolved = foundUrl;
- if (new Version(foundVersion) > new Version(SettingsEngine.CurrentRelease.Short))
+ if (new Version(foundVersion) > new Version(GlobalOptions.CurrentRelease.Short))
{
IsNeedUpdate = true;
DownloadVersion = foundVersion;
diff --git a/.Source/GTweak/Utilities/Configuration/StorageTypeIdentifier.cs b/.Source/GTweak/Modules/Configuration/StorageTypeIdentifier.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Configuration/StorageTypeIdentifier.cs
rename to .Source/GTweak/Modules/Configuration/StorageTypeIdentifier.cs
index b2bb34e9..f452b087 100644
--- a/.Source/GTweak/Utilities/Configuration/StorageTypeIdentifier.cs
+++ b/.Source/GTweak/Modules/Configuration/StorageTypeIdentifier.cs
@@ -2,7 +2,7 @@ using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
-namespace GTweak.Utilities.Configuration
+namespace GTweak.Modules.Configuration
{
internal static class StorageTypeIdentifier
{
diff --git a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs b/.Source/GTweak/Modules/Helpers/CommandExecutor.cs
similarity index 88%
rename from .Source/GTweak/Utilities/Helpers/CommandExecutor.cs
rename to .Source/GTweak/Modules/Helpers/CommandExecutor.cs
index 07f3ecd3..3041cd10 100644
--- a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
+++ b/.Source/GTweak/Modules/Helpers/CommandExecutor.cs
@@ -5,9 +5,9 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
internal static class CommandExecutor
{
@@ -17,7 +17,7 @@ namespace GTweak.Utilities.Helpers
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
- FileName = isPowerShell ? PathLocator.Executable.PowerShell : PathLocator.Executable.CommandShell,
+ FileName = isPowerShell ? PathTargets.Executable.PowerShell : PathTargets.Executable.CommandShell,
Arguments = isPowerShell ? $"-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command}\"" : command,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
@@ -31,7 +31,7 @@ namespace GTweak.Utilities.Helpers
using Process process = new Process { StartInfo = startInfo };
try { process.Start(); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
@@ -48,8 +48,8 @@ namespace GTweak.Utilities.Helpers
internal static void RunCommandAsTrustedInstaller(string command, bool isPowerShell = false) =>
TrustedInstaller.CreateProcessAsTrustedInstaller(PID, isPowerShell
- ? $"\"{PathLocator.Executable.PowerShell}\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command.Replace("\"", "`\"")}\""
- : $"\"{PathLocator.Executable.CommandShell}\" {command}");
+ ? $"\"{PathTargets.Executable.PowerShell}\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command.Replace("\"", "`\"")}\""
+ : $"\"{PathTargets.Executable.CommandShell}\" {command}");
internal static async void RunCommand(string command, bool isPowerShell = false)
{
@@ -57,7 +57,7 @@ namespace GTweak.Utilities.Helpers
{
ProcessStartInfo startInfo = new ProcessStartInfo()
{
- FileName = isPowerShell ? PathLocator.Executable.PowerShell : PathLocator.Executable.CommandShell,
+ FileName = isPowerShell ? PathTargets.Executable.PowerShell : PathTargets.Executable.CommandShell,
Arguments = isPowerShell ? $"-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command}\"" : command,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
@@ -67,7 +67,7 @@ namespace GTweak.Utilities.Helpers
using Process process = new Process { StartInfo = startInfo };
try { process.Start(); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).ConfigureAwait(false);
}
@@ -93,7 +93,7 @@ namespace GTweak.Utilities.Helpers
using Process process = new Process() { StartInfo = startInfo };
try { process.Start(); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}).ConfigureAwait(false);
}
@@ -102,7 +102,7 @@ namespace GTweak.Utilities.Helpers
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
- FileName = isPowerShell ? PathLocator.Executable.PowerShell : PathLocator.Executable.CommandShell,
+ FileName = isPowerShell ? PathTargets.Executable.PowerShell : PathTargets.Executable.CommandShell,
Arguments = isPowerShell ? $"-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{command}\"" : command,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
@@ -117,7 +117,7 @@ namespace GTweak.Utilities.Helpers
process.Start();
await process.WaitForExitAsync().ConfigureAwait(false);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
internal static Task WaitForExitAsync(this Process process)
diff --git a/.Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs b/.Source/GTweak/Modules/Helpers/ControlDictionaryExtensions.cs
similarity index 97%
rename from .Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs
rename to .Source/GTweak/Modules/Helpers/ControlDictionaryExtensions.cs
index c6454d59..1a18ded6 100644
--- a/.Source/GTweak/Utilities/Helpers/ControlDictionaryExtensions.cs
+++ b/.Source/GTweak/Modules/Helpers/ControlDictionaryExtensions.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
internal static class ControlDictionaryExtensions
{
diff --git a/.Source/GTweak/Utilities/Helpers/DisablingWinKeys.cs b/.Source/GTweak/Modules/Helpers/KeyboardHookBlocker.cs
similarity index 93%
rename from .Source/GTweak/Utilities/Helpers/DisablingWinKeys.cs
rename to .Source/GTweak/Modules/Helpers/KeyboardHookBlocker.cs
index 23775aad..1a94f461 100644
--- a/.Source/GTweak/Utilities/Helpers/DisablingWinKeys.cs
+++ b/.Source/GTweak/Modules/Helpers/KeyboardHookBlocker.cs
@@ -3,9 +3,9 @@ using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Windows.Input;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
- internal sealed class DisablingWinKeys
+ internal sealed class KeyboardHookBlocker
{
[StructLayout(LayoutKind.Sequential)]
private struct KBDLLHOOKSTRUCT
@@ -31,7 +31,7 @@ namespace GTweak.Utilities.Helpers
internal IntPtr ptrHook;
internal LowLevelKeyboardProc objKeyboardProcess;
- internal DisablingWinKeys() => objKeyboardProcess = CaptureKey;
+ internal KeyboardHookBlocker() => objKeyboardProcess = CaptureKey;
internal IntPtr CaptureKey(int nCode, IntPtr wp, IntPtr lp)
{
diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Modules/Helpers/RegistryHelper.cs
similarity index 92%
rename from .Source/GTweak/Utilities/Helpers/RegistryHelp.cs
rename to .Source/GTweak/Modules/Helpers/RegistryHelper.cs
index 47082b06..cb15430a 100644
--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
+++ b/.Source/GTweak/Modules/Helpers/RegistryHelper.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Microsoft.Win32;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
- internal sealed class RegistryHelp : TakingOwnership
+ internal sealed class RegistryHelper : TakingOwnership
{
private static string GeneralRegistry(RegistryKey registrykey)
{
@@ -38,7 +38,7 @@ namespace GTweak.Utilities.Helpers
registrykey.OpenSubKey(subkey, true)?.DeleteValue(value);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).GetAwaiter().GetResult();
}
@@ -55,7 +55,7 @@ namespace GTweak.Utilities.Helpers
registrykey.CreateSubKey(subkey, true)?.SetValue(name, data, kind);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).GetAwaiter().GetResult();
}
@@ -64,7 +64,7 @@ namespace GTweak.Utilities.Helpers
Task.Run(delegate
{
try { registrykey.CreateSubKey(subkey); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).GetAwaiter().GetResult();
}
@@ -86,12 +86,12 @@ namespace GTweak.Utilities.Helpers
foreach (string value in registryFolder.GetValueNames())
{
try { registryFolder.DeleteValue(value); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
registrykey.DeleteSubKeyTree(subkey, false);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}).GetAwaiter().GetResult();
}
diff --git a/.Source/GTweak/Utilities/Helpers/TakingOwnership.cs b/.Source/GTweak/Modules/Helpers/TakingOwnership.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Helpers/TakingOwnership.cs
rename to .Source/GTweak/Modules/Helpers/TakingOwnership.cs
index e68b5fc0..59208660 100644
--- a/.Source/GTweak/Utilities/Helpers/TakingOwnership.cs
+++ b/.Source/GTweak/Modules/Helpers/TakingOwnership.cs
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
internal class TakingOwnership
{
@@ -262,7 +262,7 @@ namespace GTweak.Utilities.Helpers
SetNamedSecurityInfo(name, type, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION, IntPtr.Zero, IntPtr.Zero, acl, IntPtr.Zero);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
setPrivilege(SE_TAKE_OWNERSHIP_NAME, false);
diff --git a/.Source/GTweak/Utilities/Helpers/TrustedInstaller.cs b/.Source/GTweak/Modules/Helpers/TrustedInstaller.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Helpers/TrustedInstaller.cs
rename to .Source/GTweak/Modules/Helpers/TrustedInstaller.cs
index 5fd1dcc6..be84a2e2 100644
--- a/.Source/GTweak/Utilities/Helpers/TrustedInstaller.cs
+++ b/.Source/GTweak/Modules/Helpers/TrustedInstaller.cs
@@ -4,7 +4,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using System.ServiceProcess;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
internal sealed class TrustedInstaller
{
diff --git a/.Source/GTweak/Utilities/Helpers/UnlockHandleHelper.cs b/.Source/GTweak/Modules/Helpers/UnlockHandleHelper.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Helpers/UnlockHandleHelper.cs
rename to .Source/GTweak/Modules/Helpers/UnlockHandleHelper.cs
index a614bf76..0ca86aec 100644
--- a/.Source/GTweak/Utilities/Helpers/UnlockHandleHelper.cs
+++ b/.Source/GTweak/Modules/Helpers/UnlockHandleHelper.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Helpers
{
internal static class UnlockHandleHelper
{
@@ -86,7 +86,7 @@ namespace GTweak.Utilities.Helpers
process.CloseMainWindow();
process.WaitForExit(1000);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
if (!process.HasExited)
{
@@ -94,7 +94,7 @@ namespace GTweak.Utilities.Helpers
process.WaitForExit(2000);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
@@ -160,7 +160,7 @@ namespace GTweak.Utilities.Helpers
result.Add(info.Process.dwProcessId);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
finally { RmEndSession(sessionHandle); }
return result;
diff --git a/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs b/.Source/GTweak/Modules/Maintenance/MemoryCleaner.cs
similarity index 84%
rename from .Source/GTweak/Utilities/Maintenance/ClearingMemory.cs
rename to .Source/GTweak/Modules/Maintenance/MemoryCleaner.cs
index 40949d51..49563452 100644
--- a/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs
+++ b/.Source/GTweak/Modules/Maintenance/MemoryCleaner.cs
@@ -7,11 +7,11 @@ using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
-namespace GTweak.Utilities.Maintenance
+namespace GTweak.Modules.Maintenance
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct SYSTEM_CACHE_INFORMATION
@@ -49,9 +49,9 @@ namespace GTweak.Utilities.Maintenance
internal int Attr;
}
- internal sealed class ClearingMemory
+ internal sealed class MemoryCleaner
{
- internal bool IsWinOldExists => Directory.Exists(PathLocator.Folders.WindowsOld);
+ internal bool IsWinOldExists => Directory.Exists(PathTargets.Folders.WindowsOld);
private const int SE_PRIVILEGE_ENABLED = 2;
private const string SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege";
@@ -157,7 +157,7 @@ namespace GTweak.Utilities.Maintenance
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private static bool SetIncreasePrivilege(string privilegeName)
@@ -190,26 +190,26 @@ namespace GTweak.Utilities.Maintenance
if (shouldRemoveWinOld)
{
- UnlockHandleHelper.UnlockDirectory(PathLocator.Folders.WindowsOld);
+ UnlockHandleHelper.UnlockDirectory(PathTargets.Folders.WindowsOld);
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c takeown /f ""{PathLocator.Folders.WindowsOld}"" /r /d y && icacls ""{PathLocator.Folders.WindowsOld}"" /inheritance:r && icacls ""{PathLocator.Folders.WindowsOld}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 && icacls ""{PathLocator.Folders.WindowsOld}"" /grant {Environment.UserName}:F /t && rd /s /q ""{PathLocator.Folders.WindowsOld}""");
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c takeown /f ""{PathTargets.Folders.WindowsOld}"" /r /d y && icacls ""{PathTargets.Folders.WindowsOld}"" /inheritance:r && icacls ""{PathTargets.Folders.WindowsOld}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 && icacls ""{PathTargets.Folders.WindowsOld}"" /grant {Environment.UserName}:F /t && rd /s /q ""{PathTargets.Folders.WindowsOld}""");
for (int i = 0; IsWinOldExists && i < 10; i++)
{
- try { Directory.Delete(PathLocator.Folders.WindowsOld, true); Thread.Sleep(300); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ try { Directory.Delete(PathTargets.Folders.WindowsOld, true); Thread.Sleep(300); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
- CommandExecutor.RunCommand($"Remove-Item -LiteralPath '{PathLocator.Folders.WindowsOld}' -Recurse -Force", true);
+ CommandExecutor.RunCommand($"Remove-Item -LiteralPath '{PathTargets.Folders.WindowsOld}' -Recurse -Force", true);
}
}
- CommandExecutor.RunCommandAsTrustedInstaller(@$"/c rd /s /q {PathLocator.Folders.SystemDrive}Windows\Temp & " +
- @$"rd /s /q %localappdata%\Temp & rd /s /q {PathLocator.Folders.SystemDrive}Windows\ff*.tmp & rd /s /q {PathLocator.Folders.SystemDrive}Windows\History\* & " +
- $@"rd /s /q {PathLocator.Folders.SystemDrive}Windows\CbsTemp\* & rd /s /q {PathLocator.Folders.SystemDrive}Windows\System32\SleepStudy\* & " +
- $@"rd /s /q {PathLocator.Folders.SystemDrive}Users\%USERNAME%\AppData\Local\Microsoft\Windows\INetCache\IE\* & rd /s /q {PathLocator.Folders.SystemDrive}Windows\Downloaded Program Files\* & " +
- $@"del /f /q {PathLocator.Folders.SystemDrive}Windows\setupapi.log & rd /s /q {PathLocator.Folders.SystemDrive}Windows\Panther\* & " +
- $@"for /D %D in (""{PathLocator.Folders.SystemDrive}ProgramData\Microsoft\Windows\WER\*"") do (del /s /q ""%D\*.*"" & for /D %E in (""%D\*"") do rd /s /q ""%E"") & " +
- $@"del /f /q {PathLocator.Folders.SystemDrive}Windows\INF\setupapi.app.log & del /f /q {PathLocator.Folders.SystemDrive}Windows\INF\setupapi.dev.log & del /f /q {PathLocator.Folders.SystemDrive}Windows\INF\setupapi.offline.log");
+ CommandExecutor.RunCommandAsTrustedInstaller(@$"/c rd /s /q {PathTargets.Folders.SystemDrive}Windows\Temp & " +
+ @$"rd /s /q %localappdata%\Temp & rd /s /q {PathTargets.Folders.SystemDrive}Windows\ff*.tmp & rd /s /q {PathTargets.Folders.SystemDrive}Windows\History\* & " +
+ $@"rd /s /q {PathTargets.Folders.SystemDrive}Windows\CbsTemp\* & rd /s /q {PathTargets.Folders.SystemDrive}Windows\System32\SleepStudy\* & " +
+ $@"rd /s /q {PathTargets.Folders.SystemDrive}Users\%USERNAME%\AppData\Local\Microsoft\Windows\INetCache\IE\* & rd /s /q {PathTargets.Folders.SystemDrive}Windows\Downloaded Program Files\* & " +
+ $@"del /f /q {PathTargets.Folders.SystemDrive}Windows\setupapi.log & rd /s /q {PathTargets.Folders.SystemDrive}Windows\Panther\* & " +
+ $@"for /D %D in (""{PathTargets.Folders.SystemDrive}ProgramData\Microsoft\Windows\WER\*"") do (del /s /q ""%D\*.*"" & for /D %E in (""%D\*"") do rd /s /q ""%E"") & " +
+ $@"del /f /q {PathTargets.Folders.SystemDrive}Windows\INF\setupapi.app.log & del /f /q {PathTargets.Folders.SystemDrive}Windows\INF\setupapi.dev.log & del /f /q {PathTargets.Folders.SystemDrive}Windows\INF\setupapi.offline.log");
ExplorerManager.Restart(async () =>
{
diff --git a/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs b/.Source/GTweak/Modules/Maintenance/NTFSCompressor.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs
rename to .Source/GTweak/Modules/Maintenance/NTFSCompressor.cs
index e42dc315..ffe35bcf 100644
--- a/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs
+++ b/.Source/GTweak/Modules/Maintenance/NTFSCompressor.cs
@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;
-namespace GTweak.Utilities.Maintenance
+namespace GTweak.Modules.Maintenance
{
internal sealed class NTFSCompressor
{
diff --git a/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs b/.Source/GTweak/Modules/Maintenance/RegistryExporter.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Maintenance/RegistryExporter.cs
rename to .Source/GTweak/Modules/Maintenance/RegistryExporter.cs
index ac5e2913..b8eb0c09 100644
--- a/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs
+++ b/.Source/GTweak/Modules/Maintenance/RegistryExporter.cs
@@ -2,11 +2,11 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Managers;
using Microsoft.Win32;
-namespace GTweak.Utilities.Maintenance
+namespace GTweak.Modules.Maintenance
{
internal sealed class RegistryExporter
{
@@ -66,7 +66,7 @@ namespace GTweak.Utilities.Maintenance
internal void Export(string fileName)
{
- string tempDir = PathLocator.Folders.Workspace;
+ string tempDir = PathTargets.Folders.Workspace;
Directory.CreateDirectory(tempDir);
List<string> tempFiles = new List<string>();
diff --git a/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs b/.Source/GTweak/Modules/Maintenance/SystemRestoreService.cs
similarity index 84%
rename from .Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs
rename to .Source/GTweak/Modules/Maintenance/SystemRestoreService.cs
index 3be5a07e..d83b61fd 100644
--- a/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs
+++ b/.Source/GTweak/Modules/Maintenance/SystemRestoreService.cs
@@ -4,12 +4,12 @@ using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.Windows;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
using Microsoft.Win32;
-namespace GTweak.Utilities.Maintenance
+namespace GTweak.Modules.Maintenance
{
internal sealed class SystemRestoreService : TaskSchedulerManager
{
@@ -20,13 +20,13 @@ namespace GTweak.Utilities.Maintenance
private readonly ManagementClass _restorePoint = new ManagementClass(new ManagementScope(@"\\localhost\root\default"), new ManagementPath("SystemRestore"), new ObjectGetOptions());
private ManagementBaseObject _inParams, _outParams;
- internal bool IsPointCreationAllowed => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "RPSessionInterval", "0");
+ internal bool IsPointCreationAllowed => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "RPSessionInterval", "0");
internal void CreateRestorePoint()
{
try
{
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord);
if (!IsPointCreationAllowed && !EnableRestorePoint("error_point_noty"))
{
@@ -69,7 +69,7 @@ namespace GTweak.Utilities.Maintenance
NotificationManager.Show("warn", "error_point_noty").WithDelay(300).Perform();
}
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency");
}
catch { NotificationManager.Show("warn", "error_point_noty").Perform(); }
}
@@ -94,7 +94,7 @@ namespace GTweak.Utilities.Maintenance
CommandExecutor.RunCommand("/c sc config wbengine start= disabled && sc config swprv start= disabled && sc config vds start= disabled && sc config VSS start= disabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients", "{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients", "{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}");
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"\\localhost\root\default", "SELECT SequenceNumber FROM SystemRestore", new EnumerationOptions { ReturnImmediately = true }))
{
@@ -107,14 +107,14 @@ namespace GTweak.Utilities.Maintenance
}
}
- DisableSR(PathLocator.Folders.SystemDrive + @"\\");
+ DisableSR(PathTargets.Folders.SystemDrive + @"\\");
}
internal bool EnableRestorePoint(string errorKey = "error_recovery_noty")
{
try
{
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore");
SetTaskState(true, restoreTask);
diff --git a/.Source/GTweak/Utilities/Maintenance/WinLicenseHandler.cs b/.Source/GTweak/Modules/Maintenance/WinLicenseHandler.cs
similarity index 81%
rename from .Source/GTweak/Utilities/Maintenance/WinLicenseHandler.cs
rename to .Source/GTweak/Modules/Maintenance/WinLicenseHandler.cs
index b8eaee00..a7fd17ee 100644
--- a/.Source/GTweak/Utilities/Maintenance/WinLicenseHandler.cs
+++ b/.Source/GTweak/Modules/Maintenance/WinLicenseHandler.cs
@@ -7,15 +7,15 @@ using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Storage;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Storage;
using GTweak.Windows;
using Microsoft.Win32;
-namespace GTweak.Utilities.Maintenance
+namespace GTweak.Modules.Maintenance
{
internal sealed class WinLicenseHandler : WinKeyStorage
{
@@ -44,9 +44,9 @@ namespace GTweak.Utilities.Maintenance
string output = await CommandExecutor.GetCommandOutput("cscript //B \"$env:windir\\system32\\slmgr.vbs\" /ato; $code = $LASTEXITCODE; ($code -eq 0 -or $code -eq -2147024773)", true);
bool.TryParse(output, out IsWindowsActivated);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
internal static async Task StartActivation()
@@ -74,9 +74,9 @@ namespace GTweak.Utilities.Maintenance
await CommandExecutor.InvokeRunCommand($"/c slmgr.vbs //b /ipk {keyWinHWID}");
- CommandExecutor.RunCommand($@"/c del /f /q {PathLocator.Folders.SystemDrive}ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\*.xml & del /f /q {PathLocator.Folders.SystemDrive}ProgramData\Microsoft\Windows\ClipSVC\Install\Migration\*.xml");
- string originalGeo = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\International\Geo", "Name", CultureInfo.InstalledUICulture.Name.Split('-')[1].ToUpperInvariant());
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", "US", RegistryValueKind.String);
+ CommandExecutor.RunCommand($@"/c del /f /q {PathTargets.Folders.SystemDrive}ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\*.xml & del /f /q {PathTargets.Folders.SystemDrive}ProgramData\Microsoft\Windows\ClipSVC\Install\Migration\*.xml");
+ string originalGeo = RegistryHelper.GetValue(@"HKEY_CURRENT_USER\Control Panel\International\Geo", "Name", CultureInfo.InstalledUICulture.Name.Split('-')[1].ToUpperInvariant());
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", "US", RegistryValueKind.String);
string svcRestartCmd = string.Join(" & ", new[] { "ClipSVC", "wlidsvc", "sppsvc", "KeyIso", "LicenseManager", "Winmgmt" }.Select(service => $"sc config {service} start= auto && sc start {service}"));
await CommandExecutor.InvokeRunCommand($"/c {svcRestartCmd}");
@@ -84,16 +84,16 @@ namespace GTweak.Utilities.Maintenance
await Task.Delay(3000);
XDocument xmlDoc = XDocument.Parse(Properties.Resources.Tickets);
- XElement foundTicket = xmlDoc.Descendants("Ticket").FirstOrDefault(t => t.Element("product") != null && t.Element("product").Value.IndexOf(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "OSProductPfn", string.Empty), StringComparison.OrdinalIgnoreCase) >= 0);
+ XElement foundTicket = xmlDoc.Descendants("Ticket").FirstOrDefault(t => t.Element("product") != null && t.Element("product").Value.IndexOf(RegistryHelper.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "OSProductPfn", string.Empty), StringComparison.OrdinalIgnoreCase) >= 0);
foundTicket ??= xmlDoc.Descendants("Ticket").FirstOrDefault(t => t.Element("product") != null && t.Element("product").Value == "KMS");
XDocument genuineXml = XDocument.Parse(foundTicket.Element("content")?.Value.Trim());
- genuineXml.Save(Path.Combine(PathLocator.Folders.SystemDrive, "ProgramData", "Microsoft", "Windows", "ClipSVC", "GenuineTicket", "GenuineTicket.xml"));
+ genuineXml.Save(Path.Combine(PathTargets.Folders.SystemDrive, "ProgramData", "Microsoft", "Windows", "ClipSVC", "GenuineTicket", "GenuineTicket.xml"));
await Task.Delay(3000);
await CommandExecutor.InvokeRunCommand("clipup -v -o", true);
await CommandExecutor.InvokeRunCommand("/c slmgr.vbs //b /ato");
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", originalGeo, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", originalGeo, RegistryValueKind.String);
LicenseStatus();
diff --git a/.Source/GTweak/Utilities/Managers/ArchiveManager.cs b/.Source/GTweak/Modules/Managers/ArchiveManager.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Managers/ArchiveManager.cs
rename to .Source/GTweak/Modules/Managers/ArchiveManager.cs
index 848bf320..e633413f 100644
--- a/.Source/GTweak/Utilities/Managers/ArchiveManager.cs
+++ b/.Source/GTweak/Modules/Managers/ArchiveManager.cs
@@ -1,7 +1,7 @@
using System.IO;
using System.IO.Compression;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal static class ArchiveManager
{
diff --git a/.Source/GTweak/Utilities/Helpers/BackgroundQueue.cs b/.Source/GTweak/Modules/Managers/BackgroundQueueManager.cs
similarity index 93%
rename from .Source/GTweak/Utilities/Helpers/BackgroundQueue.cs
rename to .Source/GTweak/Modules/Managers/BackgroundQueueManager.cs
index e903fd99..2adfc8d9 100644
--- a/.Source/GTweak/Utilities/Helpers/BackgroundQueue.cs
+++ b/.Source/GTweak/Modules/Managers/BackgroundQueueManager.cs
@@ -2,9 +2,9 @@ using System;
using System.Threading;
using System.Threading.Tasks;
-namespace GTweak.Utilities.Helpers
+namespace GTweak.Modules.Managers
{
- internal sealed class BackgroundQueue
+ internal sealed class BackgroundQueueManager
{
private Task _previousTask = Task.FromResult(true);
private readonly object _key = new object();
diff --git a/.Source/GTweak/Utilities/Managers/BluetoothManager.cs b/.Source/GTweak/Modules/Managers/BluetoothManager.cs
similarity index 94%
rename from .Source/GTweak/Utilities/Managers/BluetoothManager.cs
rename to .Source/GTweak/Modules/Managers/BluetoothManager.cs
index de95e7f5..691003e4 100644
--- a/.Source/GTweak/Utilities/Managers/BluetoothManager.cs
+++ b/.Source/GTweak/Modules/Managers/BluetoothManager.cs
@@ -4,11 +4,11 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using Windows.Devices.Radios;
using Windows.Foundation;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal class BluetoothManager
{
@@ -65,7 +65,7 @@ namespace GTweak.Utilities.Managers
Await(_bluetooth.SetStateAsync(targetState));
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
});
}
diff --git a/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs b/.Source/GTweak/Modules/Managers/ControlWriterManager.cs
similarity index 98%
rename from .Source/GTweak/Utilities/Managers/ControlWriterManager.cs
rename to .Source/GTweak/Modules/Managers/ControlWriterManager.cs
index 22b95144..bb1e7f91 100644
--- a/.Source/GTweak/Utilities/Managers/ControlWriterManager.cs
+++ b/.Source/GTweak/Modules/Managers/ControlWriterManager.cs
@@ -1,7 +1,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal sealed class ControlWriterManager
{
diff --git a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs b/.Source/GTweak/Modules/Managers/ExplorerManager.cs
similarity index 94%
rename from .Source/GTweak/Utilities/Managers/ExplorerManager.cs
rename to .Source/GTweak/Modules/Managers/ExplorerManager.cs
index d35ab5b5..5b281188 100644
--- a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
+++ b/.Source/GTweak/Modules/Managers/ExplorerManager.cs
@@ -4,10 +4,10 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Tweaks;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal class ExplorerManager
{
@@ -103,17 +103,17 @@ namespace GTweak.Utilities.Managers
}
try { capturedActions?.Invoke(); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
using Process launchExplorer = new Process();
- launchExplorer.StartInfo.FileName = PathLocator.Executable.Explorer;
+ launchExplorer.StartInfo.FileName = PathTargets.Executable.Explorer;
launchExplorer.StartInfo.Arguments = "/factory,{EFD469A7-7E0A-4517-8B39-45873948DA31}";
launchExplorer.StartInfo.UseShellExecute = true;
launchExplorer.Start();
}
finally { _semaphore.Release(); }
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}, token);
}
}
@@ -127,7 +127,7 @@ namespace GTweak.Utilities.Managers
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, IntPtr.Zero, IntPtr.Zero);
SendMessageTimeout(new IntPtr((int)HWND_BROADCAST), WM_SETTINGCHANGE, UIntPtr.Zero, "TraySettings", SMTO_ABORTIFHUNG, 100, out UIntPtr result);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
});
}
}
diff --git a/.Source/GTweak/Utilities/Managers/FirewallManager.cs b/.Source/GTweak/Modules/Managers/FirewallManager.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Managers/FirewallManager.cs
rename to .Source/GTweak/Modules/Managers/FirewallManager.cs
index 22733b8f..09180136 100644
--- a/.Source/GTweak/Utilities/Managers/FirewallManager.cs
+++ b/.Source/GTweak/Modules/Managers/FirewallManager.cs
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
+using GTweak.Modules.Common;
using NetFwTypeLib;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal class FirewallManager : TaskSchedulerManager
{
@@ -54,8 +54,8 @@ namespace GTweak.Utilities.Managers
{
Parallel.ForEach(new[]
{
- (PathLocator.Targets.WindowsUpdate.WorkerCore.Normal, _nameRules["Update"]),
- (PathLocator.Targets.WindowsUpdate.UsoClient.Normal, $"{_nameRules["Update"]} (Update Orchestrator)")
+ (PathTargets.Targets.WindowsUpdate.WorkerCore.Normal, _nameRules["Update"]),
+ (PathTargets.Targets.WindowsUpdate.UsoClient.Normal, $"{_nameRules["Update"]} (Update Orchestrator)")
},
executableFile =>
{
@@ -148,8 +148,8 @@ namespace GTweak.Utilities.Managers
protected static void BlockWDefender(bool state)
{
- try { Parallel.Invoke(() => { ChangeRules(state, PathLocator.Targets.Defender.MpCmdRun.Normal, _nameRules["WDefender"], NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT, "blocking Windows Defender database updates"); }); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ try { Parallel.Invoke(() => { ChangeRules(state, PathTargets.Targets.Defender.MpCmdRun.Normal, _nameRules["WDefender"], NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT, "blocking Windows Defender database updates"); }); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
}
diff --git a/.Source/GTweak/Utilities/Managers/INIManager.cs b/.Source/GTweak/Modules/Managers/INIManager.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Managers/INIManager.cs
rename to .Source/GTweak/Modules/Managers/INIManager.cs
index ec1a673b..33e13a9f 100644
--- a/.Source/GTweak/Utilities/Managers/INIManager.cs
+++ b/.Source/GTweak/Modules/Managers/INIManager.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal sealed class INIManager
{
diff --git a/.Source/GTweak/Utilities/Managers/NotificationManager.cs b/.Source/GTweak/Modules/Managers/NotificationManager.cs
similarity index 96%
rename from .Source/GTweak/Utilities/Managers/NotificationManager.cs
rename to .Source/GTweak/Modules/Managers/NotificationManager.cs
index c318c45d..ae45a37b 100644
--- a/.Source/GTweak/Utilities/Managers/NotificationManager.cs
+++ b/.Source/GTweak/Modules/Managers/NotificationManager.cs
@@ -4,11 +4,11 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Tweaks;
using GTweak.Windows;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal static class NotificationManager
{
@@ -86,7 +86,7 @@ namespace GTweak.Utilities.Managers
private async void ShowNotification(NoticeAction action)
{
- if (SettingsEngine.IsViewNotification && Interlocked.CompareExchange(ref _isNotificationOpen, 1, 0) == 0)
+ if (GlobalOptions.IsViewNotification && Interlocked.CompareExchange(ref _isNotificationOpen, 1, 0) == 0)
{
Dispatcher dispatcher = Application.Current?.Dispatcher;
if (dispatcher == null)
diff --git a/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs b/.Source/GTweak/Modules/Managers/OverlayDialogManager.cs
similarity index 95%
rename from .Source/GTweak/Utilities/Managers/OverlayDialogManager.cs
rename to .Source/GTweak/Modules/Managers/OverlayDialogManager.cs
index ca21b12d..244bf285 100644
--- a/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs
+++ b/.Source/GTweak/Modules/Managers/OverlayDialogManager.cs
@@ -1,9 +1,9 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using GTweak.Utilities.Animation;
+using GTweak.Animations;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal static class OverlayDialogManager
{
@@ -44,7 +44,7 @@ namespace GTweak.Utilities.Managers
_btnSecondary.Click += onSecondary;
_overlay.Visibility = Visibility.Visible;
- _overlay.BeginAnimation(UIElement.OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.3));
+ _overlay.BeginAnimation(UIElement.OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.3));
bool? result = await _tcs.Task;
diff --git a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Modules/Managers/TaskSchedulerManager.cs
similarity index 88%
rename from .Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs
rename to .Source/GTweak/Modules/Managers/TaskSchedulerManager.cs
index 292cf608..32365f4a 100644
--- a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs
+++ b/.Source/GTweak/Modules/Managers/TaskSchedulerManager.cs
@@ -4,11 +4,11 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Storage;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Storage;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal class TaskSchedulerManager : TaskStorage
{
@@ -28,7 +28,7 @@ namespace GTweak.Utilities.Managers
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
return false;
}
@@ -86,13 +86,13 @@ namespace GTweak.Utilities.Managers
internal static string GetTaskFullPath(string partialName)
{
- string[] files = Directory.GetFiles(PathLocator.Folders.Tasks, "*", SearchOption.AllDirectories);
+ string[] files = Directory.GetFiles(PathTargets.Folders.Tasks, "*", SearchOption.AllDirectories);
List<string> matches = files.Where(path => Path.GetFileName(path).StartsWith(partialName, StringComparison.OrdinalIgnoreCase)).ToList();
if (matches.Count != 0)
{
- string relativePath = matches[0].Substring(PathLocator.Folders.Tasks.Length).Replace(Path.DirectorySeparatorChar, '\\');
+ string relativePath = matches[0].Substring(PathTargets.Folders.Tasks.Length).Replace(Path.DirectorySeparatorChar, '\\');
relativePath = Regex.Replace(relativePath, @"^\\+", "");
return $@"\{relativePath}";
@@ -107,7 +107,7 @@ namespace GTweak.Utilities.Managers
foreach (var basePath in basePaths)
{
- string fullBasePath = Path.Combine(PathLocator.Folders.Tasks, basePath.TrimStart('\\'));
+ string fullBasePath = Path.Combine(PathTargets.Folders.Tasks, basePath.TrimStart('\\'));
if (Directory.Exists(fullBasePath))
{
@@ -115,7 +115,7 @@ namespace GTweak.Utilities.Managers
foreach (string file in files)
{
- string relativePath = file.Substring(PathLocator.Folders.Tasks.Length).Replace(Path.DirectorySeparatorChar, '\\');
+ string relativePath = file.Substring(PathTargets.Folders.Tasks.Length).Replace(Path.DirectorySeparatorChar, '\\');
relativePath = Regex.Replace(relativePath, @"^\\+", "");
taskList.Add(@"\" + relativePath);
}
@@ -131,7 +131,7 @@ namespace GTweak.Utilities.Managers
foreach (string path in tasklist)
{
- if (File.Exists(Path.Combine(PathLocator.Folders.Tasks, path.TrimStart('\\', '/').Replace('/', '\\'))))
+ if (File.Exists(Path.Combine(PathTargets.Folders.Tasks, path.TrimStart('\\', '/').Replace('/', '\\'))))
{
foundExisting.Add(path);
}
diff --git a/.Source/GTweak/Utilities/Managers/TimerControlManager.cs b/.Source/GTweak/Modules/Managers/TimerControlManager.cs
similarity index 97%
rename from .Source/GTweak/Utilities/Managers/TimerControlManager.cs
rename to .Source/GTweak/Modules/Managers/TimerControlManager.cs
index 5b3f3bd0..9be667a9 100644
--- a/.Source/GTweak/Utilities/Managers/TimerControlManager.cs
+++ b/.Source/GTweak/Modules/Managers/TimerControlManager.cs
@@ -2,7 +2,7 @@ using System;
using System.Windows;
using System.Windows.Threading;
-namespace GTweak.Utilities.Managers
+namespace GTweak.Modules.Managers
{
internal sealed class TimerControlManager
{
diff --git a/.Source/GTweak/Utilities/Storage/TaskStorage.cs b/.Source/GTweak/Modules/Storage/TaskStorage.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Storage/TaskStorage.cs
rename to .Source/GTweak/Modules/Storage/TaskStorage.cs
index 166cbff1..1516c364 100644
--- a/.Source/GTweak/Utilities/Storage/TaskStorage.cs
+++ b/.Source/GTweak/Modules/Storage/TaskStorage.cs
@@ -1,7 +1,7 @@
using System.Linq;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Managers;
-namespace GTweak.Utilities.Storage
+namespace GTweak.Modules.Storage
{
internal class TaskStorage
{
diff --git a/.Source/GTweak/Utilities/Storage/WinKeyStorage.cs b/.Source/GTweak/Modules/Storage/WinKeyStorage.cs
similarity index 99%
rename from .Source/GTweak/Utilities/Storage/WinKeyStorage.cs
rename to .Source/GTweak/Modules/Storage/WinKeyStorage.cs
index 8d1f42f9..ce5b4c43 100644
--- a/.Source/GTweak/Utilities/Storage/WinKeyStorage.cs
+++ b/.Source/GTweak/Modules/Storage/WinKeyStorage.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace GTweak.Utilities.Storage
+namespace GTweak.Modules.Storage
{
internal class WinKeyStorage
{
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Modules/Tweaks/AppxPackageHandler.cs
similarity index 70%
rename from .Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
rename to .Source/GTweak/Modules/Tweaks/AppxPackageHandler.cs
index fbdba289..1ce66a8f 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
+++ b/.Source/GTweak/Modules/Tweaks/AppxPackageHandler.cs
@@ -6,14 +6,14 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
using Microsoft.Win32;
-namespace GTweak.Utilities.Tweaks
+namespace GTweak.Modules.Tweaks
{
- internal sealed class UninstallingPakages : TaskSchedulerManager
+ internal sealed class AppxPackageHandler : TaskSchedulerManager
{
private static bool _isLocalAccount = false;
@@ -33,10 +33,10 @@ namespace GTweak.Utilities.Tweaks
}
}
- internal static bool IsOneDriveInstalled => PathLocator.Executable.OneDrive.Any(File.Exists) || (Directory.Exists(PathLocator.Folders.OneDrive) &&
- Directory.EnumerateDirectories(PathLocator.Folders.OneDrive).Any(dir => File.Exists(Path.Combine(dir, "OneDrive.exe"))));
+ internal static bool IsOneDriveInstalled => PathTargets.Executable.OneDrive.Any(File.Exists) || (Directory.Exists(PathTargets.Folders.OneDrive) &&
+ Directory.EnumerateDirectories(PathTargets.Folders.OneDrive).Any(dir => File.Exists(Path.Combine(dir, "OneDrive.exe"))));
- internal static bool IsEdgeInstalled => Directory.Exists(PathLocator.Folders.Edge);
+ internal static bool IsEdgeInstalled => Directory.Exists(PathTargets.Folders.Edge);
internal static readonly Dictionary<string, PackagesInfo> PackagesDetails = new Dictionary<string, PackagesInfo>(StringComparer.OrdinalIgnoreCase)
{
@@ -119,10 +119,10 @@ namespace GTweak.Utilities.Tweaks
internal void GetInstalledPackages()
{
- try { InstalledPackagesCache = RegistryHelp.GetSubKeyNames<HashSet<string>>(Registry.CurrentUser, @"Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages") ?? new HashSet<string>(); }
+ try { InstalledPackagesCache = RegistryHelper.GetSubKeyNames<HashSet<string>>(Registry.CurrentUser, @"Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages") ?? new HashSet<string>(); }
catch (Exception ex)
{
- ErrorLogging.LogDebug(ex);
+ ErrorLogger.LogDebug(ex);
InstalledPackagesCache = new HashSet<string>();
}
finally { OnPackagesChanged(); }
@@ -156,27 +156,27 @@ namespace GTweak.Utilities.Tweaks
internal static async Task RestoreOneDriveFolder()
{
- await CommandExecutor.InvokeRunCommand($@"/c {PathLocator.Executable.OneDriveSetup}").ConfigureAwait(false);
+ await CommandExecutor.InvokeRunCommand($@"/c {PathTargets.Executable.OneDriveSetup}").ConfigureAwait(false);
SetTaskState(true, oneDriveTask);
- RegistryHelp.CreateFolder(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
- RegistryHelp.CreateFolder(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
+ RegistryHelper.CreateFolder(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
+ RegistryHelper.CreateFolder(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
}
internal static async Task RemoveAppxPackage(string packageName, bool shouldRemoveWebView = false)
{
if (packageName == "OneDrive")
{
- await CommandExecutor.InvokeRunCommand($@"/c taskkill /f /im OneDrive.exe & {PathLocator.Executable.OneDriveSetup} /uninstall").ConfigureAwait(false);
+ await CommandExecutor.InvokeRunCommand($@"/c taskkill /f /im OneDrive.exe & {PathTargets.Executable.OneDriveSetup} /uninstall").ConfigureAwait(false);
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}");
SetTaskState(false, oneDriveTask);
CommandExecutor.RunCommand($@"/c rd /s /q %userprofile%\AppData\Local\Microsoft\OneDrive & rd /s /q %userprofile%\AppData\Local\OneDrive &
- rd /s /q ""%allusersprofile%\Microsoft OneDrive"" & rd /s /q {PathLocator.Folders.SystemDrive}OneDriveTemp{(_isLocalAccount ? @" & rd /s /q %userprofile%\OneDrive" : "")}");
+ rd /s /q ""%allusersprofile%\Microsoft OneDrive"" & rd /s /q {PathTargets.Folders.SystemDrive}OneDriveTemp{(_isLocalAccount ? @" & rd /s /q %userprofile%\OneDrive" : "")}");
return;
}
@@ -185,7 +185,7 @@ namespace GTweak.Utilities.Tweaks
{
if (!PackagesDetails.TryGetValue(packageName, out PackagesInfo details))
{
- ErrorLogging.LogDebug(new InvalidOperationException($"PackageDetails does not contain key '{packageName}'"));
+ ErrorLogger.LogDebug(new InvalidOperationException($"PackageDetails does not contain key '{packageName}'"));
return;
}
@@ -210,46 +210,46 @@ namespace GTweak.Utilities.Tweaks
await CommandExecutor.InvokeRunCommand(psCommands, true).ConfigureAwait(false);
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c for /d %i in ({string.Join(" ", packageNamesToRemove.Select(n => $@"""{Path.Combine(PathLocator.Folders.SystemDrive, "Program Files", "WindowsApps")}\*{n}*"""))}) do takeown /f ""%i"" /r /d y && icacls ""%i"" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18 && icacls ""%i"" /grant {Environment.UserName}:F && rd /s /q ""%i""");
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c for /d %i in ({string.Join(" ", packageNamesToRemove.Select(n => $@"""{Path.Combine(PathTargets.Folders.SystemDrive, "Program Files", "WindowsApps")}\*{n}*"""))}) do takeown /f ""%i"" /r /d y && icacls ""%i"" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18 && icacls ""%i"" /grant {Environment.UserName}:F && rd /s /q ""%i""");
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
switch (packageName)
{
case "Widgets":
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
break;
case "DevHome":
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate");
break;
case "Outlook":
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate");
break;
case "Cortana":
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Speech_OneCore\Preferences", "ModelDownloadAllowed", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCloudSearch", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortana", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowSearchToUseLocation", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "ConnectedSearchUseWeb", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "DisableWebSearch", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization", "RestrictImplicitInkCollection", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization", "RestrictImplicitTextCollection", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization\TrainedDataStore", "HarvestContacts", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Personalization\Settings", "AcceptedPrivacyPolicy", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Windows Search", "CortanaConsent", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Speech_OneCore\Preferences", "ModelDownloadAllowed", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCloudSearch", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortana", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowSearchToUseLocation", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "ConnectedSearchUseWeb", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "DisableWebSearch", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization", "RestrictImplicitInkCollection", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization", "RestrictImplicitTextCollection", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\InputPersonalization\TrainedDataStore", "HarvestContacts", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Personalization\Settings", "AcceptedPrivacyPolicy", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Windows Search", "CortanaConsent", 0, RegistryValueKind.DWord);
break;
case "Phone":
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\CrossDeviceUpdate");
- if (RegistryHelp.KeyExists(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\ModernSharing", true))
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\CrossDeviceUpdate");
+ if (RegistryHelper.KeyExists(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\ModernSharing", true))
{
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\SendTo");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\ModernShare");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\SendTo");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\ModernShare");
}
else
{
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"AllFilesystemObjects\shellex\ContextMenuHandlers\ModernSharing");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"AllFilesystemObjects\shellex\ContextMenuHandlers\ModernSharing");
}
CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg delete ""HKEY_CLASSES_ROOT\CLSID\{{7AD84985-87B4-4a16-BE58-8B72A5B390F7}}"" /f & reg delete ""HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{{7AD84985-87B4-4a16-BE58-8B72A5B390F7}}"" /f");
break;
@@ -271,20 +271,20 @@ namespace GTweak.Utilities.Tweaks
{
if (shellKey.GetSubKeyNames().Any(k => k.Equals("3D Print", StringComparison.OrdinalIgnoreCase)))
{
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\3D Print");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\3D Print");
}
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
baseKey.Close();
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
break;
case "Edge":
- string setupPathEdge = Directory.EnumerateFiles(Path.Combine(PathLocator.Folders.Edge, "Application"), "setup.exe", SearchOption.AllDirectories).FirstOrDefault() ?? string.Empty;
+ string setupPathEdge = Directory.EnumerateFiles(Path.Combine(PathTargets.Folders.Edge, "Application"), "setup.exe", SearchOption.AllDirectories).FirstOrDefault() ?? string.Empty;
string tempPathEdge = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "SystemApps", "Microsoft.MicrosoftEdge_8wekyb3d8bbwe", "MicrosoftEdge.exe");
string[] processes = { "msedge", "edge", "edgeupdate", "edgeupdatem", "msedgewebview2", "microsoftedgeupdate", "msedgewebviewhost", "msedgeuserbroker", "usocoreworker", "widgets", "microsoftedgesh", "microsoftedgecp", "microsoftedge" };
@@ -295,7 +295,7 @@ namespace GTweak.Utilities.Tweaks
Directory.CreateDirectory(Path.GetDirectoryName(tempPathEdge));
File.WriteAllBytes(tempPathEdge, Array.Empty<byte>());
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
if (!string.IsNullOrEmpty(setupPathEdge))
{
@@ -315,7 +315,7 @@ namespace GTweak.Utilities.Tweaks
process.Start();
process.WaitForExit();
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
try
@@ -325,31 +325,31 @@ namespace GTweak.Utilities.Tweaks
Directory.Delete(Path.GetDirectoryName(tempPathEdge), true);
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
if (shouldRemoveWebView)
{
RemoveTasks(edgeTasks);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdatem", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MicrosoftEdgeElevationService", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Edge", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\EdgeWebView", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\EdgeWebView", true);
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\EdgeUpdate", true);
- RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\EdgeWebView", true);
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"AppID\MicrosoftEdgeUpdate.exe", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects", true);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdatem", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MicrosoftEdgeElevationService", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Edge", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\EdgeWebView", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\EdgeWebView", true);
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\EdgeUpdate", true);
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\EdgeWebView", true);
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"AppID\MicrosoftEdgeUpdate.exe", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects", true);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", true);
foreach (string folder in new[] { "Edge", "EdgeCore", "EdgeUpdate", "Temp", "EdgeWebView" })
{
- string dir = Path.Combine(Directory.GetParent(PathLocator.Folders.Edge).FullName, folder);
+ string dir = Path.Combine(Directory.GetParent(PathTargets.Folders.Edge).FullName, folder);
UnlockHandleHelper.UnlockDirectory(dir);
RemoveDirectory(dir);
}
@@ -382,7 +382,7 @@ namespace GTweak.Utilities.Tweaks
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
break;
default:
break;
@@ -396,7 +396,7 @@ namespace GTweak.Utilities.Tweaks
for (int i = 0; Directory.Exists(path) && i < 10; i++)
{
try { Directory.Delete(path, true); Thread.Sleep(300); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
CommandExecutor.RunCommand($"Remove-Item -LiteralPath '{path}' -Recurse -Force", true);
}
diff --git a/.Source/GTweak/Modules/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Modules/Tweaks/ConfidentialityTweaks.cs
new file mode 100644
index 00000000..b0a4ec5b
--- /dev/null
+++ b/.Source/GTweak/Modules/Tweaks/ConfidentialityTweaks.cs
@@ -0,0 +1,605 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Properties;
+using Microsoft.Win32;
+
+namespace GTweak.Modules.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;
+
+ public ConfidentialityTweaks()
+ {
+ _tglTweaks = new Dictionary<ConfidentialityToggle, (Func<bool> Check, Action<bool> Apply)>
+ {
+ [ConfidentialityToggle.TargetedAdvertising] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", "0");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Bluetooth", "AllowAdvertising", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.DataSynchronization] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", "0");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility", "Enabled", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.WindowsTelemetry] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", "1") || IsTaskEnabled(telemetryTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation");
+ }
+ else
+ {
+ RegistryHelper.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: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", "1") || IsTaskEnabled(appExpInventoryTasks),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", 1, RegistryValueKind.DWord);
+ }
+
+ SetTaskStateOwner(state, appExpInventoryTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.AppUsageStatistics] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0") || IsTaskEnabled(appExpUsageTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "AITEnable", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskStateOwner(state, appExpUsageTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.HandwritingData] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC", "Enabled", "0");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Input\TIPC", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.HardwareConfigurationData] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", "0") || IsTaskEnabled(ceipTasks),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, ceipTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.HiddenMicrosoftDomains] = (
+ Check: () => IsDefaultHosts(),
+ Apply: (state) =>
+ {
+ BlockSpyDomain(state);
+
+ Task.Run(delegate
+ {
+ try
+ {
+ if (state)
+ {
+ File.Copy(PathTargets.Files.Hosts.Backup, PathTargets.Files.Hosts.Original, true);
+
+ if (File.Exists(PathTargets.Files.Hosts.Backup))
+ {
+ File.Delete(PathTargets.Files.Hosts.Backup);
+ }
+ else
+ {
+ File.WriteAllText(PathTargets.Files.Hosts.Original, string.Empty);
+ }
+ }
+ else
+ {
+ File.Copy(PathTargets.Files.Hosts.Original, PathTargets.Files.Hosts.Backup, true);
+
+ string existingText = File.Exists(PathTargets.Files.Hosts.Original) ? File.ReadAllText(PathTargets.Files.Hosts.Original) : string.Empty;
+
+ HashSet<string> existingEntries = new HashSet<string>(existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()), StringComparer.OrdinalIgnoreCase);
+
+ 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))
+ {
+ blocklist.AppendLine(trimmedLine);
+ }
+ }
+
+ if (blocklist.Length > 0)
+ {
+ FileInfo fileInfo = new FileInfo(PathTargets.Files.Hosts.Original);
+
+ 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(PathTargets.Files.Hosts.Original, $"{prefix}{blocklist.ToString().TrimEnd()}");
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ });
+ }
+ ),
+
+ [ConfidentialityToggle.UserLocationTracking] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", "1");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocation", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableLocationScripting", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors", "DisableWindowsLocationProvider", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.FeedbackRequests] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", "1") || IsTaskEnabled(feedbackTasks);
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "NumberOfSIUFInPeriod", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "DoNotShowFeedbackNotifications", 1, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, feedbackTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.SpeechSynthesisUpdates] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", "0") || IsTaskEnabled(speechTasks),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", 0, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, speechTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.HiddenSystemMonitoring] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ConfidentialityToggle.SystemExperiments] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", "0"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.CovertDataCollectionServices] = (
+ Check: () =>
+ {
+ return RegistryHelper.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DiagTrack") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dmwappushservice") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagsvc");
+ },
+ Apply: (state) =>
+ {
+ (string diagTrack, string dmwappushservice, string diagsvc) =
+ (
+ @"SYSTEM\CurrentControlSet\Services\DiagTrack",
+ @"SYSTEM\CurrentControlSet\Services\dmwappushservice",
+ @"SYSTEM\CurrentControlSet\Services\diagsvc"
+ );
+
+ if (state)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "Description", @"@%SystemRoot%\system32\diagtrack.dll,-3002", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "DisplayName", @"@%SystemRoot%\system32\diagtrack.dll,-3001", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k utcsvc -p", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "RequiredPrivileges", new[] { "SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege", "SeAssignPrimaryTokenPrivilege", "SeImpersonatePrivilege", "SeSystemProfilePrivilege", "SeTcbPrivilege", "SeDebugPrivilege", "SeSecurityPrivilege" }, RegistryValueKind.MultiString);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "Start", 2, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, diagTrack, "Type", 16, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDll", @"%SystemRoot%\system32\diagtrack.dll", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagTrack}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "DelayedAutoStart", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "DependOnService", new[] { "rpcss" }, RegistryValueKind.MultiString);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "Description", @"@%SystemRoot%\system32\dmwappushsvc.dll,-201", RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "DisplayName", @"@%SystemRoot%\system32\dmwappushsvc.dll,-200", RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "ImagePath", @"%SystemRoot%\system32\svchost.exe -k netsvcs -p", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "Start", 3, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "Type", 20, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, dmwappushservice, "StateFlags", 3, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "IdleTimeout(sec)", 120, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDll", @"%SystemRoot%\system32\dmwappushsvc.dll", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "DataType0", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{dmwappushservice}\TriggerInfo\1", "Type", 7, RegistryValueKind.DWord);
+ RegistryHelper.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);
+
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "DependOnService", new[] { "RpcSs" }, RegistryValueKind.MultiString);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "Description", @"@%systemroot%\system32\DiagSvc.dll,-101", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "DisplayName", @"@%systemroot%\system32\DiagSvc.dll,-100", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "ErrorControl", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "ImagePath", @"%SystemRoot%\System32\svchost.exe -k diagnostics", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "ObjectName", "LocalSystem", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "RequiredPrivileges", new[] { "SeTcbPrivilege", "nSeTakeOwnershipPrivilege", "nSeDebugPrivilege", "nSeBackupPrivilege", "nSeImpersonatePrivilege", "nSeLoadDriverPrivilege", "nSeRestorePrivilege", "nSeManageVolumePrivilege" }, RegistryValueKind.MultiString);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "ServiceSidType", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "Start", 3, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, diagsvc, "Type", 32, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDll", @"%systemroot%\system32\DiagSvc.dll", RegistryValueKind.ExpandString);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceDllUnloadOnStop", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\Parameters", "ServiceMain", "ServiceMain", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Action", 1, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "DataType0", 2, RegistryValueKind.DWord);
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.LocalMachine, $@"{diagsvc}\TriggerInfo\0", "Type", 6, RegistryValueKind.DWord);
+ }
+ else
+ {
+ foreach (string path in new[] { diagTrack, dmwappushservice, diagsvc })
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, path);
+ }
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.WindowsEventLogging] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", "4"),
+ Apply: (state) =>
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service /t REG_DWORD /v Start /d {(state ? "3" : "4")} /f");
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ }
+ ),
+
+
+ [ConfidentialityToggle.NvidiaTelemetry] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", "4") || IsTaskEnabled(nvidiaTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\NvTelemetryContainer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ SetTaskState(state, nvidiaTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.UserBehaviorRecording] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", "1");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableUAR", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Personalization", "NoLockScreenCamera", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ConfidentialityToggle.OfflineMapsUpdates] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "MapUpdate", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\Maps", "AutoUpdateEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", "0") || IsTaskEnabled(mapsTasks);
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\Maps", "AutoUpdateEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Maps", "AutoDownloadAndUpdateMapData", 0, RegistryValueKind.DWord);
+ }
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\Maps", "MapUpdate", state ? 1 : 0, RegistryValueKind.DWord);
+
+ SetTaskState(state, mapsTasks);
+ }
+ ),
+
+ [ConfidentialityToggle.IntelTelemetry] = (
+ Check: () =>
+ {
+ return (RegistryHelper.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start") &&
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start", "4")) || IsTaskEnabled(intelTask);
+ },
+ Apply: (state) =>
+ {
+ if (RegistryHelper.ValueExists(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Telemetry", "Start"))
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Telemetry", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ }
+
+ SetTaskState(state, intelTask);
+ }
+ ),
+ };
+ }
+
+ 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"))
+ {
+ resourceEntries.Add(trimmed);
+ }
+ }
+
+ if (resourceEntries.Count == 0)
+ {
+ return true;
+ }
+
+ HashSet<string> fileEntries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
+ foreach (string line in File.ReadLines(PathTargets.Files.Hosts.Original))
+ {
+ string trimmed = line.Trim();
+ if (trimmed.StartsWith("0.0.0.0"))
+ {
+ fileEntries.Add(trimmed);
+ }
+ }
+
+ return !resourceEntries.IsSubsetOf(fileEntries);
+ }
+ catch { return true; }
+ }
+ }
+}
diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/AclPermissionsBackup.cs b/.Source/GTweak/Modules/Tweaks/Defender/AclPermissionsBackup.cs
similarity index 94%
rename from .Source/GTweak/Utilities/Tweaks/DefenderManager/AclPermissionsBackup.cs
rename to .Source/GTweak/Modules/Tweaks/Defender/AclPermissionsBackup.cs
index becd2cac..ac0699d6 100644
--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/AclPermissionsBackup.cs
+++ b/.Source/GTweak/Modules/Tweaks/Defender/AclPermissionsBackup.cs
@@ -2,13 +2,13 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Security.AccessControl;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Managers;
using Microsoft.Win32;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-namespace GTweak.Utilities.Tweaks.DefenderManager
+namespace GTweak.Modules.Tweaks.Defender
{
internal class AclPermissionsBackup : TaskSchedulerManager
{
@@ -97,7 +97,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
{
try
{
- Directory.CreateDirectory(PathLocator.Folders.DefenderBackup);
+ Directory.CreateDirectory(PathTargets.Folders.DefenderBackup);
Dictionary<string, Dictionary<string, RegistryValueBackup>> allValues = new Dictionary<string, Dictionary<string, RegistryValueBackup>>(StringComparer.OrdinalIgnoreCase);
Dictionary<string, string> aclDataDict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -126,7 +126,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
continue;
}
- var values = new Dictionary<string, RegistryValueBackup>(StringComparer.Ordinal);
+ Dictionary<string, RegistryValueBackup> values = new Dictionary<string, RegistryValueBackup>(StringComparer.Ordinal);
foreach (string valueName in key.GetValueNames())
{
@@ -152,7 +152,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
};
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
allValues[keyId] = values;
@@ -163,26 +163,26 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
string aclData = security.GetSecurityDescriptorSddlForm(AccessControlSections.All);
aclDataDict[keyId] = aclData;
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
- File.WriteAllText(PathLocator.Files.BackupJsonWD, JsonConvert.SerializeObject(allValues, Formatting.Indented));
- File.WriteAllText(PathLocator.Files.BackupAclWD, JsonConvert.SerializeObject(aclDataDict, Formatting.Indented));
+ File.WriteAllText(PathTargets.Files.BackupJsonWD, JsonConvert.SerializeObject(allValues, Formatting.Indented));
+ File.WriteAllText(PathTargets.Files.BackupAclWD, JsonConvert.SerializeObject(aclDataDict, Formatting.Indented));
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
internal static void ImportRights()
{
- if (File.Exists(PathLocator.Files.BackupJsonWD) && File.Exists(PathLocator.Files.BackupAclWD))
+ if (File.Exists(PathTargets.Files.BackupJsonWD) && File.Exists(PathTargets.Files.BackupAclWD))
{
try
{
- Dictionary<string, Dictionary<string, RegistryValueBackup>> allValues = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, RegistryValueBackup>>>(File.ReadAllText(PathLocator.Files.BackupJsonWD));
- Dictionary<string, string> aclDataDict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(PathLocator.Files.BackupAclWD));
+ Dictionary<string, Dictionary<string, RegistryValueBackup>> allValues = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, RegistryValueBackup>>>(File.ReadAllText(PathTargets.Files.BackupJsonWD));
+ Dictionary<string, string> aclDataDict = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(PathTargets.Files.BackupAclWD));
if (allValues == null)
{
@@ -236,7 +236,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
{
key.SetValue(valueName, ConvertJTokenToObject(backup.Value));
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
continue;
}
@@ -246,7 +246,7 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
object valueToSet = ConvertBackupValueToClr(backup.Value, kind);
key.SetValue(valueName, valueToSet, kind);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
if (aclDataDict != null && aclDataDict.TryGetValue(keyId, out string sddl) && !string.IsNullOrWhiteSpace(sddl))
@@ -258,13 +258,13 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
key.SetAccessControl(security);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
}
diff --git a/.Source/GTweak/Modules/Tweaks/Defender/DefenderTweaks.cs b/.Source/GTweak/Modules/Tweaks/Defender/DefenderTweaks.cs
new file mode 100644
index 00000000..136c337c
--- /dev/null
+++ b/.Source/GTweak/Modules/Tweaks/Defender/DefenderTweaks.cs
@@ -0,0 +1,491 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using Microsoft.Win32;
+
+namespace GTweak.Modules.Tweaks.Defender
+{
+ internal class DefenderTweaks : AclPermissionsBackup
+ {
+ const string ServiceName = "GTweakWDManager";
+
+ private static readonly Dictionary<string, string> services = new Dictionary<string, string>
+ {
+ { "WinDefend", "2" },
+ { "SecurityHealthService", "2"},
+ { "Sense", "3" },
+ { "SgrmAgent", "3" },
+ { "SgrmBroker", "3" },
+ { "MDCoreSvc", "3" },
+ { "MsSecCore", "3" },
+ { "MsSecFlt", "3" },
+ { "MsSecWfp", "3" },
+ { "WdFilter", "0" },
+ { "WdBoot", "0" },
+ { "WdNisDrv", "3" },
+ { "WdNisSvc", "3"},
+ { "webthreatdefsvc", "3" },
+ { "webthreatdefusersvc", "2" },
+ { "wscsvc", "2" }
+ };
+
+ internal static void SetProtectionState(bool state) => (state ? (Action)Activate : Deactivate)();
+
+ private static void Activate()
+ {
+ TerminateProcess();
+
+ InvokePowerShell(@"Set-MpPreference -DisableIOAVProtection $false
+ Set-MpPreference -DisableRealtimeMonitoring $false
+ Set-MpPreference -DisableBehaviorMonitoring $false
+ Set-MpPreference -DisableBlockAtFirstSeen $false
+ Set-MpPreference -DisablePrivacyMode $false
+ Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $false
+ Set-MpPreference -DisableArchiveScanning $false
+ Set-MpPreference -DisableIntrusionPreventionSystem $false
+ Set-MpPreference -DisableScriptScanning $false
+ Set-MpPreference -SubmitSamplesConsent 1
+ Set-MpPreference -MAPSReporting 2
+ Set-MpPreference -PUAProtection Enabled");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableOnAccessProtection /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideRealtimeScanDirection /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIOAVProtection /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableBehaviorMonitoring /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIntrusionPreventionSystem /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableRealtimeMonitoring /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBehaviorMonitoring /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIOAVProtection /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableOnAccessProtection /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRealtimeMonitoring /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRoutinelyTakingAction /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScanOnRealtimeEnable /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScriptScanning /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRawWriteNotification /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIntrusionPreventionSystem /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableInformationProtectionControl /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v RealtimeScanDirection /t REG_DWORD /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableArchiveScanning /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v SignatureDisableUpdateOnStartupWithoutEngine /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisablePrivacyMode /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBlockAtFirstSeen /f");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ @"reg delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter"" /v EnabledV9 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender"" /v PUAProtection /t REG_DWORD /d 2 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtection /t REG_DWORD /d 1 /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontOfferThroughWUA /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontReportInfectionInformation /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v ConfigureAppInstallControl /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v DontReportInfectionInformation /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceConfidence/Analytic"" /v Enabled /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Operational"" /v Enabled /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Verbose"" /v Enabled /t REG_DWORD /d 1 /f");
+
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\System", "EnableSmartScreen");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirstRunDisabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "AntiVirusOverride");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirewallOverride");
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender", "PUAProtection", 2, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PrivateProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "EnabledV9");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "PreventOverride");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger", "Start", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", "Start", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational", "Enabled", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Security-Diagnostic/Operational", "Enabled", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "DisableBlockAtFirstSeen");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "CaptureBetaFeatures");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Policy", "VerifiedAndReputablePolicyState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "EnabledV9", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"System\CurrentControlSet\Control\CI\State", "HVCIEnabled", 1, RegistryValueKind.DWord);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity", "Enabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard", "EnableVirtualizationBasedSecurity");
+
+
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "EnableWebContentEvaluation");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "PreventOverride");
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SecurityHealth", @"%windir%\system32\SecurityHealthSystray.exe", RegistryValueKind.ExpandString);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "SecurityHealth", new byte[] { 0002, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }, RegistryValueKind.Binary);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender", "\"%ProgramFiles%\\Windows Defender\\MSASCui.exe\"-runkey", RegistryValueKind.String);
+
+ RegistryHelper.Write(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "", PathTargets.Folders.SystemDrive + @"Program Files\Windows Defender\shellext.dll", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "ThreadingModel", "Apartment", RegistryValueKind.String);
+
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\ASR", "EnableASRConsumers");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Controlled Folder Access", "EnableControlledFolderAccess");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Windows Defender Exploit Guard\Network Protection", "EnableNetworkProtection");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide cmd /c " +
+ @"reg delete HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /f & " +
+ @"reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /t REG_SZ /d 328010 /f & " +
+ $"for /d %D in (\"{Path.Combine(PathTargets.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\BlockAntimalware.exe\" ren \"%D\\BlockAntimalware.exe\" MsMpEng.exe & " +
+ $"for /d %D in (\"{Path.Combine(PathTargets.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\BlockAntimalwareCore.exe\" ren \"%D\\BlockAntimalwareCore.exe\" MpDefenderCoreService.exe & " +
+ @"reg delete ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v DisableBlockAtFirstSeen /f & " +
+ @"reg delete ""HKLM\SOFTWARE\Microsoft\Windows Defender\Windows Defender\ControlledFolderAccess"" /v Enable /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreService1DSTelemetry /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreServiceECSIntegration /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v MdDisableResController /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SpynetReporting /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SubmitSamplesConsent /t REG_DWORD /d 0 /f & " +
+ @"reg delete ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v LocalSettingOverrideSpynetReporting /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiSpyware /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiVirus /t REG_DWORD /d 0 /f");
+
+ ManageExclusions(false);
+ SetTaskState(true, winDefenderTasks);
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c {CommandExecutor.CleanCommand(string.Join(" & ", services.Select(kv => $@"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{kv.Key}"" /v Start /t REG_DWORD /d {kv.Value} /f")))}""");
+
+ foreach ((string Normal, string Block) in PathTargets.Targets.Defender.Mappings)
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ $@"(if exist ""{Normal}"" (takeown /f ""{Normal}"" /a && del /f /q /a ""{Normal}"") else (cd .))",
+ $@"takeown /f ""{Block}"" /a",
+ $@"rename ""{Block}"" ""{Path.GetFileName(Normal)}""",
+ $@"icacls ""{Normal}"" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",
+ $@"icacls ""{Normal}"" /inheritance:r",
+ $@"icacls ""{Normal}"" /grant *S-1-5-32-544:F",
+ $@"icacls ""{Normal}"" /grant *S-1-5-32-545:R",
+ $@"icacls ""{Normal}"" /grant *S-1-5-18:F",
+ $@"icacls ""{Normal}"" /grant *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464:F",
+ $@"icacls ""{Normal}"" /grant *S-1-15-2-1:R",
+ $@"icacls ""{Normal}"" /grant *S-1-15-2-2:R",
+ $@"icacls ""{Normal}"" /remove ""{Environment.UserName}"""}))}""");
+ }
+
+ ImportRights();
+
+ InvokePowerShell("Get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage");
+ InvokePowerShell(@"Get-AppXpackage Microsoft.WindowsDefender | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register ""$($_.InstallLocation)\AppXManifest.xml""}");
+ }
+
+ private static void Deactivate()
+ {
+ ExportRights();
+
+ TerminateProcess();
+
+ foreach (var (Normal, Block) in PathTargets.Targets.Defender.Mappings)
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
+ $@"takeown /f ""{Normal}"" /a",
+ $@"icacls ""{Normal}"" /inheritance:r",
+ $@"icacls ""{Normal}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18",
+ $@"icacls ""{Normal}"" /grant ""{Environment.UserName}"":F",
+ $@"(if exist ""{Block}"" (takeown /f ""{Block}"" /a && del /f /q /a ""{Block}"") else (cd .))",
+ $@"rename ""{Normal}"" ""{Path.GetFileName(Block)}"""
+ }))}""");
+ }
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c {CommandExecutor.CleanCommand(string.Join(" & ", services.Select(kv => $@"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{kv.Key}"" /v Start /t REG_DWORD /d 4 /f")))}""");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ $"for /d %D in (\"{Path.Combine(PathTargets.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\MsMpEng.exe\" ren \"%D\\MsMpEng.exe\" BlockAntimalware.exe & " +
+ $"for /d %D in (\"{Path.Combine(PathTargets.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\MpDefenderCoreService.exe\" ren \"%D\\MpDefenderCoreService.exe\" BlockAntimalwareCore.exe & " +
+ @"reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 3 /f & " +
+ @"reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtection /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtectionSource /t REG_DWORD /d 2 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Windows Defender\ControlledFolderAccess"" /v Enable /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreService1DSTelemetry /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreServiceECSIntegration /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v MdDisableResController /t REG_DWORD /d 1 /f & " +
+ @"reg delete ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"" /v SmartScreenEnabled /t REG_SZ /d off /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows\System"" /v EnableSmartScreen /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiSpyware /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiVirus /t REG_DWORD /d 1 /f");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\ASR", "EnableASRConsumers", 0, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Controlled Folder Access", "EnableControlledFolderAccess", 0, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Network Protection", "EnableNetworkProtection", 0, RegistryValueKind.DWord, true);
+
+ InvokePowerShell(@"Set-MpPreference -DisableIOAVProtection $true
+ Set-MpPreference -DisableRealtimeMonitoring $true
+ Set-MpPreference -DisableBehaviorMonitoring $true
+ Set-MpPreference -DisableBlockAtFirstSeen $true
+ Set-MpPreference -DisablePrivacyMode $true
+ Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $true
+ Set-MpPreference -DisableArchiveScanning $true
+ Set-MpPreference -DisableIntrusionPreventionSystem $true
+ Set-MpPreference -DisableScriptScanning $true
+ Set-MpPreference -SubmitSamplesConsent 2
+ Set-MpPreference -MAPSReporting 0
+ Set-MpPreference -PUAProtection Disabled");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableOnAccessProtection /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideRealtimeScanDirection /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIOAVProtection /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableBehaviorMonitoring /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIntrusionPreventionSystem /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableRealtimeMonitoring /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIOAVProtection /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRoutinelyTakingAction /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScriptScanning /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRawWriteNotification /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIntrusionPreventionSystem /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableInformationProtectionControl /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v RealtimeScanDirection /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableArchiveScanning /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v SignatureDisableUpdateOnStartupWithoutEngine /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisablePrivacyMode /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f");
+
+ SetTaskState(false, winDefenderTasks);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiVirus", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "ServiceKeepAlive", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastService", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "HideExclusionsFromLocalAdmins", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastServiceStartup", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "PUAProtection", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableLocalAdminMerge", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender", "PUAProtection", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Features", "DeviceControlEnabled", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpEnablePus", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpCloudBlockLevel", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "DisableGradualRelease", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpBafsExtendedTimeout", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "EnableFileHashComputation", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "LowCpuPriority", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableReparsePointScanning", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableHeuristics", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableEmailScanning", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableCatchupQuickScan", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableCatchupFullScan", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableScanningNetworkFiles", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableArchiveScanning", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableRestorePoint", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "ServiceKeepAlive", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "AllowFastServiceStartup", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableAntiSpyware", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableAntiVirus", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware\SpyNet", "SpyNetReporting", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware\SpyNet", "LocalSettingOverrideSpyNetReporting", 0, RegistryValueKind.DWord);
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SpynetReporting /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SubmitSamplesConsent /t REG_DWORD /d 2 /f & " +
+ @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v LocalSettingOverrideSpynetReporting /t REG_DWORD /d 0 /f");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PrivateProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableEnhancedNotifications", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection", "DisallowExploitProtectionOverride", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection", "UILockdown", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "SignatureDisableNotification", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "RealtimeSignatureDelivery", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "ForceUpdateFromMU", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableScheduledSignatureUpdateOnBattery", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "UpdateOnStartUp", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "SignatureUpdateCatchupInterval", 2, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableUpdateOnStartupWithoutEngine", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableScanOnUpdate", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "ScheduleTime", 5184, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "DisableEnhancedNotifications", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "DisableGenericRePorts", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "WppTracingLevel", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "WppTracingComponents", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirstRunDisabled", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "AntiVirusOverride", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirewallOverride", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration", "Notification_Suppress", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration", "SuppressRebootNotification", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration", "UILockdown", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Device performance and health", "UILockdown", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Family optionsObj", "UILockdown", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "DisableBlockAtFirstSeen", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "CaptureBetaFeatures", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger", "Start", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", "Start", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Security-Diagnostic/Operational", "Enabled", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Policy", "VerifiedAndReputablePolicyState", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "EnabledV9", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"System\CurrentControlSet\Control\CI\State", "HVCIEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity", "Enabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard", "EnableVirtualizationBasedSecurity", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS\Components", "ServiceEnabled", "0", RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter", "EnabledV9", "0", RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "EnableWebContentEvaluation", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "PreventOverride", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "EnabledV9", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "PreventOverride", 0, RegistryValueKind.DWord);
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "SecurityHealth", new byte[] { 0099, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, RegistryValueKind.Binary);
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SecurityHealth");
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
+ @"reg add ""HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter"" /v EnabledV9 /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender"" /v PUAProtection /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontOfferThroughWUA /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontReportInfectionInformation /t REG_DWORD /d 1 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v ConfigureAppInstallControl /t REG_SZ /d ""Anywhere"" /f & " +
+ @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v DontReportInfectionInformation /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceConfidence/Analytic"" /v Enabled /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Operational"" /v Enabled /t REG_DWORD /d 0 /f & " +
+ @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Verbose"" /v Enabled /t REG_DWORD /d 0 /f");
+
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP");
+ RegistryHelper.DeleteFolderTree(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32");
+
+ ManageExclusions(true);
+
+ foreach (string directory in PathTargets.Targets.Defender.CleanupFolders)
+ {
+ try
+ {
+ if (!Directory.Exists(directory))
+ {
+ continue;
+ }
+
+ foreach (string file in Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly))
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{$@"takeown /f ""{file}"" /a & icacls ""{file}"" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 & icacls ""{file}"" /grant ""{Environment.UserName}"":F & del /f /q ""{file}"""}""");
+
+ for (int i = 0; File.Exists(file) && i < 10; i++)
+ {
+ try { File.Delete(file); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""del /f /q ""{file}""""");
+ TakingOwnership.GrantAdministratorsAccess(file, TakingOwnership.SE_OBJECT_TYPE.SE_FILE_OBJECT);
+
+ Thread.Sleep(500);
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ }
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", 0, RegistryValueKind.DWord);
+
+ CommandExecutor.RunCommand($"/c sc create {ServiceName} binPath= \"{PathTargets.Executable.DisablingWD} /unlock\" type= own start= auto obj= LocalSystem");
+
+ RegistryHelper.Write(Registry.LocalMachine, $@"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{ServiceName}", "", "Service", RegistryValueKind.String);
+
+ ProcessStartInfo psi = new ProcessStartInfo
+ {
+ FileName = PathTargets.Executable.BcdEdit,
+ Arguments = "/set {current} safeboot minimal",
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
+ Process.Start(psi)?.WaitForExit();
+
+ CommandExecutor.RunCommand("/c shutdown /r /f /t 0");
+ }
+
+ private static void ManageExclusions(bool isDisable)
+ {
+ foreach (string drive in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Removable).Select(d => d.Name))
+ {
+ CommandExecutor.RunCommand($" {(isDisable ? "Add-MpPreference" : "Remove-MpPreference")} -ExclusionPath '{drive}'", true);
+ }
+ }
+
+ private static void TerminateProcess()
+ {
+ string[] processes = { "smartscreen", "mpdefendercoreservice", "msmpeng", "securityhealthservice", "securityhealthsystray", "securityhealthui", "wuauserv", "searchui", "sechealthui", "configsecuritypolicy", "runtimebroker", "msedge", "ssoncom", "usocoreworker", "defenderbootstrapper", "sensedlpprocessor", "sensetracer",
+ "dlpuseragent", "mpam-d", "mpam-fe", "mpam-fe_bd", "mpas-d", "mpas-fe", "mpas-fe_bd", "mpav-d", "mpav-fe", "mpav-fe_bd", "mpcmdrun", "mpcopyaccelerator", "mpdlpcmd", "mpdlpservice", "mpextms", "mpsigstub", "mrt", "msmpengcp", "mssense", "nissrv", "offlinescannershell", "securekernel", "usocoreworker", "securityhealthhost",
+ "senseap", "senseaptoast", "sensecm", "sensegpparser", "senseidentity", "senseimdscollector", "senseir", "sensendr", "sensesampleuploader", "sensetvm", "sgrmbroker", "healthattestationclientagent", "wdnissvc", "wdboot", "msseccore", "mssecflt", "mssecwfp", "mdcoresvc", "sensece", "senseui", "sensepp", "wdshield", "mipdlp" };
+ CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathTargets.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c taskkill /f " + string.Join(" ", processes.Select(p => $"/im {p}.exe")));
+ }
+
+ private static void InvokePowerShell(string command)
+ {
+ try
+ {
+ Process comandoAEjecutar = new Process();
+ comandoAEjecutar.StartInfo.FileName = PathTargets.Executable.PowerShell;
+ comandoAEjecutar.StartInfo.Arguments =
+ "-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand \"" +
+ Convert.ToBase64String(Encoding.Unicode.GetBytes(command)) + "\"";
+ comandoAEjecutar.StartInfo.UseShellExecute = false;
+ comandoAEjecutar.StartInfo.RedirectStandardOutput = true;
+ comandoAEjecutar.StartInfo.RedirectStandardError = true;
+ comandoAEjecutar.StartInfo.CreateNoWindow = true;
+ comandoAEjecutar.Start();
+ comandoAEjecutar.StandardOutput.ReadToEnd();
+ return;
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+
+ }
+ }
+}
+
diff --git a/.Source/GTweak/Modules/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Modules/Tweaks/InterfaceTweaks.cs
new file mode 100644
index 00000000..dd406d66
--- /dev/null
+++ b/.Source/GTweak/Modules/Tweaks/InterfaceTweaks.cs
@@ -0,0 +1,948 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using Microsoft.Win32;
+
+namespace GTweak.Modules.Tweaks
+{
+ internal enum InterfaceColor
+ {
+ CursorSelection = 1,
+ Tooltip
+ }
+
+ internal enum InterfaceCheckbox
+ {
+ ExplorerHome = 1,
+ ExplorerGallery,
+ ExplorerOneDrive,
+ HiddenFiles,
+ SystemFiles,
+ FileExtensions,
+ EmptyDrives,
+ IconComputer,
+ IconNetwork,
+ IconRecycleBin,
+ IconControlPanel,
+ IconUserFiles,
+ IconOneDrive,
+ FolderObjects3D,
+ FolderDesktop,
+ FolderDownloads,
+ FolderDocuments,
+ FolderPictures,
+ FolderMusic,
+ FolderVideo
+ }
+
+ 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,
+ 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;
+
+ public InterfaceTweaks()
+ {
+ _colorTweaks = new Dictionary<InterfaceColor, (Func<string> Check, Action<string> Apply)>
+ {
+ [InterfaceColor.CursorSelection] = (
+ Check: () => RegistryHelper.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "Hilight", "0 120 215"),
+ Apply: (value) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Colors", "Hilight", value, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Colors", "HotTrackingColor", value == "0 120 215" ? "0 102 204" : value, RegistryValueKind.String);
+ }
+ ),
+
+ [InterfaceColor.Tooltip] = (
+ Check: () => RegistryHelper.GetValue(@"HKEY_CURRENT_USER\Control Panel\Colors", "InfoWindow", "255 255 225"),
+ Apply: (value) =>
+ {
+ RegistryHelper.Write(Registry.Users, @".DEFAULT\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.Users, @"S-1-5-19\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.Users, @"S-1-5-20\Control Panel\Colors", "InfoWindow", value, RegistryValueKind.String);
+ }
+ )
+ };
+
+ _cbTweaks = new Dictionary<InterfaceCheckbox, (Func<bool> Check, Action<bool> Apply)>
+ {
+ [InterfaceCheckbox.ExplorerHome] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ ((HardwareData.OS.Build > 22621m && (RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}"))) ||
+ (HardwareData.OS.Build <= 22621m && (RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}")))) ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", "0") ||
+ RegistryHelper.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)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}");
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}", "System.IsPinnedToNameSpaceTree", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\ShellFolder", "Attributes", unchecked((int)0xB0940064), RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, $@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, $@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\{baseKey}\{{f874310e-b6b7-47dc-bc84-b9e6b38f5903}}", string.Empty, @"CLSID_MSGraphHomeFolder", RegistryValueKind.String);
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.ExplorerGallery] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", string.Empty, @"{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}", RegistryValueKind.String);
+ RegistryHelper.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 RegistryHelper.CheckValue(@"HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", "0");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.ClassesRoot, @"CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.ClassesRoot, @"Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "System.IsPinnedToNameSpaceTree", state ? 0 : 1, RegistryValueKind.String);
+ }
+ ),
+
+ [InterfaceCheckbox.HiddenFiles] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "1", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.SystemFiles] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "1", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.FileExtensions] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.EmptyDrives] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconComputer] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconNetwork] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconRecycleBin] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", "1", false),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconControlPanel] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconUserFiles] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031A47-3F72-44A7-89C5-5595FE6B30EE}", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031A47-3F72-44A7-89C5-5595FE6B30EE}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.IconOneDrive] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{018D5C66-4533-4307-9B53-224DE2ED1FE6}", "0", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{018D5C66-4533-4307-9B53-224DE2ED1FE6}", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceCheckbox.FolderObjects3D] = (
+ Check: () =>
+ {
+ return RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}") ||
+ RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}");
+ RegistryHelper.CreateFolder(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""");
+ }
+ ),
+
+ [InterfaceCheckbox.FolderDesktop] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.FolderDownloads] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.FolderDocuments] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.FolderPictures] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.FolderMusic] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
+ }
+ }
+ ),
+
+ [InterfaceCheckbox.FolderVideo] = (
+ Check: () => RegistryHelper.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
+ }
+ else
+ {
+ RegistryHelper.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
+ }
+ }
+ )
+ };
+
+ _tglTweaks = new Dictionary<InterfaceToggle, (Func<bool> Check, Action<bool> Apply)>
+ {
+ [InterfaceToggle.SystemButtonSize] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionHeight", "-270") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "CaptionWidth", "-270");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionHeight", state ? "-330" : "-270", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "CaptionWidth", state ? "-330" : "-270", RegistryValueKind.String);
+ }
+ ),
+
+ [InterfaceToggle.CursorFlickerFrequency] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "CursorBlinkRate", "530", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop", "CursorBlinkRate", state ? "530" : "200", RegistryValueKind.String)
+ ),
+
+ [InterfaceToggle.ScrollbarSize] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollHeight", "-210") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "ScrollWidth", "-210");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollHeight", state ? "-255" : "-210", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop\WindowMetrics", "ScrollWidth", state ? "-255" : "-210", RegistryValueKind.String);
+ }
+ ),
+
+ [InterfaceToggle.TaskbarTransparency] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", "0"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.TaskbarDarkTheme] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", "1"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.AppDarkTheme] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", "1"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.ContextMenuDelay] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "MenuShowDelay", "20"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop", "MenuShowDelay", state ? "400" : "20", RegistryValueKind.String)
+ ),
+
+ [InterfaceToggle.TaskbarPreviewDelay] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseHoverTime", "20"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseHoverTime", state ? "400" : "20", RegistryValueKind.String)
+ ),
+
+ [InterfaceToggle.IconOverlayBadges] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", "0");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTypeOverlay", state ? 1 : 0, RegistryValueKind.DWord);
+
+ try
+ {
+ Task.Run(delegate
+ {
+ if (state)
+ {
+ if (File.Exists(PathTargets.Files.BlankIcon))
+ {
+ File.Delete(PathTargets.Files.BlankIcon);
+ }
+
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
+ }
+ else
+ {
+ ArchiveManager.Unarchive(PathTargets.Files.BlankIcon, Properties.Resources.Blank);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);
+ }
+ });
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ }
+ ),
+
+ [InterfaceToggle.ShortcutNameSuffix] = (
+ Check: () => RegistryHelper.CheckValueBytes(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "link", "0000"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link", Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
+ }
+ }
+ ),
+
+ [InterfaceToggle.TaskbarAlignment] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.StartMenuLayout] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1") ||
+ HardwareData.OS.Name.IndexOf("home", StringComparison.OrdinalIgnoreCase) < 0 &&
+ (RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", "1")));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.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)
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\Education", "IsEducationEnvironment", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "HideRecommendedSection", 1, RegistryValueKind.DWord);
+ }
+ }
+ }
+ ),
+
+ [InterfaceToggle.CompactContextMenu] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelper.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", true),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", "", "", RegistryValueKind.String);
+ }
+ }
+ ),
+
+ [InterfaceToggle.TipsSuggestions] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", "0"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement", "ScoobeSystemSettingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [InterfaceToggle.CompactExplorerMode] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", "1", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "UseCompactMode", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.CopilotRecall] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", "1"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSAIFabricSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 0, RegistryValueKind.DWord);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors");
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 0, RegistryValueKind.DWord);
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot");
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 1, RegistryValueKind.DWord);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "CopilotPWAPin", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins", "RecallPin", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarCompanion", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\3389499533", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\4027803789", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\450471565", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\2283032206", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\8\502943886", "EnabledState", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\generativeAI", "Value", "Deny", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\systemAIModels", "Value", "Deny", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAIDataAnalysis", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "AllowRecallEnablement", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableClickToDo", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "TurnOffSavingSnapshots", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableSettingsAgent", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableAgentWorkspaces", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows\WindowsAI", "DisableRemoteAgentConnectors", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\WindowsAI\DisableImageCreator", "value", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot", "TurnOffWindowsCopilot", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsCopilot", "AllowCopilotRuntime", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat", "IsUserEligible", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "IsCopilotAvailable", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Shell\Copilot", "CopilotDisabledReason", "FeatureIsDisabled", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DefaultBrowserSettingsCampaignEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ComposeInlineEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "HubsSidebarEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "CopilotCDPPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeEntraCopilotPageContext", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "Microsoft365CopilotChatIconEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "EdgeHistoryAISearchEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "GenAILocalFoundationalModelSettings", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "BuiltInAIAPIsEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "AIGenThemesEnabled", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "DevToolsGenAiSettings", 2, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Edge", "ShareBrowsingHistoryWithCopilotSearchAllowed", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableImageCreator", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableCocreator", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeFill", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableGenerativeErase", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint", "DisableRemoveBackground", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\WindowsNotepad", "DisableAIFeatures", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.TaskbarEndTask] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", "1", true),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+
+ [InterfaceToggle.SnapLayouts] = (
+ Check: () => HardwareData.OS.IsWin11 && RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", "0"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableSnapAssistFlyout", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.TaskbarIconsButtons] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0")) ||
+ HardwareData.OS.IsWin10 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "0"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowTaskViewButton", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.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""");
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (state || HardwareData.OS.Build.CompareTo(22635.3785m) < 0)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}", "", "Windows Spotlight", RegistryValueKind.String);
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
+ }
+ else
+ {
+ RegistryHelper.DeleteFolderTree(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}");
+ RegistryHelper.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)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests", "value", 0, RegistryValueKind.DWord);
+ }
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Feeds", "ShellFeedsTaskbarViewMode", state ? 0 : 2, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCortanaButton", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.PersonalizedAds] = (
+ Check: () =>
+ {
+ return HardwareData.OS.IsWin11 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", "0")) ||
+ HardwareData.OS.IsWin10 &&
+ (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0"));
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+
+ if (HardwareData.OS.IsWin10)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SilentInstalledAppsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SystemPaneSuggestionsEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353696Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-353694Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338393Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ else if (HardwareData.OS.IsWin11)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Privacy", "TailoredExperiencesWithDiagnosticDataEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSyncProviderNotifications", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AccountNotifications", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_IrisRecommendations", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenOverlayEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "RotatingLockScreenEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338387Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.RestoreFolderWindows] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", "0", true),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers");
+ }
+ }
+ ),
+
+ [InterfaceToggle.TipsNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", "0") ||
+ (HardwareData.OS.IsWin11 && (RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", "0"))) ||
+ (HardwareData.OS.IsWin10 && RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "1"));
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", 0, RegistryValueKind.DWord);
+ }
+
+ if (HardwareData.OS.IsWin10)
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);
+ }
+ }
+ else if (HardwareData.OS.IsWin11)
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-310093Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SubscribedContent-338389Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.JpegWallpaperCompression] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "JPEGImportQuality", "100"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality", 100, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.DesktopTooltips] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", "0"),
+ Apply: (state) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", state ? 1 : 0, RegistryValueKind.DWord)
+ ),
+
+ [InterfaceToggle.BingStartSearch] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", "1"),
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.OpenQuickAccess] = (
+ Check: () =>
+ {
+ return HardwareData.OS.Build >= 22621m ? RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", "1") :
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", "1");
+ },
+ Apply: (state) =>
+ {
+ if (HardwareData.OS.Build >= 22621m)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", state ? 2 : 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [InterfaceToggle.AdaptiveBrightness] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", "1") ||
+ (HardwareData.OS.Build >= 22000m && RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", "0"));
+ },
+ Apply: (state) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC");
+ if (HardwareData.OS.Build >= 22000m)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption");
+ }
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "DisableCABC", 1, RegistryValueKind.DWord);
+ if (HardwareData.OS.Build >= 22000m)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", 0, RegistryValueKind.DWord);
+ }
+ }
+ }
+ ),
+ };
+ }
+
+ 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/Modules/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Modules/Tweaks/ServicesTweaks.cs
new file mode 100644
index 00000000..208b4415
--- /dev/null
+++ b/.Source/GTweak/Modules/Tweaks/ServicesTweaks.cs
@@ -0,0 +1,675 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using Microsoft.Win32;
+
+namespace GTweak.Modules.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;
+
+ public ServicesTweaks()
+ {
+ _tglTweaks = new Dictionary<ServiceToggle, (Func<bool> Check, Action<bool> Apply)>
+ {
+ [ServiceToggle.WindowsSearch] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WSearch", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fhsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WSearch", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fhsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.Xbox] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxGipSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblAuthManager", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XboxNetApiSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\XblGameSave", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+
+ SetTaskState(state, xboxTasks);
+ }
+ ),
+
+ [ServiceToggle.WindowsUpdate] = (
+ Check: () => PathTargets.Targets.WindowsUpdate.Mappings.All(f => File.Exists(f.Normal)),
+ Apply: (state) =>
+ {
+ BlockWindowsUpdate(state);
+ ChangeAccessUpdateFolders(state);
+
+ foreach ((string Normal, string Block) in PathTargets.Targets.WindowsUpdate.Mappings)
+ {
+ string currentFilePath = state ? Block : Normal;
+ string targetFilePath = state ? Normal : Block;
+
+ try
+ {
+ 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) { ErrorLogger.LogDebug(ex); }
+ }
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wisvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DmEnrollmentSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wuauserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WaaSMedicSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UsoSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+
+ if (state)
+ {
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate\AU", "AutomaticMaintenanceEnabled", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DisableWindowsUpdateAccess", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate", "DoNotConnectToWindowsUpdateInternetLocations", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [ServiceToggle.WindowsStore] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WalletService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VacSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\spectrum", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedRealitySvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\perceptionsimulation", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MixedRealityOpenXRSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MapsBroker", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EntAppSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\embeddedmode", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlidsvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WEPHOSTSVC", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\StorSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClipSVC", "Start", "4") ||
+ RegistryHelper.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"))}");
+ }
+ ),
+
+ [ServiceToggle.PerformanceCounters] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pla", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfHost", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wmiApSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\pla", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PerfHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.Biometrics] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", "4"),
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WbioSrvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.Bluetooth] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bthserv", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTAGService", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\bthserv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BthAvctpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BTAGService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+
+ SetTaskState(state, bluetoothTask);
+ }
+ ),
+
+ [ServiceToggle.Printers] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", "4") || IsTaskEnabled(printTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Spooler", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PrintNotify", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.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\*.*");
+ }
+
+ try
+ {
+ using RegistryKey baseKey = Registry.ClassesRoot.OpenSubKey("SystemFileAssociations", true);
+ if (baseKey != null)
+ {
+ foreach (string subkey in baseKey.GetSubKeyNames())
+ {
+ try
+ {
+ using RegistryKey assocKey = baseKey.OpenSubKey(subkey, true);
+ if (assocKey != null)
+ {
+ using RegistryKey shellKey = assocKey.OpenSubKey("Shell", true);
+ if (shellKey != null)
+ {
+ if (shellKey.GetSubKeyNames().Any(k => k.Equals("print", StringComparison.OrdinalIgnoreCase)))
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly", string.Empty, RegistryValueKind.String);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+
+ SetTaskState(state, printTasks);
+ }
+ ),
+
+ [ServiceToggle.Scanner] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WiaRpc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.Fax] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Fax", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TapiSrv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PhoneSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Fax", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.TabletMobileMode] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SensorDataService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SEMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.SecondaryMonitors] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WFDSConMgrSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.SystemComponents] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", "4"),
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.LocalNetwork] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CscService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lmhosts", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FDResPub", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fdPHost", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Netlogon", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CscService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\lmhosts", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\FDResPub", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fdPHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanServer", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LanmanWorkstation", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.UsbModemsRouters] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WwanSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wlpasvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\icssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\autotimesvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DusmSvc", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.VpnClients] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PolicyAgent", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\IKEEXT", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\p2pimsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsMedia] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WPDBusEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WMPNetworkSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.RemoteDesktop] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermService", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DsSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\UmRdpService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TermService", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SessionEnv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DsSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RemoteRegistry", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.ErrorEventLogging] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WerSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wercplsupport", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\Wecsvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WebDav] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WebClient", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.SmartCards] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCPolicySvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\ScDeviceEnum", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SCardSvr", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CertPropSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsKiosk] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AssignedAccessManagerSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppReadiness", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.FileEncryption] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BDESVC", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EFS", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\BDESVC", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\EFS", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.WindowsLocalization] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\LxpSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.BackgroundSecurityCheck] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WarpJITSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord)
+ ),
+
+ [ServiceToggle.BackgroundDiagnostics] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DPS", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiServiceHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WdiSystemHost", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\TroubleshootingSvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DPS", "Start", state ? 2 : 4, RegistryValueKind.DWord, true);
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c {string.Join(" & ", new[] { ("WdiServiceHost", "3"), ("WdiSystemHost", "3"), ("TroubleshootingSvc", "3"), ("DPS", "2") }.Select(s => $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\{s.Item1} /v Start /t REG_DWORD /d {(state ? s.Item2 : "4")} /f"))}");
+ }
+ ),
+
+ [ServiceToggle.CorporateTools] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\dot3svc", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\workfolderssvc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\dot3svc", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\DevQueryBroker", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\AppMgmt", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ }
+ ),
+
+ [ServiceToggle.HyperV] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HvHost", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vmicvss", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvmsession", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmictimesync", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicshutdown", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicrdv", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmickvpexchange", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicheartbeat", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicguestinterface", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\HvHost", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\vmicvss", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.PushNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WpnService", "Start", "4");
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\PushToInstall", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\WpnService", "DelayedAutoStart", state ? 0 : 1, RegistryValueKind.DWord);
+ }
+ ),
+
+ [ServiceToggle.RetailDemo] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", "4"),
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\RetailDemo", "Start", state ? 3 : 4, RegistryValueKind.DWord, true);
+ SetTaskState(state, retailTasks);
+ }
+ ),
+
+ [ServiceToggle.EdgeUpdates] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", "4") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", "4") ||
+ RegistryHelper.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", string.Empty).IndexOf(PathTargets.Targets.WindowsUpdate.UsoClient.Normal, StringComparison.OrdinalIgnoreCase) >= 0 ||
+ IsTaskEnabled(edgeTasks);
+ },
+ Apply: (state) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdatem", "Start", state ? 3 : 4, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\EdgeUpdate", "cmdLine", state ? PathTargets.Targets.WindowsUpdate.UsoClient.Normal : "dllhost.exe", RegistryValueKind.String);
+
+ SetTaskState(state, edgeTasks);
+ }
+ ),
+
+ [ServiceToggle.MultimediaClassScheduler] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MMCSS", "Start", "4"),
+ Apply: (state) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MMCSS", "Start", state ? 3 : 4, RegistryValueKind.DWord, true)
+ ),
+
+ [ServiceToggle.Geolocation] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lfsvc", "Start", "4") || IsTaskEnabled(geoTasks),
+ Apply: (state) =>
+ {
+ RegistryHelper.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);
+ }
+ }
+ }
+
+ private static void ChangeAccessUpdateFolders(bool state)
+ {
+ Task.Run(delegate
+ {
+ try
+ {
+ if (state)
+ {
+ SetTaskStateOwner(true, winUpdatesTasks);
+ }
+ else
+ {
+ CommandExecutor.RunCommandAsTrustedInstaller($"/c net stop wuauserv & net stop bits & net stop cryptSvc & net stop RuntimeBroker & taskkill /f " + string.Join(" ", (new string[] { "usocoreworker", "msedge", "pwahelper", "edgeupdate", "edgeupdatem", "microsoftedgeupdate", "msedgewebviewhost", "msedgeuserbroker", "runtimebroker", "widgets" }).Select(p => $"/im {p}.exe")));
+
+ foreach (string path in PathTargets.Targets.WindowsUpdate.CleanupFolders)
+ {
+ UnlockHandleHelper.UnlockDirectory(path);
+
+ CommandExecutor.RunCommandAsTrustedInstaller($@"/c takeown /f ""{path}"" /r /d y && icacls ""{path}"" /inheritance:r && icacls ""{path}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 && icacls ""{path}"" /grant {Environment.UserName}:F /t && rd /s /q ""{path}""");
+
+ for (int i = 0; Directory.Exists(path) && i < 5; i++)
+ {
+ try { Directory.Delete(path, true); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+
+ CommandExecutor.RunCommand($"Remove-Item -LiteralPath '{path}' -Recurse -Force", true);
+ }
+ }
+
+ SetTaskStateOwner(false, winUpdatesTasks);
+ CommandExecutor.RunCommandAsTrustedInstaller("/c net start bits & net start cryptSvc");
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ });
+ }
+ }
+}
diff --git a/.Source/GTweak/Modules/Tweaks/SystemTweaks.cs b/.Source/GTweak/Modules/Tweaks/SystemTweaks.cs
new file mode 100644
index 00000000..e84b7209
--- /dev/null
+++ b/.Source/GTweak/Modules/Tweaks/SystemTweaks.cs
@@ -0,0 +1,878 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Management;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks.Defender;
+using GTweak.Windows;
+using Microsoft.Win32;
+
+namespace GTweak.Modules.Tweaks
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ internal struct UIAction
+ {
+ internal const uint SPI_SETMOUSESPEED = 0x0071;
+ internal const uint SPI_SETKEYBOARDDELAY = 0x0017;
+ internal const uint SPI_SETKEYBOARDSPEED = 0x000B;
+ 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;
+ private static string _currentPowerGuid = string.Empty;
+
+ 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 = RegistryHelper.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: () => RegistryHelper.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSensitivity", 10),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETMOUSESPEED, value, value, 2);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSensitivity", value, RegistryValueKind.String);
+ }
+ ),
+
+ [SystemSlider.KeyboardDelay] = (
+ Check: () => RegistryHelper.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", 1),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETKEYBOARDDELAY, value, value, 2);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Keyboard", "KeyboardDelay", value, RegistryValueKind.String);
+ }
+ ),
+
+ [SystemSlider.KeyboardSpeed] = (
+ Check: () => RegistryHelper.GetValue<double>(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardSpeed", 31),
+ Apply: (value) =>
+ {
+ SystemParametersInfo(UIAction.SPI_SETKEYBOARDSPEED, value, value, 2);
+ RegistryHelper.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 RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSpeed", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold1", "0") ||
+ RegistryHelper.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);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSpeed", state ? "1" : "0", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold1", state ? "6" : "0", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold2", state ? "10" : "0", RegistryValueKind.String);
+ }
+ ),
+
+ [SystemToggle.StickyKeysFilter] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "26") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "26");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Accessibility\StickyKeys", "Flags", state ? "507" : "26", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Accessibility\Keyboard Response", "Flags", state ? "58" : "26", RegistryValueKind.String);
+ }
+ ),
+
+ [SystemToggle.WindowsDefender] = (
+ Check: () => File.Exists(PathTargets.Targets.Defender.SmartScreen.Normal),
+ Apply: async (state, canShowWindow) =>
+ {
+ BlockWDefender(state);
+ ArchiveManager.Unarchive(PathTargets.Executable.NSudo, Properties.Resources.NSudoLC);
+ if (state == false)
+ {
+ ArchiveManager.Unarchive(PathTargets.Executable.DisablingWD, Properties.Resources.DisablingWD);
+ }
+
+ if (canShowWindow)
+ {
+ OverlayWindow overlayWindow = new OverlayWindow();
+ overlayWindow.Show();
+
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
+ await backgroundQueue.QueueTask(delegate { NotificationManager.Show(state ? "info" : "warn", state ? "info_wd_noty" : "warn_wd_noty").Perform(); });
+ await backgroundQueue.QueueTask(delegate { DefenderTweaks.SetProtectionState(state); });
+
+ if (state)
+ {
+ await backgroundQueue.QueueTask(delegate { NotificationManager.Show().WithDelay(300).Restart(); });
+ CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathTargets.Executable.NSudo}\"");
+ }
+
+ overlayWindow.Close();
+ }
+ else
+ {
+ DefenderTweaks.SetProtectionState(state);
+ }
+ }
+ ),
+
+ [SystemToggle.UserAccountControl] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", state ? 5 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [SystemToggle.SecurityNotifications] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance", "Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", "1", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", 1, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.StoreAutoUpdate] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", "2"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", 2, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.RealtekAudioDelay] = (
+ Check: () =>
+ {
+ 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())
+ {
+ if (subKeyName == "Properties")
+ {
+ continue;
+ }
+
+ 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) { ErrorLogger.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)
+ {
+ if (subKey.GetValue("DriverDesc") is string driverDesc && driverDesc.Equals("Realtek High Definition Audio", StringComparison.OrdinalIgnoreCase))
+ {
+ RegistryHelper.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);
+ RegistryHelper.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);
+ RegistryHelper.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) { ErrorLogger.LogDebug(ex); }
+ }
+ ),
+
+ [SystemToggle.LockScreenTimeout] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", "2"),
+ Apply: (state, _) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7", "Attributes", state ? 1 : 2, RegistryValueKind.DWord)
+ ),
+
+ [SystemToggle.HibernationFastStartup] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings", "ShowHibernateOption", state ? 1 : 0, RegistryValueKind.DWord);
+ CommandExecutor.RunCommand(@$"/c powercfg.exe -h {(state ? "on" : "off")}");
+ }
+ ),
+
+ [SystemToggle.AutoEndTasks] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "AutoEndTasks", "1"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks", "1", RegistryValueKind.String);
+ }
+ }
+ ),
+
+ [SystemToggle.ExeLaunchWarnings] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Internet Explorer\Security", "DisableSecuritySettingsCheck", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1806", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.MemoryDiagnostics] = (
+ Check: () => IsTaskEnabled(memoryDiagTasks),
+ Apply: (state, _) => SetTaskState(state, memoryDiagTasks)
+ ),
+
+ [SystemToggle.NetworkProtocols] = (
+ Check: () => _isNetshState,
+ Apply: (state, _) =>
+ {
+ _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}");
+ }
+ ),
+
+ [SystemToggle.FileSystemCache] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", "1"),
+ Apply: (state, _) => RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "LargeSystemCache", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [SystemToggle.StartupDelay] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", "0"),
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.QuickAccessHistory] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowFrequent", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "ShowRecent", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackDocs", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.RemovableMediaAutoplay] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", "1"),
+ Apply: (state, _) => RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", state ? 0 : 1, RegistryValueKind.DWord)
+ ),
+
+ [SystemToggle.PowerScheme] = (
+ Check: () =>
+ {
+ return !RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "Description", string.Empty).Contains("-18") &&
+ !RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{_currentPowerGuid}", "FriendlyName", string.Empty).Contains("-19");
+ },
+ Apply: (state, _) => SetPowercfg(state)
+ ),
+
+ [SystemToggle.BluetoothFunction] = (
+ Check: () => BluetoothManager.IsEnabled,
+ Apply: (state, _) => BluetoothManager.SetState(state)
+ ),
+
+ [SystemToggle.WindowsFirewall] = (
+ Check: () => RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mpssvc", "Start", "4"),
+ Apply: (state, _) =>
+ {
+ RegistryHelper.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)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wtd", "Start", state ? 2 : 4, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.GameMode] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AutoGameModeEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "AllowAutoGameMode", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AutoGameModeEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AllowAutoGameMode", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [SystemToggle.GameBar] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\System\GameConfigStore", "GameDVR_Enabled", "0");
+ },
+ Apply: (state, _) =>
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"System\GameConfigStore", "GameDVR_Enabled", state ? 1 : 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", state ? 1 : 0, RegistryValueKind.DWord);
+ }
+ ),
+
+ [SystemToggle.BackgroundApps] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", "1") ||
+ RegistryHelper.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", "2");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled");
+ RegistryHelper.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle");
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications", "GlobalUserDisabled", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle", 0, RegistryValueKind.DWord);
+ RegistryHelper.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy");
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppPrivacy", "LetAppsRunInBackground", 2, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.ReservedStorage] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", "2") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", "0") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", "0");
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo");
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "MiscPolicyInfo", 2, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "PassedPolicy", 0, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager", "ShippedWithReserves", 0, RegistryValueKind.DWord);
+ }
+ }
+ ),
+
+ [SystemToggle.DynamicTickHpet] = (
+ Check: () => _isTickState,
+ Apply: (state, _) =>
+ {
+ _isTickState = state;
+ CommandExecutor.RunCommand(state ? $"{PathTargets.Executable.BcdEdit} /deletevalue disabledynamictick; {PathTargets.Executable.BcdEdit} /deletevalue useplatformclock" : $"{PathTargets.Executable.BcdEdit} /set disabledynamictick yes; {PathTargets.Executable.BcdEdit} /set useplatformclock false", true);
+ }
+ ),
+
+
+ [SystemToggle.HealthCheck] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHC", "PreviousUninstall", "1", true) ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealthCheck", "installed", "1", true);
+ },
+ Apply: (state, _) =>
+ {
+ if (state)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed", 1, RegistryValueKind.DWord);
+ }
+ else
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHC", "PreviousUninstall");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PCHealthCheck", "installed");
+ }
+ }
+ ),
+
+ [SystemToggle.InsiderTasks] = (
+ Check: () => IsTaskEnabled(winInsiderTasks),
+ Apply: (state, _) => SetTaskState(state, winInsiderTasks)
+ ),
+
+ [SystemToggle.SystemDriveDefrag] = (
+ Check: () =>
+ {
+ return !IsTaskEnabled(defragTask) || RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", "N") ||
+ RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\defragsvc", "Start", "2");
+ },
+ Apply: (state, _) =>
+ {
+ SetTaskState(true, defragTask);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction", "Enable", state ? "Y" : "N", RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\services\defragsvc", "Start", 2, RegistryValueKind.DWord);
+ }
+ ),
+
+ [SystemToggle.PauseWindowsUpdates] = (
+ Check: () =>
+ {
+ return DateTime.TryParse(RegistryHelper.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", string.Empty), null, System.Globalization.DateTimeStyles.RoundtripKind, out var start) &&
+ DateTime.TryParse(RegistryHelper.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");
+
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime", end, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused", 1, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays", 447, RegistryValueKind.DWord);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime", end, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime", start, RegistryValueKind.String);
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime", end, RegistryValueKind.String);
+ CommandExecutor.RunCommand("/c gpupdate /force");
+ }
+ else
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesStartTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseFeatureUpdatesEndTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesStartTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseQualityUpdatesEndTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesStartTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings", "PauseUpdatesExpiryTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureStatus");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityStatus");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedFeatureDate");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\Settings", "PausedQualityDate");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "IsDeferralIsActive");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PolicySources");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatesPaused");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "QualityUpdatePausePeriodInDays");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatesPaused");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "FeatureUpdatePausePeriodInDays");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesStartTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseFeatureUpdatesEndTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesStartTime");
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\WindowsUpdate\UpdatePolicy\PolicyState", "PauseQualityUpdatesEndTime");
+ }
+ }
+ ),
+
+ [SystemToggle.MultiPlaneOverlay] = (
+ Check: () =>
+ {
+ return RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", "5") ||
+ (HardwareData.OS.Build >= 26200m && RegistryHelper.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", "0"));
+ },
+ Apply: (state, _) =>
+ {
+ bool isSupportedBuild = HardwareData.OS.Build >= 26200;
+
+ if (state)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode");
+ if (isSupportedBuild)
+ {
+ RegistryHelper.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay");
+ }
+ }
+ else
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "OverlayTestMode", 5, RegistryValueKind.DWord);
+ if (isSupportedBuild)
+ {
+ RegistryHelper.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\Dwm", "EnableOverlay", 0, RegistryValueKind.DWord);
+ }
+ }
+ }
+ ),
+ };
+ }
+
+ internal static void ViewNetshState()
+ {
+ try
+ {
+ string getStateNetsh = CommandExecutor.GetCommandOutput("/c chcp 65001 & netsh int teredo show state & netsh int ipv6 isatap show state & netsh int isatap show state & netsh int ipv6 6to4 show state", false).GetAwaiter().GetResult();
+ _isNetshState = getStateNetsh.Contains("default") || getStateNetsh.Contains("enabled");
+ }
+ catch { _isNetshState = false; }
+ }
+
+ internal static void ViewConfigTick()
+ {
+ try
+ {
+ string output = CommandExecutor.GetCommandOutput(PathTargets.Executable.BcdEdit).GetAwaiter().GetResult();
+ _isTickState = !Regex.IsMatch(output, @"(?is)(?=.*\bdisabledynamictick\s+(yes|true))(?=.*\buseplatformclock\s+(no|false))", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);
+ }
+ catch { _isTickState = false; }
+ }
+
+ internal void CheckAll()
+ {
+ foreach (var tweak in _sliderTweaks)
+ {
+ _сontrolWriter.Slider[(int)tweak.Key] = tweak.Value.Check();
+ }
+
+ foreach (var tweak in _tglTweaks)
+ {
+ _с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 void Apply(string controlName, uint value)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksSys, controlName, value);
+
+ if (controlName.StartsWith("Slider") && int.TryParse(controlName.Substring(6), out int index))
+ {
+ if (_sliderTweaks.TryGetValue((SystemSlider)index, out var action))
+ {
+ action.Apply(value);
+ }
+ }
+ }
+
+ [DllImport("user32.dll")]
+ private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint[] _pvParam, uint _fWinIni);
+
+ internal void Apply(string controlName, bool state, bool canShowWindow = true)
+ {
+ INIManager.TempWrite(INIManager.TempTweaksSys, controlName, state);
+
+ if (controlName.StartsWith("TglButton") && int.TryParse(controlName.Substring(9), out int index))
+ {
+ if (_tglTweaks.TryGetValue((SystemToggle)index, out var action))
+ {
+ action.Apply(state, canShowWindow);
+ }
+ }
+ }
+
+ private static void SetPowercfg(bool state)
+ {
+ Task.Run(async () =>
+ {
+ Process _powercfg = new Process()
+ {
+ StartInfo = {
+ FileName = PathTargets.Executable.PowerCfg,
+ WindowStyle = ProcessWindowStyle.Hidden,
+ UseShellExecute = true,
+ Verb = "runas",
+ CreateNoWindow = true
+ },
+ };
+
+ string searchScheme = default, unlockFrequency = @"-attributes SUB_PROCESSOR 75b0ae3f-bce0-45a7-8c89-c9611c25e100 -ATTRIB_HIDE";
+
+ try
+ {
+ if (state)
+ {
+ string activeScheme = @"Microsoft:PowerPlan\\{" + RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "ActivePowerScheme", string.Empty) + "}";
+ string selectedScheme = string.Empty, backupScheme = string.Empty;
+
+ using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE InstanceID !='" + activeScheme + "'"))
+ {
+ foreach (ManagementObject managementObj in searcher.Get().Cast<ManagementObject>())
+ {
+ using (managementObj)
+ {
+ searchScheme = Regex.Match(Convert.ToString(managementObj["InstanceID"]), @"\{([^)]*)\}").Groups[1].Value;
+
+ if (!RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "Description", string.Empty).Contains("-10") &&
+ !RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "FriendlyName", string.Empty).Contains("-11"))
+ {
+ selectedScheme = searchScheme;
+ break;
+ }
+
+ backupScheme ??= searchScheme;
+ }
+ }
+ }
+
+
+ selectedScheme ??= backupScheme;
+
+ if (!string.IsNullOrEmpty(selectedScheme))
+ {
+ _currentPowerGuid = selectedScheme;
+
+ using (_powercfg)
+ {
+ _powercfg.StartInfo.Arguments = $"/setactive {selectedScheme}";
+ _powercfg.Start();
+ }
+ }
+ }
+ else
+ {
+ using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE IsActive=false"))
+ {
+ foreach (ManagementObject managementObj in searcher.Get().Cast<ManagementObject>())
+ {
+ using (managementObj)
+ {
+ searchScheme = Regex.Match(Convert.ToString(managementObj["InstanceID"]), @"\{([^)]*)\}").Groups[1].Value;
+
+ if (RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "Description", string.Empty).Contains("-18") &&
+ RegistryHelper.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "FriendlyName", string.Empty).Contains("-19"))
+ {
+ _currentPowerGuid = searchScheme;
+
+ using (_powercfg)
+ {
+ _powercfg.StartInfo.Arguments = $"/setactive {searchScheme}";
+ _powercfg.Start();
+
+ _powercfg.StartInfo.Arguments = unlockFrequency;
+ _powercfg.Start();
+ }
+
+ break;
+ }
+ else
+ {
+ searchScheme = string.Empty;
+ }
+ }
+ }
+ }
+
+
+ if (string.IsNullOrEmpty(searchScheme))
+ {
+ string _guid = Guid.NewGuid().ToString("D");
+
+ using (_powercfg)
+ {
+ _powercfg.StartInfo.Arguments = $"/duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 {_guid}";
+ _powercfg.Start();
+
+ _powercfg.StartInfo.Arguments = $"/setactive {_guid}";
+ _powercfg.Start();
+
+ _powercfg.StartInfo.Arguments = unlockFrequency;
+ _powercfg.Start();
+
+ foreach (string type in new[] { "monitor-timeout", "standby-timeout" })
+ {
+ foreach (string source in new[] { "ac", "dc" })
+ {
+ _powercfg.StartInfo.Arguments = $"/change {type}-{source} 0";
+ _powercfg.Start();
+ }
+ }
+ }
+
+ _currentPowerGuid = _guid;
+ }
+ }
+ }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
+ });
+ }
+ }
+}
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
deleted file mode 100644
index ae03d325..00000000
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ /dev/null
@@ -1,605 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using GTweak.Properties;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-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;
-
- public ConfidentialityTweaks()
- {
- _tglTweaks = new Dictionary<ConfidentialityToggle, (Func<bool> Check, Action<bool> Apply)>
- {
- [ConfidentialityToggle.TargetedAdvertising] = (
- Check: () =>
- {
- 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) =>
- {
- 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);
- }
- }
- ),
-
- [ConfidentialityToggle.DataSynchronization] = (
- Check: () =>
- {
- 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) =>
- {
- 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);
- }
- }
- ),
-
- [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);
- }
-
- SetTaskStateOwner(state, appExpInventoryTasks);
- }
- ),
-
- [ConfidentialityToggle.AppUsageStatistics] = (
- Check: () =>
- {
- 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\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\DataCollection", "AllowDeviceNameInTelemetry");
- }
- else
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0, RegistryValueKind.DWord);
- }
-
- SetTaskStateOwner(state, appExpUsageTasks);
- }
- ),
-
- [ConfidentialityToggle.HandwritingData] = (
- Check: () =>
- {
- 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.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);
- }
- }
- ),
-
- [ConfidentialityToggle.HardwareConfigurationData] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", "0") || IsTaskEnabled(ceipTasks),
- Apply: (state) =>
- {
- 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);
- }
- ),
-
- [ConfidentialityToggle.HiddenMicrosoftDomains] = (
- Check: () => IsDefaultHosts(),
- Apply: (state) =>
- {
- BlockSpyDomain(state);
-
- Task.Run(delegate
- {
- try
- {
- if (state)
- {
- 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.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;
-
- HashSet<string> existingEntries = new HashSet<string>(existingText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()), StringComparer.OrdinalIgnoreCase);
-
- 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))
- {
- blocklist.AppendLine(trimmedLine);
- }
- }
-
- if (blocklist.Length > 0)
- {
- FileInfo fileInfo = new FileInfo(PathLocator.Files.Hosts.Original);
-
- 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()}");
- }
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- });
- }
- ),
-
- [ConfidentialityToggle.UserLocationTracking] = (
- Check: () =>
- {
- 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) =>
- {
- 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);
- }
- }
- ),
-
- [ConfidentialityToggle.FeedbackRequests] = (
- Check: () =>
- {
- 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) =>
- {
- 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);
- }
- ),
-
- [ConfidentialityToggle.SpeechSynthesisUpdates] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", "0") || IsTaskEnabled(speechTasks),
- Apply: (state) =>
- {
- 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);
- }
- ),
-
- [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) =>
- {
- 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);
- }
- }
- ),
-
- [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) =>
- {
- (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);
- }
- }
- }
- ),
-
- [ConfidentialityToggle.WindowsEventLogging] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service", "Start", "4"),
- Apply: (state) =>
- {
- 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);
- }
- ),
-
-
- [ConfidentialityToggle.NvidiaTelemetry] = (
- Check: () =>
- {
- 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);
- }
- ),
-
- [ConfidentialityToggle.UserBehaviorRecording] = (
- Check: () =>
- {
- 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);
- }
- }
- ),
-
- [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) =>
- {
- 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);
- }
- ),
-
- [ConfidentialityToggle.IntelTelemetry] = (
- Check: () =>
- {
- 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);
- }
- ),
- };
- }
-
- 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"))
- {
- 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"))
- {
- fileEntries.Add(trimmed);
- }
- }
-
- return !resourceEntries.IsSubsetOf(fileEntries);
- }
- catch { return true; }
- }
- }
-}
diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs
deleted file mode 100644
index 0c2f5814..00000000
--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs
+++ /dev/null
@@ -1,491 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using Microsoft.Win32;
-
-namespace GTweak.Utilities.Tweaks.DefenderManager
-{
- internal class WindowsDefender : AclPermissionsBackup
- {
- const string ServiceName = "GTweakWDManager";
-
- private static readonly Dictionary<string, string> services = new Dictionary<string, string>
- {
- { "WinDefend", "2" },
- { "SecurityHealthService", "2"},
- { "Sense", "3" },
- { "SgrmAgent", "3" },
- { "SgrmBroker", "3" },
- { "MDCoreSvc", "3" },
- { "MsSecCore", "3" },
- { "MsSecFlt", "3" },
- { "MsSecWfp", "3" },
- { "WdFilter", "0" },
- { "WdBoot", "0" },
- { "WdNisDrv", "3" },
- { "WdNisSvc", "3"},
- { "webthreatdefsvc", "3" },
- { "webthreatdefusersvc", "2" },
- { "wscsvc", "2" }
- };
-
- internal static void SetProtectionState(bool state) => (state ? (Action)Activate : Deactivate)();
-
- private static void Activate()
- {
- TerminateProcess();
-
- InvokePowerShell(@"Set-MpPreference -DisableIOAVProtection $false
- Set-MpPreference -DisableRealtimeMonitoring $false
- Set-MpPreference -DisableBehaviorMonitoring $false
- Set-MpPreference -DisableBlockAtFirstSeen $false
- Set-MpPreference -DisablePrivacyMode $false
- Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $false
- Set-MpPreference -DisableArchiveScanning $false
- Set-MpPreference -DisableIntrusionPreventionSystem $false
- Set-MpPreference -DisableScriptScanning $false
- Set-MpPreference -SubmitSamplesConsent 1
- Set-MpPreference -MAPSReporting 2
- Set-MpPreference -PUAProtection Enabled");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableOnAccessProtection /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideRealtimeScanDirection /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIOAVProtection /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableBehaviorMonitoring /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIntrusionPreventionSystem /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableRealtimeMonitoring /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBehaviorMonitoring /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIOAVProtection /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableOnAccessProtection /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRealtimeMonitoring /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRoutinelyTakingAction /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScanOnRealtimeEnable /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScriptScanning /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRawWriteNotification /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIntrusionPreventionSystem /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableInformationProtectionControl /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v RealtimeScanDirection /t REG_DWORD /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableArchiveScanning /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v SignatureDisableUpdateOnStartupWithoutEngine /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisablePrivacyMode /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBlockAtFirstSeen /f");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- @"reg delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter"" /v EnabledV9 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender"" /v PUAProtection /t REG_DWORD /d 2 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtection /t REG_DWORD /d 1 /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontOfferThroughWUA /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontReportInfectionInformation /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v ConfigureAppInstallControl /f & " +
- @"reg delete ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v DontReportInfectionInformation /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceConfidence/Analytic"" /v Enabled /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Operational"" /v Enabled /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Verbose"" /v Enabled /t REG_DWORD /d 1 /f");
-
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "SmartScreenEnabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\System", "EnableSmartScreen");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender");
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirstRunDisabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "AntiVirusOverride");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirewallOverride");
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender", "PUAProtection", 2, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PrivateProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DisableNotifications", 0, RegistryValueKind.DWord);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "EnabledV9");
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "PreventOverride");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger", "Start", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", "Start", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational", "Enabled", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Security-Diagnostic/Operational", "Enabled", 1, RegistryValueKind.DWord);
-
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "DisableBlockAtFirstSeen");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "CaptureBetaFeatures");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 0, RegistryValueKind.DWord);
-
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Policy", "VerifiedAndReputablePolicyState", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "EnabledV9", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"System\CurrentControlSet\Control\CI\State", "HVCIEnabled", 1, RegistryValueKind.DWord);
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity", "Enabled");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard", "EnableVirtualizationBasedSecurity");
-
-
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "EnableWebContentEvaluation");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "PreventOverride");
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SecurityHealth", @"%windir%\system32\SecurityHealthSystray.exe", RegistryValueKind.ExpandString);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "SecurityHealth", new byte[] { 0002, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }, RegistryValueKind.Binary);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender", "\"%ProgramFiles%\\Windows Defender\\MSASCui.exe\"-runkey", RegistryValueKind.String);
-
- RegistryHelp.Write(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP", "", "{09A47860-11B0-4DA5-AFA5-26D86198A780}", RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "", PathLocator.Folders.SystemDrive + @"Program Files\Windows Defender\shellext.dll", RegistryValueKind.String);
- RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "ThreadingModel", "Apartment", RegistryValueKind.String);
-
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\ASR", "EnableASRConsumers");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Controlled Folder Access", "EnableControlledFolderAccess");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Windows Defender Exploit Guard\Network Protection", "EnableNetworkProtection");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide cmd /c " +
- @"reg delete HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /f & " +
- @"reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /t REG_SZ /d 328010 /f & " +
- $"for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\BlockAntimalware.exe\" ren \"%D\\BlockAntimalware.exe\" MsMpEng.exe & " +
- $"for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\BlockAntimalwareCore.exe\" ren \"%D\\BlockAntimalwareCore.exe\" MpDefenderCoreService.exe & " +
- @"reg delete ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v DisableBlockAtFirstSeen /f & " +
- @"reg delete ""HKLM\SOFTWARE\Microsoft\Windows Defender\Windows Defender\ControlledFolderAccess"" /v Enable /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreService1DSTelemetry /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreServiceECSIntegration /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v MdDisableResController /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SpynetReporting /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SubmitSamplesConsent /t REG_DWORD /d 0 /f & " +
- @"reg delete ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v LocalSettingOverrideSpynetReporting /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiSpyware /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiVirus /t REG_DWORD /d 0 /f");
-
- ManageExclusions(false);
- SetTaskState(true, winDefenderTasks);
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c {CommandExecutor.CleanCommand(string.Join(" & ", services.Select(kv => $@"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{kv.Key}"" /v Start /t REG_DWORD /d {kv.Value} /f")))}""");
-
- foreach ((string Normal, string Block) in PathLocator.Targets.Defender.Mappings)
- {
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
- $@"(if exist ""{Normal}"" (takeown /f ""{Normal}"" /a && del /f /q /a ""{Normal}"") else (cd .))",
- $@"takeown /f ""{Block}"" /a",
- $@"rename ""{Block}"" ""{Path.GetFileName(Normal)}""",
- $@"icacls ""{Normal}"" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464",
- $@"icacls ""{Normal}"" /inheritance:r",
- $@"icacls ""{Normal}"" /grant *S-1-5-32-544:F",
- $@"icacls ""{Normal}"" /grant *S-1-5-32-545:R",
- $@"icacls ""{Normal}"" /grant *S-1-5-18:F",
- $@"icacls ""{Normal}"" /grant *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464:F",
- $@"icacls ""{Normal}"" /grant *S-1-15-2-1:R",
- $@"icacls ""{Normal}"" /grant *S-1-15-2-2:R",
- $@"icacls ""{Normal}"" /remove ""{Environment.UserName}"""}))}""");
- }
-
- ImportRights();
-
- InvokePowerShell("Get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage");
- InvokePowerShell(@"Get-AppXpackage Microsoft.WindowsDefender | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register ""$($_.InstallLocation)\AppXManifest.xml""}");
- }
-
- private static void Deactivate()
- {
- ExportRights();
-
- TerminateProcess();
-
- foreach (var (Normal, Block) in PathLocator.Targets.Defender.Mappings)
- {
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{CommandExecutor.CleanCommand(string.Join(" && ", new[] {
- $@"takeown /f ""{Normal}"" /a",
- $@"icacls ""{Normal}"" /inheritance:r",
- $@"icacls ""{Normal}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18",
- $@"icacls ""{Normal}"" /grant ""{Environment.UserName}"":F",
- $@"(if exist ""{Block}"" (takeown /f ""{Block}"" /a && del /f /q /a ""{Block}"") else (cd .))",
- $@"rename ""{Normal}"" ""{Path.GetFileName(Block)}"""
- }))}""");
- }
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c {CommandExecutor.CleanCommand(string.Join(" & ", services.Select(kv => $@"reg add ""HKLM\SYSTEM\CurrentControlSet\Services\{kv.Key}"" /v Start /t REG_DWORD /d 4 /f")))}""");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- $"for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\MsMpEng.exe\" ren \"%D\\MsMpEng.exe\" BlockAntimalware.exe & " +
- $"for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\\Microsoft\\Windows Defender\\Platform\\*")}\") do if exist \"%D\\MpDefenderCoreService.exe\" ren \"%D\\MpDefenderCoreService.exe\" BlockAntimalwareCore.exe & " +
- @"reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 3 /f & " +
- @"reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtection /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Features"" /v TamperProtectionSource /t REG_DWORD /d 2 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender\Windows Defender\ControlledFolderAccess"" /v Enable /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreService1DSTelemetry /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v DisableCoreServiceECSIntegration /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows defender\CoreService"" /v MdDisableResController /t REG_DWORD /d 1 /f & " +
- @"reg delete ""HKLM\SYSTEM\CurrentControlSet\Services\WdFilter\Instances\WdFilter Instance"" /v Altitude /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"" /v SmartScreenEnabled /t REG_SZ /d off /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows\System"" /v EnableSmartScreen /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiSpyware /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender"" /v DisableAntiVirus /t REG_DWORD /d 1 /f");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\ASR", "EnableASRConsumers", 0, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Controlled Folder Access", "EnableControlledFolderAccess", 0, RegistryValueKind.DWord, true);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows defender\Windows defender Exploit Guard\Network Protection", "EnableNetworkProtection", 0, RegistryValueKind.DWord, true);
-
- InvokePowerShell(@"Set-MpPreference -DisableIOAVProtection $true
- Set-MpPreference -DisableRealtimeMonitoring $true
- Set-MpPreference -DisableBehaviorMonitoring $true
- Set-MpPreference -DisableBlockAtFirstSeen $true
- Set-MpPreference -DisablePrivacyMode $true
- Set-MpPreference -SignatureDisableUpdateOnStartupWithoutEngine $true
- Set-MpPreference -DisableArchiveScanning $true
- Set-MpPreference -DisableIntrusionPreventionSystem $true
- Set-MpPreference -DisableScriptScanning $true
- Set-MpPreference -SubmitSamplesConsent 2
- Set-MpPreference -MAPSReporting 0
- Set-MpPreference -PUAProtection Disabled");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableOnAccessProtection /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideRealtimeScanDirection /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIOAVProtection /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableBehaviorMonitoring /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableIntrusionPreventionSystem /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v LocalSettingOverrideDisableRealtimeMonitoring /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIOAVProtection /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRoutinelyTakingAction /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableScriptScanning /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableRawWriteNotification /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableIntrusionPreventionSystem /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableInformationProtectionControl /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v RealtimeScanDirection /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableArchiveScanning /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v SignatureDisableUpdateOnStartupWithoutEngine /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisablePrivacyMode /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection"" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f");
-
- SetTaskState(false, winDefenderTasks);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiVirus", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "ServiceKeepAlive", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastService", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "HideExclusionsFromLocalAdmins", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "AllowFastServiceStartup", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "PUAProtection", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender", "DisableLocalAdminMerge", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender", "PUAProtection", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Features", "DeviceControlEnabled", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpEnablePus", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpCloudBlockLevel", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "DisableGradualRelease", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "MpBafsExtendedTimeout", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine", "EnableFileHashComputation", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "LowCpuPriority", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableReparsePointScanning", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableHeuristics", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableEmailScanning", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableCatchupQuickScan", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableCatchupFullScan", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableScanningNetworkFiles", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableArchiveScanning", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Scan", "DisableRestorePoint", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "ServiceKeepAlive", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "AllowFastServiceStartup", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableAntiSpyware", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware", "DisableAntiVirus", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware\SpyNet", "SpyNetReporting", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Microsoft Antimalware\SpyNet", "LocalSettingOverrideSpyNetReporting", 0, RegistryValueKind.DWord);
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SpynetReporting /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v SubmitSamplesConsent /t REG_DWORD /d 2 /f & " +
- @"reg add ""HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet"" /v LocalSettingOverrideSpynetReporting /t REG_DWORD /d 0 /f");
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PrivateProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DisableNotifications", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableEnhancedNotifications", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications", "DisableNotifications", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection", "DisallowExploitProtectionOverride", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection", "UILockdown", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "SignatureDisableNotification", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "RealtimeSignatureDelivery", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "ForceUpdateFromMU", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableScheduledSignatureUpdateOnBattery", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "UpdateOnStartUp", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "SignatureUpdateCatchupInterval", 2, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableUpdateOnStartupWithoutEngine", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "DisableScanOnUpdate", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates", "ScheduleTime", 5184, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "DisableEnhancedNotifications", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "DisableGenericRePorts", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "WppTracingLevel", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\Reporting", "WppTracingComponents", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirstRunDisabled", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "AntiVirusOverride", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Security Center", "FirewallOverride", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration", "Notification_Suppress", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration", "SuppressRebootNotification", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"Software\Policies\Microsoft\Windows Defender\UX Configuration", "UILockdown", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Device performance and health", "UILockdown", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Family optionsObj", "UILockdown", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "DisableBlockAtFirstSeen", 1, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows Defender\Cloud", "CaptureBetaFeatures", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Policies\Microsoft\Windows Defender", "DisableRoutinelyTakingAction", 1, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger", "Start", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger", "Start", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Security-Diagnostic/Operational", "Enabled", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Policy", "VerifiedAndReputablePolicyState", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "EnabledV9", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\CI\Config", "VulnerableDriverBlocklistEnable", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"System\CurrentControlSet\Control\CI\State", "HVCIEnabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity", "Enabled", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\DeviceGuard", "EnableVirtualizationBasedSecurity", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\WTDS\Components", "ServiceEnabled", "0", RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter", "EnabledV9", "0", RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "EnableWebContentEvaluation", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost", "PreventOverride", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "EnabledV9", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge", "PreventOverride", 0, RegistryValueKind.DWord);
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "SecurityHealth", new byte[] { 0099, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, RegistryValueKind.Binary);
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Windows Defender");
- RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SecurityHealth");
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c " +
- @"reg add ""HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost"" /v EnableWebContentEvaluation /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter"" /v EnabledV9 /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows Defender"" /v PUAProtection /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontOfferThroughWUA /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\MRT"" /v DontReportInfectionInformation /t REG_DWORD /d 1 /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v ConfigureAppInstallControl /t REG_SZ /d ""Anywhere"" /f & " +
- @"reg add ""HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen"" /v DontReportInfectionInformation /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceConfidence/Analytic"" /v Enabled /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Operational"" /v Enabled /t REG_DWORD /d 0 /f & " +
- @"reg add ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceGuard/Verbose"" /v Enabled /t REG_DWORD /d 0 /f");
-
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"*\shellex\ContextMenuHandlers\EPP");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"Directory\shellex\ContextMenuHandlers\EPP");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"Drive\shellex\ContextMenuHandlers\EPP");
- RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32");
-
- ManageExclusions(true);
-
- foreach (string directory in PathLocator.Targets.Defender.CleanupFolders)
- {
- try
- {
- if (!Directory.Exists(directory))
- {
- continue;
- }
-
- foreach (string file in Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly))
- {
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""{$@"takeown /f ""{file}"" /a & icacls ""{file}"" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 & icacls ""{file}"" /grant ""{Environment.UserName}"":F & del /f /q ""{file}"""}""");
-
- for (int i = 0; File.Exists(file) && i < 10; i++)
- {
- try { File.Delete(file); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c ""del /f /q ""{file}""""");
- TakingOwnership.GrantAdministratorsAccess(file, TakingOwnership.SE_OBJECT_TYPE.SE_FILE_OBJECT);
-
- Thread.Sleep(500);
- }
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- }
-
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", 0, RegistryValueKind.DWord);
-
- CommandExecutor.RunCommand($"/c sc create {ServiceName} binPath= \"{PathLocator.Executable.DisablingWD} /unlock\" type= own start= auto obj= LocalSystem");
-
- RegistryHelp.Write(Registry.LocalMachine, $@"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{ServiceName}", "", "Service", RegistryValueKind.String);
-
- ProcessStartInfo psi = new ProcessStartInfo
- {
- FileName = PathLocator.Executable.BcdEdit,
- Arguments = "/set {current} safeboot minimal",
- UseShellExecute = false,
- CreateNoWindow = true,
- RedirectStandardOutput = true,
- RedirectStandardError = true
- };
- Process.Start(psi)?.WaitForExit();
-
- CommandExecutor.RunCommand("/c shutdown /r /f /t 0");
- }
-
- private static void ManageExclusions(bool isDisable)
- {
- foreach (string drive in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Removable).Select(d => d.Name))
- {
- CommandExecutor.RunCommand($" {(isDisable ? "Add-MpPreference" : "Remove-MpPreference")} -ExclusionPath '{drive}'", true);
- }
- }
-
- private static void TerminateProcess()
- {
- string[] processes = { "smartscreen", "mpdefendercoreservice", "msmpeng", "securityhealthservice", "securityhealthsystray", "securityhealthui", "wuauserv", "searchui", "sechealthui", "configsecuritypolicy", "runtimebroker", "msedge", "ssoncom", "usocoreworker", "defenderbootstrapper", "sensedlpprocessor", "sensetracer",
- "dlpuseragent", "mpam-d", "mpam-fe", "mpam-fe_bd", "mpas-d", "mpas-fe", "mpas-fe_bd", "mpav-d", "mpav-fe", "mpav-fe_bd", "mpcmdrun", "mpcopyaccelerator", "mpdlpcmd", "mpdlpservice", "mpextms", "mpsigstub", "mrt", "msmpengcp", "mssense", "nissrv", "offlinescannershell", "securekernel", "usocoreworker", "securityhealthhost",
- "senseap", "senseaptoast", "sensecm", "sensegpparser", "senseidentity", "senseimdscollector", "senseir", "sensendr", "sensesampleuploader", "sensetvm", "sgrmbroker", "healthattestationclientagent", "wdnissvc", "wdboot", "msseccore", "mssecflt", "mssecwfp", "mdcoresvc", "sensece", "senseui", "sensepp", "wdshield", "mipdlp" };
- CommandExecutor.RunCommandAsTrustedInstaller($@"""{PathLocator.Executable.NSudo}"" -U:T -P:E -CreatePath:S -ShowWindowMode:Hide -Wait cmd /c taskkill /f " + string.Join(" ", processes.Select(p => $"/im {p}.exe")));
- }
-
- private static void InvokePowerShell(string command)
- {
- try
- {
- Process comandoAEjecutar = new Process();
- comandoAEjecutar.StartInfo.FileName = PathLocator.Executable.PowerShell;
- comandoAEjecutar.StartInfo.Arguments =
- "-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand \"" +
- Convert.ToBase64String(Encoding.Unicode.GetBytes(command)) + "\"";
- comandoAEjecutar.StartInfo.UseShellExecute = false;
- comandoAEjecutar.StartInfo.RedirectStandardOutput = true;
- comandoAEjecutar.StartInfo.RedirectStandardError = true;
- comandoAEjecutar.StartInfo.CreateNoWindow = true;
- comandoAEjecutar.Start();
- comandoAEjecutar.StandardOutput.ReadToEnd();
- return;
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
-
- }
- }
-}
-
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
deleted file mode 100644
index 70804818..00000000
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ /dev/null
@@ -1,948 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Threading.Tasks;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-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,
- FolderObjects3D,
- FolderDesktop,
- FolderDownloads,
- FolderDocuments,
- FolderPictures,
- FolderMusic,
- FolderVideo
- }
-
- 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,
- 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;
-
- public InterfaceTweaks()
- {
- _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);
- }
- ),
-
- [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);
- }
- )
- };
-
- _cbTweaks = new Dictionary<InterfaceCheckbox, (Func<bool> Check, Action<bool> Apply)>
- {
- [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}");
- }
- }
- ),
-
- [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)
- ),
-
- [InterfaceCheckbox.FolderObjects3D] = (
- Check: () =>
- {
- 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) =>
- {
- if (state)
- {
- 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}");
- }
- else
- {
- 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}");
- }
-
- CommandExecutor.RunCommand(state ? @"/c rd /s /q ""%userprofile%\3D Objects""" : @"/c mkdir ""%userprofile%\3D Objects""");
- }
- ),
-
- [InterfaceCheckbox.FolderDesktop] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}");
- }
- }
- ),
-
- [InterfaceCheckbox.FolderDownloads] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}");
- }
- }
- ),
-
- [InterfaceCheckbox.FolderDocuments] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}");
- }
- }
- ),
-
- [InterfaceCheckbox.FolderPictures] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}");
- }
- }
- ),
-
- [InterfaceCheckbox.FolderMusic] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}");
- }
- }
- ),
-
- [InterfaceCheckbox.FolderVideo] = (
- Check: () => RegistryHelp.KeyExists(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
- }
- else
- {
- RegistryHelp.CreateFolder(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}");
- }
- }
- )
- };
-
- _tglTweaks = new Dictionary<InterfaceToggle, (Func<bool> Check, Action<bool> Apply)>
- {
- [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);
- }
- ),
-
- [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);
- }
- ),
-
- [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)
- ),
-
- [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)
- ),
-
- [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)
- ),
-
- [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: () =>
- {
- 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.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); }
- }
- ),
-
- [InterfaceToggle.ShortcutNameSuffix] = (
- Check: () => RegistryHelp.CheckValueBytes(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "link", "0000"),
- Apply: (state) =>
- {
- 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)
- ),
-
- [InterfaceToggle.StartMenuLayout] = (
- Check: () =>
- {
- 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);
-
- if (HardwareData.OS.Name.IndexOf("Home", StringComparison.OrdinalIgnoreCase) < 0)
- {
- 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");
- }
- 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);
- }
- }
- }
- ),
-
- [InterfaceToggle.CompactContextMenu] = (
- Check: () => HardwareData.OS.IsWin11 && RegistryHelp.KeyExists(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", true),
- Apply: (state) =>
- {
- 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);
- }
- }
- ),
-
- [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.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.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.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: () =>
- {
- 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\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);
- }
- }
- ),
-
- [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);
- }
- }
- ),
-
- [InterfaceToggle.RestoreFolderWindows] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", "0", true),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", 1, RegistryValueKind.DWord);
- }
- else
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers");
- }
- }
- ),
-
- [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.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\Microsoft\Windows\CurrentVersion\Policies\Explorer", "AllowOnlineTips", 0, RegistryValueKind.DWord);
- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\PushNotifications", "ToastEnabled", 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);
- }
- }
- ),
-
- [InterfaceToggle.JpegWallpaperCompression] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "JPEGImportQuality", "100"),
- Apply: (state) =>
- {
- if (state)
- {
- RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality");
- }
- else
- {
- RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality", 100, RegistryValueKind.DWord);
- }
- }
- ),
-
- [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) =>
- {
- 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);
- }
- }
- ),
-
- [InterfaceToggle.OpenQuickAccess] = (
- Check: () =>
- {
- 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) =>
- {
- 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);
- }
- }
- ),
-
- [InterfaceToggle.AdaptiveBrightness] = (
- Check: () =>
- {
- 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) =>
- {
- if (state)
- {
- 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)
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "CABCOption", 0, RegistryValueKind.DWord);
- }
- }
- }
- ),
- };
- }
-
- 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
deleted file mode 100644
index 1c577f43..00000000
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ /dev/null
@@ -1,675 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-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;
-
- public ServicesTweaks()
- {
- _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);
- }
- ),
-
- [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);
-
- SetTaskState(state, xboxTasks);
- }
- ),
-
- [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)
- {
- string currentFilePath = state ? Block : Normal;
- string targetFilePath = state ? Normal : Block;
-
- try
- {
- 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);
- }
- }
- ),
-
- [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"))}");
- }
- ),
-
- [ServiceToggle.PerformanceCounters] = (
- Check: () =>
- {
- 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);
- }
- ),
-
- [ServiceToggle.Biometrics] = (
- Check: () => RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WbioSrvc", "Start", "4"),
- Apply: (state) =>
- {
- 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);
- }
- ),
-
- [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);
- }
- ),
-
- [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) =>
- {
- 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\*.*");
- }
-
- try
- {
- using RegistryKey baseKey = Registry.ClassesRoot.OpenSubKey("SystemFileAssociations", true);
- if (baseKey != null)
- {
- foreach (string subkey in baseKey.GetSubKeyNames())
- {
- try
- {
- using RegistryKey assocKey = baseKey.OpenSubKey(subkey, true);
- if (assocKey != null)
- {
- using RegistryKey shellKey = assocKey.OpenSubKey("Shell", true);
- if (shellKey != null)
- {
- if (shellKey.GetSubKeyNames().Any(k => k.Equals("print", StringComparison.OrdinalIgnoreCase)))
- {
- 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); }
-
- SetTaskState(state, printTasks);
- }
- ),
-
- [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);
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c {string.Join(" & ", new[] { ("WdiServiceHost", "3"), ("WdiSystemHost", "3"), ("TroubleshootingSvc", "3"), ("DPS", "2") }.Select(s => $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\{s.Item1} /v Start /t REG_DWORD /d {(state ? s.Item2 : "4")} /f"))}");
- }
- ),
-
- [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);
- }
- }
- }
-
- private static void ChangeAccessUpdateFolders(bool state)
- {
- Task.Run(delegate
- {
- try
- {
- if (state)
- {
- SetTaskStateOwner(true, winUpdatesTasks);
- }
- else
- {
- CommandExecutor.RunCommandAsTrustedInstaller($"/c net stop wuauserv & net stop bits & net stop cryptSvc & net stop RuntimeBroker & taskkill /f " + string.Join(" ", (new string[] { "usocoreworker", "msedge", "pwahelper", "edgeupdate", "edgeupdatem", "microsoftedgeupdate", "msedgewebviewhost", "msedgeuserbroker", "runtimebroker", "widgets" }).Select(p => $"/im {p}.exe")));
-
- foreach (string path in PathLocator.Targets.WindowsUpdate.CleanupFolders)
- {
- UnlockHandleHelper.UnlockDirectory(path);
-
- CommandExecutor.RunCommandAsTrustedInstaller($@"/c takeown /f ""{path}"" /r /d y && icacls ""{path}"" /inheritance:r && icacls ""{path}"" /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 && icacls ""{path}"" /grant {Environment.UserName}:F /t && rd /s /q ""{path}""");
-
- for (int i = 0; Directory.Exists(path) && i < 5; i++)
- {
- try { Directory.Delete(path, true); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
-
- CommandExecutor.RunCommand($"Remove-Item -LiteralPath '{path}' -Recurse -Force", true);
- }
- }
-
- SetTaskStateOwner(false, winUpdatesTasks);
- CommandExecutor.RunCommandAsTrustedInstaller("/c net start bits & net start cryptSvc");
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- });
- }
- }
-}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
deleted file mode 100644
index ed0632f2..00000000
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ /dev/null
@@ -1,878 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Management;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks.DefenderManager;
-using GTweak.Windows;
-using Microsoft.Win32;
-
-namespace GTweak.Utilities.Tweaks
-{
- [StructLayout(LayoutKind.Sequential, Pack = 1)]
- internal struct UIAction
- {
- internal const uint SPI_SETMOUSESPEED = 0x0071;
- internal const uint SPI_SETKEYBOARDDELAY = 0x0017;
- internal const uint SPI_SETKEYBOARDSPEED = 0x000B;
- 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;
- private static string _currentPowerGuid = string.Empty;
-
- 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);
-
- _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);
- }
- ),
-
- [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);
- }
- ),
-
- [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);
- }
- ),
-
- [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);
- }
- ),
-
- [SystemToggle.WindowsDefender] = (
- Check: () => File.Exists(PathLocator.Targets.Defender.SmartScreen.Normal),
- Apply: async (state, canShowWindow) =>
- {
- BlockWDefender(state);
- ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);
- if (state == false)
- {
- 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 (state)
- {
- await backgroundQueue.QueueTask(delegate { NotificationManager.Show().WithDelay(300).Restart(); });
- CommandExecutor.RunCommand($"/c timeout /t 10 && del /f \"{PathLocator.Executable.NSudo}\"");
- }
-
- overlayWindow.Close();
- }
- else
- {
- WindowsDefender.SetProtectionState(state);
- }
- }
- ),
-
- [SystemToggle.UserAccountControl] = (
- Check: () =>
- {
- 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
- {
- RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", 2, RegistryValueKind.DWord);
- }
- }
- ),
-
- [SystemToggle.RealtekAudioDelay] = (
- Check: () =>
- {
- 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())
- {
- if (subKeyName == "Properties")
- {
- continue;
- }
-
- 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)
- {
- 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); }
- }
- ),
-
- [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)
- ),
-
- [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")}");
- }
- ),
-
- [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);
- }
- }
- ),
-
- [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);
- }
- }
- ),
-
- [SystemToggle.MemoryDiagnostics] = (
- Check: () => IsTaskEnabled(memoryDiagTasks),
- Apply: (state, _) => SetTaskState(state, memoryDiagTasks)
- ),
-
- [SystemToggle.NetworkProtocols] = (
- Check: () => _isNetshState,
- Apply: (state, _) =>
- {
- _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}");
- }
- ),
-
- [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)
- ),
-
- [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);
- }
- }
- ),
-
- [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);
- }
- }
- ),
-
- [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)
- ),
-
- [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)
- ),
-
- [SystemToggle.BluetoothFunction] = (
- Check: () => BluetoothManager.IsEnabled,
- Apply: (state, _) => BluetoothManager.SetState(state)
- ),
-
- [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);
- }
- }
- ),
-
- [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);
- }
- ),
-
- [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);
- }
- ),
-
- [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);
- }
- }
- ),
-
- [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");
- }
- }
- ),
-
- [SystemToggle.InsiderTasks] = (
- Check: () => IsTaskEnabled(winInsiderTasks),
- Apply: (state, _) => SetTaskState(state, 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);
- }
- ),
-
- [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");
- }
- }
- ),
-
- [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;
-
- 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()
- {
- try
- {
- string getStateNetsh = CommandExecutor.GetCommandOutput("/c chcp 65001 & netsh int teredo show state & netsh int ipv6 isatap show state & netsh int isatap show state & netsh int ipv6 6to4 show state", false).GetAwaiter().GetResult();
- _isNetshState = getStateNetsh.Contains("default") || getStateNetsh.Contains("enabled");
- }
- catch { _isNetshState = false; }
- }
-
- internal static void ViewConfigTick()
- {
- try
- {
- string output = CommandExecutor.GetCommandOutput(PathLocator.Executable.BcdEdit).GetAwaiter().GetResult();
- _isTickState = !Regex.IsMatch(output, @"(?is)(?=.*\bdisabledynamictick\s+(yes|true))(?=.*\buseplatformclock\s+(no|false))", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);
- }
- catch { _isTickState = false; }
- }
-
- internal void CheckAll()
- {
- foreach (var tweak in _sliderTweaks)
- {
- _сontrolWriter.Slider[(int)tweak.Key] = tweak.Value.Check();
- }
-
- foreach (var tweak in _tglTweaks)
- {
- _с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 void Apply(string controlName, uint value)
- {
- INIManager.TempWrite(INIManager.TempTweaksSys, controlName, value);
-
- if (controlName.StartsWith("Slider") && int.TryParse(controlName.Substring(6), out int index))
- {
- if (_sliderTweaks.TryGetValue((SystemSlider)index, out var action))
- {
- action.Apply(value);
- }
- }
- }
-
- [DllImport("user32.dll")]
- private static extern bool SystemParametersInfo(uint _uiAction, uint _uiParam, uint[] _pvParam, uint _fWinIni);
-
- internal void Apply(string controlName, bool state, bool canShowWindow = true)
- {
- INIManager.TempWrite(INIManager.TempTweaksSys, controlName, state);
-
- if (controlName.StartsWith("TglButton") && int.TryParse(controlName.Substring(9), out int index))
- {
- if (_tglTweaks.TryGetValue((SystemToggle)index, out var action))
- {
- action.Apply(state, canShowWindow);
- }
- }
- }
-
- private static void SetPowercfg(bool state)
- {
- Task.Run(async () =>
- {
- Process _powercfg = new Process()
- {
- StartInfo = {
- FileName = PathLocator.Executable.PowerCfg,
- WindowStyle = ProcessWindowStyle.Hidden,
- UseShellExecute = true,
- Verb = "runas",
- CreateNoWindow = true
- },
- };
-
- string searchScheme = default, unlockFrequency = @"-attributes SUB_PROCESSOR 75b0ae3f-bce0-45a7-8c89-c9611c25e100 -ATTRIB_HIDE";
-
- try
- {
- if (state)
- {
- string activeScheme = @"Microsoft:PowerPlan\\{" + RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "ActivePowerScheme", string.Empty) + "}";
- string selectedScheme = string.Empty, backupScheme = string.Empty;
-
- using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE InstanceID !='" + activeScheme + "'"))
- {
- foreach (ManagementObject managementObj in searcher.Get().Cast<ManagementObject>())
- {
- using (managementObj)
- {
- searchScheme = Regex.Match(Convert.ToString(managementObj["InstanceID"]), @"\{([^)]*)\}").Groups[1].Value;
-
- if (!RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "Description", string.Empty).Contains("-10") &&
- !RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "FriendlyName", string.Empty).Contains("-11"))
- {
- selectedScheme = searchScheme;
- break;
- }
-
- backupScheme ??= searchScheme;
- }
- }
- }
-
-
- selectedScheme ??= backupScheme;
-
- if (!string.IsNullOrEmpty(selectedScheme))
- {
- _currentPowerGuid = selectedScheme;
-
- using (_powercfg)
- {
- _powercfg.StartInfo.Arguments = $"/setactive {selectedScheme}";
- _powercfg.Start();
- }
- }
- }
- else
- {
- using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\cimv2\power", "SELECT InstanceID FROM Win32_PowerPlan WHERE IsActive=false"))
- {
- foreach (ManagementObject managementObj in searcher.Get().Cast<ManagementObject>())
- {
- using (managementObj)
- {
- searchScheme = Regex.Match(Convert.ToString(managementObj["InstanceID"]), @"\{([^)]*)\}").Groups[1].Value;
-
- if (RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "Description", string.Empty).Contains("-18") &&
- RegistryHelp.GetValue($@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\{searchScheme}", "FriendlyName", string.Empty).Contains("-19"))
- {
- _currentPowerGuid = searchScheme;
-
- using (_powercfg)
- {
- _powercfg.StartInfo.Arguments = $"/setactive {searchScheme}";
- _powercfg.Start();
-
- _powercfg.StartInfo.Arguments = unlockFrequency;
- _powercfg.Start();
- }
-
- break;
- }
- else
- {
- searchScheme = string.Empty;
- }
- }
- }
- }
-
-
- if (string.IsNullOrEmpty(searchScheme))
- {
- string _guid = Guid.NewGuid().ToString("D");
-
- using (_powercfg)
- {
- _powercfg.StartInfo.Arguments = $"/duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 {_guid}";
- _powercfg.Start();
-
- _powercfg.StartInfo.Arguments = $"/setactive {_guid}";
- _powercfg.Start();
-
- _powercfg.StartInfo.Arguments = unlockFrequency;
- _powercfg.Start();
-
- foreach (string type in new[] { "monitor-timeout", "standby-timeout" })
- {
- foreach (string source in new[] { "ac", "dc" })
- {
- _powercfg.StartInfo.Arguments = $"/change {type}-{source} 0";
- _powercfg.Start();
- }
- }
- }
-
- _currentPowerGuid = _guid;
- }
- }
- }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- });
- }
- }
-}
diff --git a/.Source/GTweak/View/AddonsView.xaml b/.Source/GTweak/View/AddonsView.xaml
index c2a0b3f1..a584ef63 100644
--- a/.Source/GTweak/View/AddonsView.xaml
+++ b/.Source/GTweak/View/AddonsView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
diff --git a/.Source/GTweak/View/AddonsView.xaml.cs b/.Source/GTweak/View/AddonsView.xaml.cs
index cbaf98cd..8c88c5b1 100644
--- a/.Source/GTweak/View/AddonsView.xaml.cs
+++ b/.Source/GTweak/View/AddonsView.xaml.cs
@@ -2,7 +2,7 @@ using System;
using System.Windows.Controls;
using GTweak.Core.Base;
using GTweak.Core.ViewModel;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Managers;
namespace GTweak.View
{
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml b/.Source/GTweak/View/ConfidentialityView.xaml
index 29e45b5f..6f33b261 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml
+++ b/.Source/GTweak/View/ConfidentialityView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 4323b8a5..1a46ebc2 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -3,9 +3,9 @@ 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;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.View
{
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 9badcd2d..290556b2 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -3,12 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- xmlns:anim="clr-namespace:GTweak.Utilities.Animation"
- xmlns:conv="clr-namespace:GTweak.Core.Converters"
+ xmlns:anim="clr-namespace:GTweak.Animations"
+ xmlns:conv="clr-namespace:GTweak.Converters"
xmlns:local="clr-namespace:GTweak.View"
mc:Ignorable="d" d:Width="1014" Style="{StaticResource LaunchPage}">
<UserControl.DataContext>
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index 58d7bcac..984d28bb 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -7,20 +7,19 @@ using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
+using GTweak.Animations;
using GTweak.Core.Base;
using GTweak.Core.ViewModel;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Managers;
namespace GTweak.View
{
public partial class DataSystemView : UserControl, IViewPageBase
{
private readonly HardwareProvider _hardwareProvider = new HardwareProvider();
- private readonly BackgroundQueue backgroundQueue = new BackgroundQueue();
+ private readonly BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
private TimerControlManager _timer = default;
public DataSystemView()
@@ -113,8 +112,8 @@ namespace GTweak.View
if (!PopupCopy.IsOpen)
{
PopupCopy.IsOpen = true;
- CopyTextToastBody.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 0.9, 0.27, () => { PopupCopy.IsOpen = false; }, true));
- PopupCopy.BeginAnimation(Popup.VerticalOffsetProperty, FactoryAnimation.CreateIn(-20, -50, 0.35, useCubicEase: true));
+ CopyTextToastBody.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 0.9, 0.27, () => { PopupCopy.IsOpen = false; }, true));
+ PopupCopy.BeginAnimation(Popup.VerticalOffsetProperty, AnimationFactory.CreateIn(-20, -50, 0.35, useCubicEase: true));
}
Thread thread = new Thread(() =>
@@ -124,7 +123,7 @@ namespace GTweak.View
Clipboard.Clear();
Clipboard.SetData(DataFormats.UnicodeText, selectedLine);
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
});
thread.SetApartmentState(ApartmentState.STA);
diff --git a/.Source/GTweak/View/InterfaceView.xaml b/.Source/GTweak/View/InterfaceView.xaml
index 21f79be3..fe53f912 100644
--- a/.Source/GTweak/View/InterfaceView.xaml
+++ b/.Source/GTweak/View/InterfaceView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index 0451ad32..5b8cffeb 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -4,9 +4,9 @@ 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;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.View
{
diff --git a/.Source/GTweak/View/PackagesView.xaml b/.Source/GTweak/View/PackagesView.xaml
index 68bfcdde..fc791f36 100644
--- a/.Source/GTweak/View/PackagesView.xaml
+++ b/.Source/GTweak/View/PackagesView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
diff --git a/.Source/GTweak/View/PackagesView.xaml.cs b/.Source/GTweak/View/PackagesView.xaml.cs
index 22954f2e..f630750a 100644
--- a/.Source/GTweak/View/PackagesView.xaml.cs
+++ b/.Source/GTweak/View/PackagesView.xaml.cs
@@ -5,19 +5,18 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Threading;
using GTweak.Core.Base;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.View
{
public partial class PackagesView : UserControl, IViewPageBase
{
private TimerControlManager _timer = default;
- private readonly BackgroundQueue _backgroundQueue = new BackgroundQueue();
+ private readonly BackgroundQueueManager _backgroundQueue = new BackgroundQueueManager();
private readonly BackgroundWorker backgroundWorker = new BackgroundWorker();
- private readonly UninstallingPakages _uninstalling = new UninstallingPakages();
+ private readonly AppxPackageHandler _packageHandler = new AppxPackageHandler();
private bool? _isWebViewRemoval = false;
public PackagesView()
@@ -26,8 +25,8 @@ namespace GTweak.View
Loaded += delegate
{
- backgroundWorker.DoWork += delegate { _uninstalling.GetInstalledPackages(); };
- backgroundWorker.RunWorkerCompleted += delegate { Dispatcher.Invoke(() => { UninstallingPakages.OnPackagesChanged(); }); };
+ backgroundWorker.DoWork += delegate { _packageHandler.GetInstalledPackages(); };
+ backgroundWorker.RunWorkerCompleted += delegate { Dispatcher.Invoke(() => { AppxPackageHandler.OnPackagesChanged(); }); };
_timer = new TimerControlManager(TimeSpan.Zero, TimerControlManager.TimerMode.CountUp, time =>
{
@@ -68,7 +67,7 @@ namespace GTweak.View
if (toggleButton.IsChecked == false && packageName == "OneDrive")
{
- if (string.IsNullOrWhiteSpace(PathLocator.Executable.OneDriveSetup))
+ if (string.IsNullOrWhiteSpace(PathTargets.Executable.OneDriveSetup))
{
NotificationManager.Show("warn", "error_onedrive_noty").Perform();
}
@@ -78,10 +77,10 @@ namespace GTweak.View
await _backgroundQueue.QueueTask(async () =>
{
- await Dispatcher.InvokeAsync(() => { UninstallingPakages.HandleAvailabilityStatus(packageName, true); });
+ await Dispatcher.InvokeAsync(() => { AppxPackageHandler.HandleAvailabilityStatus(packageName, true); });
- try { await UninstallingPakages.RestoreOneDriveFolder(); }
- finally { await Dispatcher.InvokeAsync(() => { UninstallingPakages.HandleAvailabilityStatus(packageName, false); }); }
+ try { await AppxPackageHandler.RestoreOneDriveFolder(); }
+ finally { await Dispatcher.InvokeAsync(() => { AppxPackageHandler.HandleAvailabilityStatus(packageName, false); }); }
});
}
}
@@ -104,10 +103,10 @@ namespace GTweak.View
await _backgroundQueue.QueueTask(async () =>
{
- await Dispatcher.InvokeAsync(() => { UninstallingPakages.HandleAvailabilityStatus(packageName, true); });
+ await Dispatcher.InvokeAsync(() => { AppxPackageHandler.HandleAvailabilityStatus(packageName, true); });
- try { await UninstallingPakages.RemoveAppxPackage(packageName, (bool)_isWebViewRemoval); }
- finally { await Dispatcher.InvokeAsync(() => { UninstallingPakages.HandleAvailabilityStatus(packageName, false); }); }
+ try { await AppxPackageHandler.RemoveAppxPackage(packageName, (bool)_isWebViewRemoval); }
+ finally { await Dispatcher.InvokeAsync(() => { AppxPackageHandler.HandleAvailabilityStatus(packageName, false); }); }
await Dispatcher.BeginInvoke(new Action(() =>
{
diff --git a/.Source/GTweak/View/ServicesView.xaml b/.Source/GTweak/View/ServicesView.xaml
index 21d9a249..c86cf7d9 100644
--- a/.Source/GTweak/View/ServicesView.xaml
+++ b/.Source/GTweak/View/ServicesView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index 3bb22b6e..acd7ab73 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -3,8 +3,8 @@ using System.Windows.Controls;
using System.Windows.Input;
using GTweak.Assets.UserControls;
using GTweak.Core.Base;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.View
{
diff --git a/.Source/GTweak/View/SystemView.xaml b/.Source/GTweak/View/SystemView.xaml
index b65ab660..3079631a 100644
--- a/.Source/GTweak/View/SystemView.xaml
+++ b/.Source/GTweak/View/SystemView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 746ce13b..f9aaf50c 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -3,9 +3,9 @@ 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;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
namespace GTweak.View
{
diff --git a/.Source/GTweak/View/ToolsetView.xaml b/.Source/GTweak/View/ToolsetView.xaml
index 282bde78..0ba5e72d 100644
--- a/.Source/GTweak/View/ToolsetView.xaml
+++ b/.Source/GTweak/View/ToolsetView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
diff --git a/.Source/GTweak/View/UtilsView.xaml b/.Source/GTweak/View/UtilsView.xaml
index c2db5637..8efd2e91 100644
--- a/.Source/GTweak/View/UtilsView.xaml
+++ b/.Source/GTweak/View/UtilsView.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:b="clr-namespace:GTweak.Core.Behaviors"
+ xmlns:b="clr-namespace:GTweak.Behaviors"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
mc:Ignorable="d" d:Width="1014" Style="{StaticResource LaunchPage}">
diff --git a/.Source/GTweak/View/UtilsView.xaml.cs b/.Source/GTweak/View/UtilsView.xaml.cs
index 7d1526a3..5ed4e001 100644
--- a/.Source/GTweak/View/UtilsView.xaml.cs
+++ b/.Source/GTweak/View/UtilsView.xaml.cs
@@ -2,11 +2,10 @@ using System;
using System.IO;
using System.Windows.Controls;
using GTweak.Core.Base;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Maintenance;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Maintenance;
+using GTweak.Modules.Managers;
using GTweak.Windows;
using Ookii.Dialogs.Wpf;
@@ -50,7 +49,7 @@ namespace GTweak.View
OverlayWindow overlayWindow = new OverlayWindow();
overlayWindow.Show();
NotificationManager.Show("info", "createpoint_noty").Perform();
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
if (_systemRestore == null)
{
@@ -60,7 +59,7 @@ namespace GTweak.View
}
try { await backgroundQueue.QueueTask(delegate { _systemRestore.CreateRestorePoint(); }); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
overlayWindow.Close();
}
@@ -70,10 +69,10 @@ namespace GTweak.View
{
if (_systemRestore.IsPointCreationAllowed)
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate
{
- try { _systemRestore.DisableRestorePoint(); } catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ try { _systemRestore.DisableRestorePoint(); } catch (Exception ex) { ErrorLogger.LogDebug(ex); }
});
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "disable_recovery_noty").WithDelay(300).Perform(); });
}
@@ -87,10 +86,10 @@ namespace GTweak.View
{
if (!_systemRestore.IsPointCreationAllowed)
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate
{
- try { _systemRestore.EnableRestorePoint(); } catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ try { _systemRestore.EnableRestorePoint(); } catch (Exception ex) { ErrorLogger.LogDebug(ex); }
});
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "enable_recovery_noty").WithDelay(300).Perform(); });
}
@@ -114,7 +113,7 @@ namespace GTweak.View
{
if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) != FileAttributes.Compressed)
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate
{
try { _ntfsCompressor.SetCompression(selectedPath, true); }
@@ -147,7 +146,7 @@ namespace GTweak.View
{
if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) == FileAttributes.Compressed)
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate
{
try { _ntfsCompressor.SetCompression(selectedPath, false); }
@@ -169,7 +168,7 @@ namespace GTweak.View
private async void BtnClear_ClickButton(object sender, EventArgs e)
{
- ClearingMemory clearingMemory = new ClearingMemory();
+ MemoryCleaner clearingMemory = new MemoryCleaner();
if (clearingMemory.IsWinOldExists)
{
@@ -181,7 +180,7 @@ namespace GTweak.View
}
}
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate { clearingMemory.StartMemoryCleanup((bool)_isWinOldRemoval); });
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "clear_ram_noty").WithDelay(500).Perform(); });
}
@@ -203,7 +202,7 @@ namespace GTweak.View
OverlayWindow overlayWindow = new OverlayWindow();
overlayWindow.Show();
RegistryExporter registryExporter = new RegistryExporter();
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate { registryExporter.Export(vistaSaveFileDialog.FileName); });
overlayWindow.Close();
}
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml.cs b/.Source/GTweak/Windows/ImportWindow.xaml.cs
index 3653544d..e6d6260e 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml.cs
+++ b/.Source/GTweak/Windows/ImportWindow.xaml.cs
@@ -4,10 +4,10 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -40,7 +40,7 @@ namespace GTweak.Windows
private async void Window_ContentRendered(object sender, EventArgs e)
{
Progress<byte> progress = new Progress<byte>(ReportProgress);
- try { await ApplyTweaksWithProgress(_cancellationTokenSource.Token, progress); } catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ try { await ApplyTweaksWithProgress(_cancellationTokenSource.Token, progress); } catch (Exception ex) { ErrorLogger.LogDebug(ex); }
}
private void ReportProgress(byte valueProgress)
@@ -78,7 +78,7 @@ namespace GTweak.Windows
private async Task ApplyTweaksWithProgress(CancellationToken token, IProgress<byte> progress)
{
- INIManager iniManager = new INIManager(PathLocator.Files.Config);
+ INIManager iniManager = new INIManager(PathTargets.Files.Config);
var allSections = new (string Section, Action<string, bool> TweakAction, Dictionary<Enum, NotificationManager.NoticeAction> NoticeActions, Dictionary<Enum, ExplorerManager.ExplorerAction> ExplorerMapping)[]
{
@@ -130,7 +130,7 @@ namespace GTweak.Windows
}
else if (tweak == "TglButton3")
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
+ BackgroundQueueManager backgroundQueue = new BackgroundQueueManager();
await backgroundQueue.QueueTask(delegate
{
_sysTweaks.Apply(tweak, Convert.ToBoolean(value), false);
@@ -175,7 +175,7 @@ namespace GTweak.Windows
}
}
}
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ catch (Exception ex) { ErrorLogger.LogDebug(ex); }
appliedTweaks++;
progress.Report((byte)((double)appliedTweaks / totalTweaks * 100));
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index 899157eb..461270cc 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -1,13 +1,13 @@
using System;
using System.ComponentModel;
using System.Threading;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Maintenance;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
+using GTweak.Animations;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Maintenance;
+using GTweak.Modules.Managers;
+using GTweak.Modules.Tweaks;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -15,7 +15,7 @@ namespace GTweak.Windows
public partial class LoadingWindow : FluentWindow
{
private readonly HardwareProvider _hardwareProvider = new HardwareProvider();
- private readonly UninstallingPakages _uninstallingPakages = new UninstallingPakages();
+ private readonly AppxPackageHandler _packageHandler = new AppxPackageHandler();
public LoadingWindow()
{
@@ -54,7 +54,7 @@ namespace GTweak.Windows
static void ExecuteWithLogging(Action action, string member)
{
try { action(); }
- catch (Exception ex) { ErrorLogging.LogWritingFile(ex, false, member); }
+ catch (Exception ex) { ErrorLogger.LogWritingFile(ex, false, member); }
}
ReportStep(1, 15);
@@ -75,8 +75,8 @@ namespace GTweak.Windows
ExecuteWithLogging(() => _hardwareProvider.GetPhysicalAvailableMemory().GetAwaiter().GetResult(), nameof(_hardwareProvider.GetPhysicalAvailableMemory));
ReportStep(4, 75, 300);
- ExecuteWithLogging(_uninstallingPakages.GetInstalledPackages, nameof(_uninstallingPakages.GetInstalledPackages));
- ExecuteWithLogging(UninstallingPakages.CheckingForLocalAccount, nameof(UninstallingPakages.CheckingForLocalAccount));
+ ExecuteWithLogging(_packageHandler.GetInstalledPackages, nameof(_packageHandler.GetInstalledPackages));
+ ExecuteWithLogging(AppxPackageHandler.CheckingForLocalAccount, nameof(AppxPackageHandler.CheckingForLocalAccount));
ReportStep(5, 90);
ExecuteWithLogging(() => _hardwareProvider.GetUserIpAddress().GetAwaiter().GetResult(), nameof(_hardwareProvider.GetUserIpAddress));
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index b67125ec..20d032ec 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -9,10 +9,10 @@ using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
+using GTweak.Animations;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -124,11 +124,11 @@ namespace GTweak.Windows
SettingsPanel.CacheMode = new BitmapCache { RenderAtScale = 1 };
if (SettingsPanel.RenderTransform is TranslateTransform transform)
{
- transform.BeginAnimation(TranslateTransform.XProperty, FactoryAnimation.CreateIn(transform.X, TglButtonSettings.IsChecked.Value ? 0 : 400, 0.5, () => { SettingsPanel.CacheMode = null; }, useCubicEase: true));
+ transform.BeginAnimation(TranslateTransform.XProperty, AnimationFactory.CreateIn(transform.X, TglButtonSettings.IsChecked.Value ? 0 : 400, 0.5, () => { SettingsPanel.CacheMode = null; }, useCubicEase: true));
}
break;
case nameof(TglButtonTheme):
- SettingsEngine.SelfReboot();
+ GlobalOptions.SelfReboot();
Visibility = Visibility.Collapsed;
break;
default:
@@ -138,19 +138,19 @@ namespace GTweak.Windows
#endregion
#region Settings Panel
- private void BtnExport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => SettingsEngine.SaveFileConfig();
+ private void BtnExport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => GlobalOptions.SaveFileConfig();
- private void BtnImport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => SettingsEngine.OpenFileConfig();
+ private void BtnImport_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => GlobalOptions.OpenFileConfig();
- private void BtnDelete_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => SettingsEngine.SelfRemoval();
+ private void BtnDelete_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => GlobalOptions.SelfRemoval();
private void BtnContacts_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Process.Start(new ProcessStartInfo(((System.Windows.Controls.Image)sender).Uid switch
{
- "git" => PathLocator.Links.GitHub,
- "tg" => PathLocator.Links.Telegram,
- _ => PathLocator.Links.Steam
+ "git" => PathTargets.Links.GitHub,
+ "tg" => PathTargets.Links.Telegram,
+ _ => PathTargets.Links.Steam
})
{ UseShellExecute = true });
}
@@ -203,7 +203,7 @@ namespace GTweak.Windows
if (targetOffset != viewTop)
{
SetCurrentVerticalOffset(NavScroll, viewTop);
- NavScroll.BeginAnimation(CurrentVerticalOffsetProperty, FactoryAnimation.CreateIn(viewTop, targetOffset, 0.5, useCubicEase: true));
+ NavScroll.BeginAnimation(CurrentVerticalOffsetProperty, AnimationFactory.CreateIn(viewTop, targetOffset, 0.5, useCubicEase: true));
}
}
}), DispatcherPriority.Loaded);
@@ -213,7 +213,7 @@ namespace GTweak.Windows
private void BtnUpdate_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
- UpdateBanner.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(1, 0, 0.3, () => { UpdateBanner.Visibility = Visibility.Collapsed; }));
+ UpdateBanner.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(1, 0, 0.3, () => { UpdateBanner.Visibility = Visibility.Collapsed; }));
Dispatcher.Invoke(() => new UpdateWindow().ShowDialog());
}
@@ -229,15 +229,15 @@ namespace GTweak.Windows
{
TypewriterAnimation.Create(TitleName.Text, TitleName, TimeSpan.FromSeconds(0.4));
- if (NetworkProvider.IsNeedUpdate && SettingsEngine.IsUpdateCheckRequired)
+ if (NetworkProvider.IsNeedUpdate && GlobalOptions.IsUpdateCheckRequired)
{
await Task.Delay(500);
UpdateBanner.Visibility = Visibility.Visible;
- UpdateBanner.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.3));
+ UpdateBanner.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.3));
if (UpdateBanner.RenderTransform is TranslateTransform transform)
{
- transform.BeginAnimation(TranslateTransform.YProperty, FactoryAnimation.CreateIn(-20, 0, 0.3, () => { UpdateBanner.CacheMode = null; }, useCubicEase: true));
+ transform.BeginAnimation(TranslateTransform.YProperty, AnimationFactory.CreateIn(-20, 0, 0.3, () => { UpdateBanner.CacheMode = null; }, useCubicEase: true));
}
}
}
diff --git a/.Source/GTweak/Windows/MessageWindow.xaml.cs b/.Source/GTweak/Windows/MessageWindow.xaml.cs
index afc57457..d13f465a 100644
--- a/.Source/GTweak/Windows/MessageWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MessageWindow.xaml.cs
@@ -2,7 +2,7 @@ using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 5ece58d3..54314ae3 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -3,10 +3,10 @@ using System.Media;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Animations;
+using GTweak.Modules.Common;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -36,18 +36,18 @@ namespace GTweak.Windows
Unloaded += delegate { _timer.Stop(); };
Loaded += (s, e) =>
{
- if (SettingsEngine.IsPlayingSound)
+ if (GlobalOptions.IsPlayingSound)
{
using SoundPlayer notificationSound = new SoundPlayer(Properties.Resources.Sound);
notificationSound.Play();
}
- BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.2));
- BeginAnimation(LeftProperty, FactoryAnimation.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.35, () => { CacheMode = null; }, useCubicEase: true));
+ BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.2));
+ BeginAnimation(LeftProperty, AnimationFactory.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.35, () => { CacheMode = null; }, useCubicEase: true));
_timer = new TimerControlManager(TimeSpan.FromSeconds(3), TimerControlManager.TimerMode.CountDown, null, () => { Close(); });
_timer.Start();
- ProgressTimer.BeginAnimation(RangeBase.ValueProperty, FactoryAnimation.CreateIn(0, 100, 4.1));
+ ProgressTimer.BeginAnimation(RangeBase.ValueProperty, AnimationFactory.CreateIn(0, 100, 4.1));
};
}
diff --git a/.Source/GTweak/Windows/OverlayWindow.xaml.cs b/.Source/GTweak/Windows/OverlayWindow.xaml.cs
index a310e877..e7fa2937 100644
--- a/.Source/GTweak/Windows/OverlayWindow.xaml.cs
+++ b/.Source/GTweak/Windows/OverlayWindow.xaml.cs
@@ -2,8 +2,8 @@ using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Helpers;
+using GTweak.Animations;
+using GTweak.Modules.Helpers;
namespace GTweak.Windows
{
@@ -13,7 +13,7 @@ namespace GTweak.Windows
public partial class OverlayWindow
{
- private readonly DisablingWinKeys disablingWinKeys = new DisablingWinKeys();
+ private readonly KeyboardHookBlocker keyboardHook = new KeyboardHookBlocker();
public OverlayWindow()
{
InitializeComponent();
@@ -26,22 +26,22 @@ namespace GTweak.Windows
Closing -= Window_Closing;
e!.Cancel = true;
- if (disablingWinKeys.ptrHook != IntPtr.Zero)
+ if (keyboardHook.ptrHook != IntPtr.Zero)
{
- DisablingWinKeys.UnhookWindowsHookEx(disablingWinKeys.ptrHook);
- disablingWinKeys.ptrHook = IntPtr.Zero;
+ KeyboardHookBlocker.UnhookWindowsHookEx(keyboardHook.ptrHook);
+ keyboardHook.ptrHook = IntPtr.Zero;
}
- BeginAnimation(OpacityProperty, FactoryAnimation.CreateTo(0.15, () => { Close(); }));
+ BeginAnimation(OpacityProperty, AnimationFactory.CreateTo(0.15, () => { Close(); }));
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
- disablingWinKeys.objKeyboardProcess = new DisablingWinKeys.LowLevelKeyboardProc(disablingWinKeys.CaptureKey);
- disablingWinKeys.ptrHook = DisablingWinKeys.SetWindowsHookEx(13, disablingWinKeys.objKeyboardProcess, DisablingWinKeys.GetModuleHandle(objCurrentModule.ModuleName), 0);
- BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 0.5, 0.3));
+ keyboardHook.objKeyboardProcess = new KeyboardHookBlocker.LowLevelKeyboardProc(keyboardHook.CaptureKey);
+ keyboardHook.ptrHook = KeyboardHookBlocker.SetWindowsHookEx(13, keyboardHook.objKeyboardProcess, KeyboardHookBlocker.GetModuleHandle(objCurrentModule.ModuleName), 0);
+ BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 0.5, 0.3));
}
}
}
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index cc65dabc..68b80188 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -2,10 +2,10 @@ using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
+using GTweak.Modules.Common;
+using GTweak.Modules.Configuration;
+using GTweak.Modules.Helpers;
+using GTweak.Modules.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -42,9 +42,9 @@ namespace GTweak.Windows
};
webClient.DownloadFileCompleted += delegate
{
- CommandExecutor.RunCommand($"/c taskkill /f /im \"{SettingsEngine.CurrentName}\" && timeout /t 2 && del \"{SettingsEngine.CurrentLocation}\" && ren {tempFileName} \"{SettingsEngine.CurrentName}\" && \"{SettingsEngine.CurrentLocation}\"");
+ CommandExecutor.RunCommand($"/c taskkill /f /im \"{GlobalOptions.CurrentName}\" && timeout /t 2 && del \"{GlobalOptions.CurrentLocation}\" && ren {tempFileName} \"{GlobalOptions.CurrentName}\" && \"{GlobalOptions.CurrentLocation}\"");
};
- webClient.DownloadFileAsync(new Uri(PathLocator.Links.LatestUpdate.Resolved), tempFileName);
+ webClient.DownloadFileAsync(new Uri(PathTargets.Links.LatestUpdate.Resolved), tempFileName);
}
catch
{