2025-04-30 16:52:48 +02:00
|
|
|
using Microsoft.Win32;
|
|
|
|
|
using System;
|
|
|
|
|
using Crapfixer;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Settings.Privacy
|
|
|
|
|
{
|
|
|
|
|
public class Telemetry : FeatureBase
|
|
|
|
|
{
|
|
|
|
|
private const string dataCollection = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DataCollection";
|
|
|
|
|
private const string diagTrack = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DiagTrack";
|
|
|
|
|
|
|
|
|
|
public override string ID() => "Turn off Telemetry data collection";
|
|
|
|
|
|
|
|
|
|
public override string Info() => "This feature will turn off telemetry data collection and prevent the data from being sent to Microsoft.";
|
|
|
|
|
|
|
|
|
|
public override string GetFeatureDetails()
|
|
|
|
|
{
|
|
|
|
|
return $"{dataCollection} | {diagTrack}";
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-06 17:09:07 +02:00
|
|
|
public override Task<bool> CheckFeature()
|
2025-04-30 16:52:48 +02:00
|
|
|
{
|
2025-05-06 17:09:07 +02:00
|
|
|
return Task.FromResult(
|
2025-04-30 16:52:48 +02:00
|
|
|
Utils.IntEquals(dataCollection, "AllowTelemetry", 0) &&
|
2025-05-06 17:09:07 +02:00
|
|
|
Utils.IntEquals(diagTrack, "Start", 4)
|
2025-04-30 16:52:48 +02:00
|
|
|
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Task<bool> DoFeature()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Registry.SetValue(dataCollection, "AllowTelemetry", 0, RegistryValueKind.DWord);
|
2025-05-02 15:30:45 +02:00
|
|
|
Registry.SetValue(diagTrack, "Start", 4, RegistryValueKind.DWord);
|
2025-04-30 16:52:48 +02:00
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log("Code red in " + ex.Message, LogLevel.Error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Task.FromResult(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool UndoFeature()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Registry.SetValue(dataCollection, "AllowTelemetry", 1, RegistryValueKind.DWord);
|
2025-05-02 15:30:45 +02:00
|
|
|
Registry.SetValue(diagTrack, "Start", 2, RegistryValueKind.DWord);
|
2025-04-30 16:52:48 +02:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log("Code red in " + ex.Message, LogLevel.Error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|