diff --git a/src/Privatezilla.sln b/src/Privatezilla.sln new file mode 100644 index 0000000..86b0579 --- /dev/null +++ b/src/Privatezilla.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Privatezilla", "Privatezilla\Privatezilla.csproj", "{1CF5392E-0522-49D4-8343-B732BE762086}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1CF5392E-0522-49D4-8343-B732BE762086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CF5392E-0522-49D4-8343-B732BE762086}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CF5392E-0522-49D4-8343-B732BE762086}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CF5392E-0522-49D4-8343-B732BE762086}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E8CB191-75D5-4C79-A0FE-23D7D018C316} + EndGlobalSection +EndGlobal diff --git a/src/Privatezilla/App.config b/src/Privatezilla/App.config new file mode 100644 index 0000000..de27714 --- /dev/null +++ b/src/Privatezilla/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Privatezilla/Helpers/RegistryHelper.cs b/src/Privatezilla/Helpers/RegistryHelper.cs new file mode 100644 index 0000000..a0a19ac --- /dev/null +++ b/src/Privatezilla/Helpers/RegistryHelper.cs @@ -0,0 +1,44 @@ +using Microsoft.Win32; +using Privatezilla.Setting; +using System; +using System.Windows.Forms; + +namespace Privatezilla +{ + /// + /// Check whether Registry values equal + /// + internal class RegistryHelper + { + public SettingBase Setting { get; } + + public static bool IntEquals(string keyName, string valueName, int expectedValue) + { + try + { + var value = Registry.GetValue(keyName, valueName, null); + return (value != null && (int)value == expectedValue); + } + catch (Exception ex) + + { + MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK); + return false; + } + } + + public static bool StringEquals(string keyName, string valueName, string expectedValue) + { + try + { + var value = Registry.GetValue(keyName, valueName, null); + return (value != null && (string)value == expectedValue); + } + catch (Exception ex) + { + MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK); + return false; + } + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Helpers/SettingsNode.cs b/src/Privatezilla/Helpers/SettingsNode.cs new file mode 100644 index 0000000..fb0db14 --- /dev/null +++ b/src/Privatezilla/Helpers/SettingsNode.cs @@ -0,0 +1,19 @@ +using Privatezilla.Setting; +using System.Windows.Forms; + +namespace Privatezilla +{ + internal class SettingNode : TreeNode + { + public SettingBase Setting { get; } + + public SettingNode(SettingBase setting) + { + Setting = setting; + Text = Setting.ID(); + ToolTipText = Setting.Info(); + //Checked = true; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Helpers/SetttingsBase.cs b/src/Privatezilla/Helpers/SetttingsBase.cs new file mode 100644 index 0000000..08eea15 --- /dev/null +++ b/src/Privatezilla/Helpers/SetttingsBase.cs @@ -0,0 +1,35 @@ +namespace Privatezilla.Setting +{ + public abstract class SettingBase + { + /// + /// Name of setting + /// + /// The setting name + public abstract string ID(); + + /// + /// Tooltip text of setting + /// + /// The setting tooltip + public abstract string Info(); + + /// + /// Checks whether the setting should be applied + /// + /// Returns true if the setting should be applied, false otherwise. + public abstract bool CheckSetting(); + + /// + /// Applies the setting + /// + /// Returns true if the setting was successfull, false otherwise. + public abstract bool DoSetting(); + + /// + /// Revert the setting + /// + /// Returns true if the setting was successfull, false otherwise. + public abstract bool UndoSetting(); + } +} \ No newline at end of file diff --git a/src/Privatezilla/Helpers/WindowsHelper.cs b/src/Privatezilla/Helpers/WindowsHelper.cs new file mode 100644 index 0000000..3c46c15 --- /dev/null +++ b/src/Privatezilla/Helpers/WindowsHelper.cs @@ -0,0 +1,16 @@ +using Microsoft.Win32; + +namespace Privatezilla +{ + internal static class WindowsHelper + { + internal static string GetOS() + { + + string releaseID = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString(); + return releaseID; + + } + + } +} diff --git a/src/Privatezilla/Interfaces/IListView.cs b/src/Privatezilla/Interfaces/IListView.cs new file mode 100644 index 0000000..bcfc427 --- /dev/null +++ b/src/Privatezilla/Interfaces/IListView.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections; +using System.Windows.Forms; + +namespace Privatezilla +{ + /* Modified ListView sort example from https://support.microsoft.com/en-us/kb/319401 + which will not only sort ascending but both ways */ + + public class ListViewItemComparer : IComparer + { + private readonly int col; + private readonly bool bAsc = false; + + public ListViewItemComparer() + { + col = 0; + } + + public ListViewItemComparer(int column, bool b) + { + col = column; + bAsc = b; + } + + public int Compare(object x, object y) + { + if (bAsc) + { + return String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); + // bAsc = false; + } + else + { + return String.Compare(((ListViewItem)y).SubItems[col].Text, ((ListViewItem)x).SubItems[col].Text); + // bAsc = true; + } + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Interfaces/ITreeNode.cs b/src/Privatezilla/Interfaces/ITreeNode.cs new file mode 100644 index 0000000..92236d0 --- /dev/null +++ b/src/Privatezilla/Interfaces/ITreeNode.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace Privatezilla.ITreeNode +{ + public static class ITreeNode + { + // Retrieving TreeView nodes as IEnumerable + public static IEnumerable All(this TreeNodeCollection nodes) + { + if (nodes == null) throw new ArgumentNullException(nameof(nodes)); + + foreach (TreeNode n in nodes) + { + yield return n; + + foreach (TreeNode child in n.Nodes.All()) + { + yield return child; + } + } + } + } +} diff --git a/src/Privatezilla/MainWindow.Designer.cs b/src/Privatezilla/MainWindow.Designer.cs new file mode 100644 index 0000000..dfa75db --- /dev/null +++ b/src/Privatezilla/MainWindow.Designer.cs @@ -0,0 +1,612 @@ +namespace Privatezilla +{ + partial class MainWindow + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); + this.TvwSettings = new System.Windows.Forms.TreeView(); + this.LblMainMenu = new System.Windows.Forms.Button(); + this.MainMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.Help = new System.Windows.Forms.ToolStripMenuItem(); + this.CommunityPkg = new System.Windows.Forms.ToolStripMenuItem(); + this.CheckRelease = new System.Windows.Forms.ToolStripMenuItem(); + this.Info = new System.Windows.Forms.ToolStripMenuItem(); + this.PnlNav = new System.Windows.Forms.Panel(); + this.LblPS = new System.Windows.Forms.LinkLabel(); + this.LblSettings = new System.Windows.Forms.LinkLabel(); + this.LstPS = new System.Windows.Forms.CheckedListBox(); + this.PnlSettings = new System.Windows.Forms.Panel(); + this.PicOpenGitHubPage = new System.Windows.Forms.PictureBox(); + this.BtnSettingsUndo = new System.Windows.Forms.Button(); + this.LvwStatus = new System.Windows.Forms.ListView(); + this.Setting = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.State = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.PBar = new System.Windows.Forms.ProgressBar(); + this.BtnSettingsDo = new System.Windows.Forms.Button(); + this.BtnSettingsAnalyze = new System.Windows.Forms.Button(); + this.LblStatus = new System.Windows.Forms.Label(); + this.PnlPS = new System.Windows.Forms.Panel(); + this.BtnMenuPS = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.ChkCodePS = new System.Windows.Forms.CheckBox(); + this.BtnDoPS = new System.Windows.Forms.Button(); + this.TxtPSInfo = new System.Windows.Forms.TextBox(); + this.TxtConsolePS = new System.Windows.Forms.TextBox(); + this.TxtOutputPS = new System.Windows.Forms.TextBox(); + this.PSMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.PSImport = new System.Windows.Forms.ToolStripMenuItem(); + this.PSSaveAs = new System.Windows.Forms.ToolStripMenuItem(); + this.PSMarketplace = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.MainMenu.SuspendLayout(); + this.PnlNav.SuspendLayout(); + this.PnlSettings.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.PicOpenGitHubPage)).BeginInit(); + this.PnlPS.SuspendLayout(); + this.PSMenu.SuspendLayout(); + this.SuspendLayout(); + // + // TvwSettings + // + this.TvwSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.TvwSettings.BackColor = System.Drawing.Color.WhiteSmoke; + this.TvwSettings.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TvwSettings.CheckBoxes = true; + this.TvwSettings.Font = new System.Drawing.Font("Segoe UI Semilight", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TvwSettings.LineColor = System.Drawing.Color.DarkOrchid; + this.TvwSettings.Location = new System.Drawing.Point(12, 88); + this.TvwSettings.Name = "TvwSettings"; + this.TvwSettings.ShowLines = false; + this.TvwSettings.ShowNodeToolTips = true; + this.TvwSettings.ShowPlusMinus = false; + this.TvwSettings.Size = new System.Drawing.Size(355, 749); + this.TvwSettings.TabIndex = 18; + this.TvwSettings.TabStop = false; + this.TvwSettings.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.TvwSetting_AfterCheck); + // + // LblMainMenu + // + this.LblMainMenu.AutoSize = true; + this.LblMainMenu.BackColor = System.Drawing.Color.WhiteSmoke; + this.LblMainMenu.FlatAppearance.BorderColor = System.Drawing.Color.WhiteSmoke; + this.LblMainMenu.FlatAppearance.BorderSize = 0; + this.LblMainMenu.FlatAppearance.MouseOverBackColor = System.Drawing.Color.HotPink; + this.LblMainMenu.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.LblMainMenu.Font = new System.Drawing.Font("Segoe MDL2 Assets", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LblMainMenu.ForeColor = System.Drawing.Color.Black; + this.LblMainMenu.Location = new System.Drawing.Point(0, 0); + this.LblMainMenu.Name = "LblMainMenu"; + this.LblMainMenu.Size = new System.Drawing.Size(48, 51); + this.LblMainMenu.TabIndex = 21; + this.LblMainMenu.UseVisualStyleBackColor = false; + this.LblMainMenu.Click += new System.EventHandler(this.LblMainMenu_Click); + // + // MainMenu + // + this.MainMenu.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.MainMenu.ImageScalingSize = new System.Drawing.Size(18, 18); + this.MainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.Help, + this.CommunityPkg, + this.CheckRelease, + this.Info}); + this.MainMenu.Name = "MainMenu"; + this.MainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.MainMenu.Size = new System.Drawing.Size(271, 116); + // + // Help + // + this.Help.Font = new System.Drawing.Font("Segoe UI", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Help.Name = "Help"; + this.Help.Size = new System.Drawing.Size(270, 28); + this.Help.Text = "Short Guide"; + this.Help.Click += new System.EventHandler(this.Help_Click); + // + // CommunityPkg + // + this.CommunityPkg.Font = new System.Drawing.Font("Segoe UI", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CommunityPkg.Image = ((System.Drawing.Image)(resources.GetObject("CommunityPkg.Image"))); + this.CommunityPkg.Name = "CommunityPkg"; + this.CommunityPkg.Size = new System.Drawing.Size(270, 28); + this.CommunityPkg.Text = "Get community package"; + this.CommunityPkg.Click += new System.EventHandler(this.CommunityPkg_Click); + // + // CheckRelease + // + this.CheckRelease.Font = new System.Drawing.Font("Segoe UI", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CheckRelease.Name = "CheckRelease"; + this.CheckRelease.Size = new System.Drawing.Size(270, 28); + this.CheckRelease.Text = "Check for updates"; + this.CheckRelease.Click += new System.EventHandler(this.CheckRelease_Click); + // + // Info + // + this.Info.Font = new System.Drawing.Font("Segoe UI", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Info.Name = "Info"; + this.Info.Size = new System.Drawing.Size(270, 28); + this.Info.Text = "Info"; + this.Info.Click += new System.EventHandler(this.Info_Click); + // + // PnlNav + // + this.PnlNav.BackColor = System.Drawing.Color.WhiteSmoke; + this.PnlNav.Controls.Add(this.LblPS); + this.PnlNav.Controls.Add(this.LblSettings); + this.PnlNav.Controls.Add(this.LblMainMenu); + this.PnlNav.Controls.Add(this.TvwSettings); + this.PnlNav.Controls.Add(this.LstPS); + this.PnlNav.Dock = System.Windows.Forms.DockStyle.Left; + this.PnlNav.Location = new System.Drawing.Point(0, 0); + this.PnlNav.Name = "PnlNav"; + this.PnlNav.Size = new System.Drawing.Size(367, 837); + this.PnlNav.TabIndex = 26; + // + // LblPS + // + this.LblPS.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.LblPS.AutoEllipsis = true; + this.LblPS.AutoSize = true; + this.LblPS.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LblPS.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.LblPS.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.LblPS.LinkColor = System.Drawing.Color.Black; + this.LblPS.Location = new System.Drawing.Point(104, 54); + this.LblPS.Name = "LblPS"; + this.LblPS.Size = new System.Drawing.Size(60, 21); + this.LblPS.TabIndex = 25; + this.LblPS.TabStop = true; + this.LblPS.Text = "Scripts"; + this.LblPS.Visible = false; + this.LblPS.VisitedLinkColor = System.Drawing.Color.DimGray; + this.LblPS.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LblPS_LinkClicked); + // + // LblSettings + // + this.LblSettings.ActiveLinkColor = System.Drawing.Color.DeepPink; + this.LblSettings.AutoEllipsis = true; + this.LblSettings.AutoSize = true; + this.LblSettings.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LblSettings.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.LblSettings.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.LblSettings.LinkColor = System.Drawing.Color.Black; + this.LblSettings.Location = new System.Drawing.Point(12, 54); + this.LblSettings.Name = "LblSettings"; + this.LblSettings.Size = new System.Drawing.Size(70, 21); + this.LblSettings.TabIndex = 24; + this.LblSettings.TabStop = true; + this.LblSettings.Text = "Settings"; + this.LblSettings.VisitedLinkColor = System.Drawing.Color.DimGray; + this.LblSettings.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LblSettings_LinkClicked); + // + // LstPS + // + this.LstPS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.LstPS.BackColor = System.Drawing.Color.WhiteSmoke; + this.LstPS.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.LstPS.Font = new System.Drawing.Font("Segoe UI Semilight", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LstPS.ForeColor = System.Drawing.Color.Black; + this.LstPS.FormattingEnabled = true; + this.LstPS.Location = new System.Drawing.Point(16, 88); + this.LstPS.Name = "LstPS"; + this.LstPS.Size = new System.Drawing.Size(351, 700); + this.LstPS.Sorted = true; + this.LstPS.TabIndex = 112; + this.LstPS.ThreeDCheckBoxes = true; + this.LstPS.Visible = false; + this.LstPS.SelectedIndexChanged += new System.EventHandler(this.LstPS_SelectedIndexChanged); + // + // PnlSettings + // + this.PnlSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PnlSettings.Controls.Add(this.PicOpenGitHubPage); + this.PnlSettings.Controls.Add(this.BtnSettingsUndo); + this.PnlSettings.Controls.Add(this.LvwStatus); + this.PnlSettings.Controls.Add(this.PBar); + this.PnlSettings.Controls.Add(this.BtnSettingsDo); + this.PnlSettings.Controls.Add(this.BtnSettingsAnalyze); + this.PnlSettings.Controls.Add(this.LblStatus); + this.PnlSettings.Location = new System.Drawing.Point(366, 0); + this.PnlSettings.Name = "PnlSettings"; + this.PnlSettings.Size = new System.Drawing.Size(716, 837); + this.PnlSettings.TabIndex = 113; + // + // PicOpenGitHubPage + // + this.PicOpenGitHubPage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.PicOpenGitHubPage.Cursor = System.Windows.Forms.Cursors.Hand; + this.PicOpenGitHubPage.Image = ((System.Drawing.Image)(resources.GetObject("PicOpenGitHubPage.Image"))); + this.PicOpenGitHubPage.Location = new System.Drawing.Point(681, 7); + this.PicOpenGitHubPage.Name = "PicOpenGitHubPage"; + this.PicOpenGitHubPage.Size = new System.Drawing.Size(24, 24); + this.PicOpenGitHubPage.TabIndex = 32; + this.PicOpenGitHubPage.TabStop = false; + this.ToolTip.SetToolTip(this.PicOpenGitHubPage, "github/privatezilla"); + this.PicOpenGitHubPage.Click += new System.EventHandler(this.PicOpenGitHubPage_Click); + // + // BtnSettingsUndo + // + this.BtnSettingsUndo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.BtnSettingsUndo.BackColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsUndo.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsUndo.FlatAppearance.BorderSize = 0; + this.BtnSettingsUndo.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.BtnSettingsUndo.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.BtnSettingsUndo.Location = new System.Drawing.Point(298, 794); + this.BtnSettingsUndo.Name = "BtnSettingsUndo"; + this.BtnSettingsUndo.Size = new System.Drawing.Size(196, 32); + this.BtnSettingsUndo.TabIndex = 30; + this.BtnSettingsUndo.Text = "Revert selected"; + this.BtnSettingsUndo.UseVisualStyleBackColor = false; + this.BtnSettingsUndo.Click += new System.EventHandler(this.BtnSettingsUndo_Click); + // + // LvwStatus + // + this.LvwStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.LvwStatus.BackColor = System.Drawing.Color.White; + this.LvwStatus.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.LvwStatus.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.Setting, + this.State}); + this.LvwStatus.Font = new System.Drawing.Font("Segoe UI Semilight", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LvwStatus.FullRowSelect = true; + this.LvwStatus.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.LvwStatus.HideSelection = false; + this.LvwStatus.Location = new System.Drawing.Point(9, 50); + this.LvwStatus.Name = "LvwStatus"; + this.LvwStatus.Size = new System.Drawing.Size(704, 723); + this.LvwStatus.TabIndex = 31; + this.LvwStatus.TileSize = new System.Drawing.Size(1, 1); + this.LvwStatus.UseCompatibleStateImageBehavior = false; + this.LvwStatus.View = System.Windows.Forms.View.Details; + this.LvwStatus.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.LvwStatus_ColumnClick); + // + // Setting + // + this.Setting.Text = "Setting"; + this.Setting.Width = 550; + // + // State + // + this.State.Text = "State"; + this.State.Width = 150; + // + // PBar + // + this.PBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PBar.Location = new System.Drawing.Point(12, 41); + this.PBar.Name = "PBar"; + this.PBar.Size = new System.Drawing.Size(814, 5); + this.PBar.TabIndex = 27; + this.PBar.Visible = false; + // + // BtnSettingsDo + // + this.BtnSettingsDo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.BtnSettingsDo.BackColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsDo.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsDo.FlatAppearance.BorderSize = 0; + this.BtnSettingsDo.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.BtnSettingsDo.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.BtnSettingsDo.Location = new System.Drawing.Point(509, 794); + this.BtnSettingsDo.Name = "BtnSettingsDo"; + this.BtnSettingsDo.Size = new System.Drawing.Size(196, 32); + this.BtnSettingsDo.TabIndex = 26; + this.BtnSettingsDo.Text = "Apply selected"; + this.BtnSettingsDo.UseVisualStyleBackColor = false; + this.BtnSettingsDo.Click += new System.EventHandler(this.BtnSettingsDo_Click); + // + // BtnSettingsAnalyze + // + this.BtnSettingsAnalyze.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.BtnSettingsAnalyze.BackColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsAnalyze.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro; + this.BtnSettingsAnalyze.FlatAppearance.BorderSize = 0; + this.BtnSettingsAnalyze.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.BtnSettingsAnalyze.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.BtnSettingsAnalyze.Location = new System.Drawing.Point(13, 794); + this.BtnSettingsAnalyze.Name = "BtnSettingsAnalyze"; + this.BtnSettingsAnalyze.Size = new System.Drawing.Size(196, 32); + this.BtnSettingsAnalyze.TabIndex = 28; + this.BtnSettingsAnalyze.Text = "Analyze"; + this.BtnSettingsAnalyze.UseVisualStyleBackColor = false; + this.BtnSettingsAnalyze.Click += new System.EventHandler(this.BtnSettingsAnalyze_Click); + // + // LblStatus + // + this.LblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.LblStatus.AutoEllipsis = true; + this.LblStatus.BackColor = System.Drawing.Color.White; + this.LblStatus.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LblStatus.Location = new System.Drawing.Point(9, 7); + this.LblStatus.Name = "LblStatus"; + this.LblStatus.Size = new System.Drawing.Size(704, 40); + this.LblStatus.TabIndex = 29; + this.LblStatus.Text = "Press Analyze to check for configured settings."; + // + // PnlPS + // + this.PnlPS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PnlPS.BackColor = System.Drawing.Color.White; + this.PnlPS.Controls.Add(this.BtnMenuPS); + this.PnlPS.Controls.Add(this.label1); + this.PnlPS.Controls.Add(this.ChkCodePS); + this.PnlPS.Controls.Add(this.BtnDoPS); + this.PnlPS.Controls.Add(this.TxtPSInfo); + this.PnlPS.Controls.Add(this.TxtConsolePS); + this.PnlPS.Controls.Add(this.TxtOutputPS); + this.PnlPS.Location = new System.Drawing.Point(366, 0); + this.PnlPS.Name = "PnlPS"; + this.PnlPS.Size = new System.Drawing.Size(716, 837); + this.PnlPS.TabIndex = 113; + this.PnlPS.Visible = false; + // + // BtnMenuPS + // + this.BtnMenuPS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.BtnMenuPS.BackColor = System.Drawing.Color.Gainsboro; + this.BtnMenuPS.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro; + this.BtnMenuPS.FlatAppearance.BorderSize = 0; + this.BtnMenuPS.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Silver; + this.BtnMenuPS.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.BtnMenuPS.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.BtnMenuPS.ForeColor = System.Drawing.Color.Black; + this.BtnMenuPS.Location = new System.Drawing.Point(671, 0); + this.BtnMenuPS.Name = "BtnMenuPS"; + this.BtnMenuPS.Size = new System.Drawing.Size(45, 45); + this.BtnMenuPS.TabIndex = 118; + this.BtnMenuPS.Text = ". . ."; + this.BtnMenuPS.UseVisualStyleBackColor = false; + this.BtnMenuPS.Click += new System.EventHandler(this.BtnMenuPS_Click); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.BackColor = System.Drawing.Color.Gainsboro; + this.label1.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); + this.label1.Size = new System.Drawing.Size(716, 45); + this.label1.TabIndex = 116; + this.label1.Text = "Apply PowerShell Script"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // ChkCodePS + // + this.ChkCodePS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.ChkCodePS.Appearance = System.Windows.Forms.Appearance.Button; + this.ChkCodePS.BackColor = System.Drawing.Color.Gainsboro; + this.ChkCodePS.FlatAppearance.BorderColor = System.Drawing.Color.Black; + this.ChkCodePS.FlatAppearance.BorderSize = 0; + this.ChkCodePS.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.ChkCodePS.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ChkCodePS.ForeColor = System.Drawing.Color.Black; + this.ChkCodePS.Location = new System.Drawing.Point(13, 794); + this.ChkCodePS.Margin = new System.Windows.Forms.Padding(2); + this.ChkCodePS.Name = "ChkCodePS"; + this.ChkCodePS.Size = new System.Drawing.Size(196, 32); + this.ChkCodePS.TabIndex = 113; + this.ChkCodePS.Text = "View code"; + this.ChkCodePS.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.ChkCodePS.UseVisualStyleBackColor = false; + this.ChkCodePS.CheckedChanged += new System.EventHandler(this.ChkCodePS_CheckedChanged); + // + // BtnDoPS + // + this.BtnDoPS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.BtnDoPS.BackColor = System.Drawing.Color.Gainsboro; + this.BtnDoPS.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro; + this.BtnDoPS.FlatAppearance.BorderSize = 0; + this.BtnDoPS.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.BtnDoPS.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.BtnDoPS.Location = new System.Drawing.Point(509, 794); + this.BtnDoPS.Name = "BtnDoPS"; + this.BtnDoPS.Size = new System.Drawing.Size(196, 32); + this.BtnDoPS.TabIndex = 112; + this.BtnDoPS.Text = "Apply selected"; + this.BtnDoPS.UseVisualStyleBackColor = false; + this.BtnDoPS.Click += new System.EventHandler(this.BtnDoPS_Click); + // + // TxtPSInfo + // + this.TxtPSInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.TxtPSInfo.BackColor = System.Drawing.Color.White; + this.TxtPSInfo.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TxtPSInfo.Font = new System.Drawing.Font("Segoe UI Semilight", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TxtPSInfo.ForeColor = System.Drawing.Color.Black; + this.TxtPSInfo.Location = new System.Drawing.Point(3, 48); + this.TxtPSInfo.Multiline = true; + this.TxtPSInfo.Name = "TxtPSInfo"; + this.TxtPSInfo.ReadOnly = true; + this.TxtPSInfo.Size = new System.Drawing.Size(238, 778); + this.TxtPSInfo.TabIndex = 110; + this.TxtPSInfo.Text = resources.GetString("TxtPSInfo.Text"); + // + // TxtConsolePS + // + this.TxtConsolePS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TxtConsolePS.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.TxtConsolePS.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.FileSystem; + this.TxtConsolePS.BackColor = System.Drawing.Color.PaleTurquoise; + this.TxtConsolePS.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TxtConsolePS.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TxtConsolePS.ForeColor = System.Drawing.Color.Black; + this.TxtConsolePS.Location = new System.Drawing.Point(242, 48); + this.TxtConsolePS.Multiline = true; + this.TxtConsolePS.Name = "TxtConsolePS"; + this.TxtConsolePS.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.TxtConsolePS.Size = new System.Drawing.Size(474, 740); + this.TxtConsolePS.TabIndex = 111; + this.TxtConsolePS.Visible = false; + this.TxtConsolePS.WordWrap = false; + // + // TxtOutputPS + // + this.TxtOutputPS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TxtOutputPS.BackColor = System.Drawing.Color.White; + this.TxtOutputPS.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.TxtOutputPS.Font = new System.Drawing.Font("Consolas", 9F); + this.TxtOutputPS.ForeColor = System.Drawing.Color.Black; + this.TxtOutputPS.Location = new System.Drawing.Point(242, 48); + this.TxtOutputPS.Multiline = true; + this.TxtOutputPS.Name = "TxtOutputPS"; + this.TxtOutputPS.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.TxtOutputPS.Size = new System.Drawing.Size(474, 740); + this.TxtOutputPS.TabIndex = 10; + this.TxtOutputPS.Text = "PS"; + this.TxtOutputPS.WordWrap = false; + // + // PSMenu + // + this.PSMenu.BackColor = System.Drawing.Color.WhiteSmoke; + this.PSMenu.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold); + this.PSMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.PSImport, + this.PSSaveAs, + this.PSMarketplace}); + this.PSMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Table; + this.PSMenu.Name = "contextHostsMenu"; + this.PSMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.PSMenu.Size = new System.Drawing.Size(353, 82); + // + // PSImport + // + this.PSImport.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.PSImport.Name = "PSImport"; + this.PSImport.Size = new System.Drawing.Size(352, 26); + this.PSImport.Text = "Import script"; + this.PSImport.Click += new System.EventHandler(this.PSImport_Click); + // + // PSSaveAs + // + this.PSSaveAs.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.PSSaveAs.Name = "PSSaveAs"; + this.PSSaveAs.Size = new System.Drawing.Size(352, 26); + this.PSSaveAs.Text = "Save current script as new preset script"; + this.PSSaveAs.Click += new System.EventHandler(this.PSSaveAs_Click); + // + // PSMarketplace + // + this.PSMarketplace.BackColor = System.Drawing.Color.Transparent; + this.PSMarketplace.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.PSMarketplace.ForeColor = System.Drawing.Color.Black; + this.PSMarketplace.Image = ((System.Drawing.Image)(resources.GetObject("PSMarketplace.Image"))); + this.PSMarketplace.Name = "PSMarketplace"; + this.PSMarketplace.Size = new System.Drawing.Size(352, 26); + this.PSMarketplace.Text = "Visit Marketplace"; + this.PSMarketplace.Click += new System.EventHandler(this.PSMarketplace_Click); + // + // ToolTip + // + this.ToolTip.AutomaticDelay = 0; + this.ToolTip.UseAnimation = false; + this.ToolTip.UseFading = false; + // + // MainWindow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1083, 837); + this.Controls.Add(this.PnlNav); + this.Controls.Add(this.PnlSettings); + this.Controls.Add(this.PnlPS); + this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.MinimumSize = new System.Drawing.Size(1019, 550); + this.Name = "MainWindow"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Privatezilla"; + this.MainMenu.ResumeLayout(false); + this.PnlNav.ResumeLayout(false); + this.PnlNav.PerformLayout(); + this.PnlSettings.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.PicOpenGitHubPage)).EndInit(); + this.PnlPS.ResumeLayout(false); + this.PnlPS.PerformLayout(); + this.PSMenu.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.TreeView TvwSettings; + private System.Windows.Forms.Button LblMainMenu; + private System.Windows.Forms.ContextMenuStrip MainMenu; + private System.Windows.Forms.ToolStripMenuItem Info; + private System.Windows.Forms.ToolStripMenuItem CheckRelease; + private System.Windows.Forms.ToolStripMenuItem Help; + private System.Windows.Forms.Panel PnlNav; + private System.Windows.Forms.LinkLabel LblSettings; + private System.Windows.Forms.LinkLabel LblPS; + private System.Windows.Forms.CheckedListBox LstPS; + private System.Windows.Forms.Panel PnlSettings; + private System.Windows.Forms.ListView LvwStatus; + private System.Windows.Forms.ColumnHeader Setting; + private System.Windows.Forms.ColumnHeader State; + private System.Windows.Forms.Button BtnSettingsUndo; + private System.Windows.Forms.ProgressBar PBar; + private System.Windows.Forms.Label LblStatus; + private System.Windows.Forms.Button BtnSettingsDo; + private System.Windows.Forms.Button BtnSettingsAnalyze; + private System.Windows.Forms.Panel PnlPS; + private System.Windows.Forms.TextBox TxtPSInfo; + private System.Windows.Forms.TextBox TxtOutputPS; + private System.Windows.Forms.TextBox TxtConsolePS; + private System.Windows.Forms.CheckBox ChkCodePS; + private System.Windows.Forms.Button BtnDoPS; + private System.Windows.Forms.ContextMenuStrip PSMenu; + private System.Windows.Forms.ToolStripMenuItem PSImport; + private System.Windows.Forms.ToolStripMenuItem PSSaveAs; + private System.Windows.Forms.ToolStripMenuItem PSMarketplace; + private System.Windows.Forms.ToolStripMenuItem CommunityPkg; + private System.Windows.Forms.ToolTip ToolTip; + private System.Windows.Forms.Button BtnMenuPS; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox PicOpenGitHubPage; + } +} + diff --git a/src/Privatezilla/MainWindow.cs b/src/Privatezilla/MainWindow.cs new file mode 100644 index 0000000..736eefa --- /dev/null +++ b/src/Privatezilla/MainWindow.cs @@ -0,0 +1,751 @@ +using Privatezilla.ITreeNode; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Net; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Privatezilla +{ + public partial class MainWindow : Form + { + private readonly string _successApply = "Applied"; + private readonly string _failedApply = "Not applied"; + private readonly string _successConfigure = "Configured"; + private readonly string _failedConfigure = "Not configured"; + private readonly string _finishApply = "Applying complete."; + private readonly string _finishUndo = "Reverting complete."; + private readonly string _finishAnalyze = "Analysis complete."; + private readonly string _doWait = "Please wait ..."; + private readonly string _undoSettings = "Do you really want to revert all selected settings to Windows 10 default state?"; + + private readonly string _helpApp = "Info about a setting:\nMove the cursor over a setting to view a brief explanation." + + "\r\n\nAnalyze (Button):\nDetermines which settings are enabled and configured on your system or not. NO system changes are done yet!" + + "\r\n\nApply selected (Button):\nThis will enable all selected settings." + + "\r\n\nRevert selected (Button):\nThis will restore the default Windows 10 settings." + + "\r\n\nConfigured (State):\nThis indicates your privacy is protected." + + "\r\n\nNot Configured (State):\nThis indicates that the Windows 10 settings are in place."; + + // Script strings (optional) + private readonly string _psSelect = "Please select a script."; + + private readonly string _psInfo = "What does this template/script do?\r\n\n"; + private readonly string _psSuccess = "has been successfully executed."; + private readonly string _psSave = "Please switch to code view."; + + // Setting progress + private int _progress = 0; + + private int _progressIncrement = 0; + + // Update + private readonly string _releaseURL = "https://raw.githubusercontent.com/builtbybel/privatezilla/master/latest.txt"; + + private readonly string _releaseUpToDate = "There are currently no updates available."; + private readonly string _releaseUnofficial = "You are using an unoffical version of Privatezilla."; + + public Version CurrentVersion = new Version(Application.ProductVersion); + public Version LatestVersion; + + public MainWindow() + { + InitializeComponent(); + + // Initilize settings + InitializeGPO(); + + // Check if community package is installed + CommunityPackageAvailable(); + + // GUI options + LblMainMenu.Text = "\ue700"; // Hamburger menu + } + + public void InitializeGPO() + { + TvwSettings.Nodes.Clear(); + + // Root node + TreeNode root = new TreeNode("Windows 10 (" + WindowsHelper.GetOS() + ")") + { + Checked = false + }; + + // Settings > Privacy + TreeNode privacy = new TreeNode("Privacy", new TreeNode[] { + new SettingNode(new Setting.Privacy.DisableTelemetry()), + new SettingNode(new Setting.Privacy.DisableCompTelemetry()), + new SettingNode(new Setting.Privacy.DisableAds()), + new SettingNode(new Setting.Privacy.DisableWiFi()), + new SettingNode(new Setting.Privacy.DiagnosticData()), + new SettingNode(new Setting.Privacy.HandwritingData()), + new SettingNode(new Setting.Privacy.DisableBiometrics()), + new SettingNode(new Setting.Privacy.DisableTimeline()), + new SettingNode(new Setting.Privacy.DisableLocation()), + new SettingNode(new Setting.Privacy.DisableFeedback()), + new SettingNode(new Setting.Privacy.DisableTips()), + new SettingNode(new Setting.Privacy.DisableTipsLockScreen()), + new SettingNode(new Setting.Privacy.InstalledApps()), + new SettingNode(new Setting.Privacy.SuggestedApps()), + new SettingNode(new Setting.Privacy.SuggestedContent()), + new SettingNode(new Setting.Privacy.DisableCEIP()), + new SettingNode(new Setting.Privacy.DisableHEIP()), + new SettingNode(new Setting.Privacy.DisableMSExperiments()), + new SettingNode(new Setting.Privacy.InventoryCollector()), + new SettingNode(new Setting.Privacy.GetMoreOutOfWindows()), + }) + { + //Checked = true, + //ToolTipText = "Privacy settings" + }; + + // Policies > Cortana + TreeNode cortana = new TreeNode("Cortana", new TreeNode[] { + new SettingNode(new Setting.Cortana.DisableCortana()), + new SettingNode(new Setting.Cortana.DisableBing()), + new SettingNode(new Setting.Cortana.UninstallCortana()), + }); + + // Settings > Bloatware + TreeNode bloatware = new TreeNode("Bloatware", new TreeNode[] { + new SettingNode(new Setting.Bloatware.RemoveUWPAll()), + new SettingNode(new Setting.Bloatware.RemoveUWPDefaults()), + }) + { + ToolTipText = "Debloat Windows 10" + }; + + // Settings > App permissions + TreeNode apps = new TreeNode("App permissions", new TreeNode[] { + new SettingNode(new Setting.Apps.AppNotifications()), + new SettingNode(new Setting.Apps.Camera()), + new SettingNode(new Setting.Apps.Microphone()), + new SettingNode(new Setting.Apps.Call()), + new SettingNode(new Setting.Apps.Notifications()), + new SettingNode(new Setting.Apps.AccountInfo()), + new SettingNode(new Setting.Apps.Contacts()), + new SettingNode(new Setting.Apps.Calendar()), + new SettingNode(new Setting.Apps.CallHistory()), + new SettingNode(new Setting.Apps.Email()), + new SettingNode(new Setting.Apps.Tasks()), + new SettingNode(new Setting.Apps.Messaging()), + new SettingNode(new Setting.Apps.Motion()), + new SettingNode(new Setting.Apps.OtherDevices()), + new SettingNode(new Setting.Apps.BackgroundApps()), + new SettingNode(new Setting.Apps.TrackingApps()), + new SettingNode(new Setting.Apps.DiagnosticInformation()), + new SettingNode(new Setting.Apps.Documents()), + new SettingNode(new Setting.Apps.Pictures()), + new SettingNode(new Setting.Apps.Videos()), + new SettingNode(new Setting.Apps.Radios()), + new SettingNode(new Setting.Apps.FileSystem()), + new SettingNode(new Setting.Apps.EyeGaze()), + new SettingNode(new Setting.Apps.CellularData()), + }); + + // Settings > Updates + TreeNode updates = new TreeNode("Updates", new TreeNode[] { + new SettingNode(new Setting.Updates.DisableUpdates()), + new SettingNode(new Setting.Updates.DisableUpdatesSharing()), + new SettingNode(new Setting.Updates.BlockMajorUpdates()), + }); + + // Settings > Gaming + TreeNode gaming = new TreeNode("Gaming", new TreeNode[] { + new SettingNode(new Setting.Gaming.DisableGameBar()), + }); + + // Settings > Windows Defender + TreeNode defender = new TreeNode("Windows Defender", new TreeNode[] { + new SettingNode(new Setting.Defender.DisableSmartScreenStore()), + }); + + // Settings > Microsoft Edge + TreeNode edge = new TreeNode("Microsoft Edge", new TreeNode[] { + new SettingNode(new Setting.Edge.DisableAutoFillCredits()), + new SettingNode(new Setting.Edge.EdgeBackground()), + new SettingNode(new Setting.Edge.DisableSync()), + new SettingNode(new Setting.Edge.BlockEdgeRollout()), + }); + + // Settings > Security + TreeNode security = new TreeNode("Security", new TreeNode[] { + new SettingNode(new Setting.Security.DisablePassword()), + new SettingNode(new Setting.Security.WindowsDRM()), + }); + + // Add root nodes + root.Nodes.AddRange(new TreeNode[] + { + privacy, + cortana, + bloatware, + apps, + updates, + gaming, + defender, + edge, + security, + }); + + TvwSettings.Nodes.Add(root); + TvwSettings.ExpandAll(); + + // Preselect nodes + CheckNodes(privacy); + + // Set up ToolTip text for TvwSettings + ToolTip tooltip = new ToolTip(); + tooltip.AutoPopDelay = 15000; + tooltip.IsBalloon = true; + tooltip.SetToolTip(this.TvwSettings, "Settings"); + } + + private List CollectSettingNodes() + { + List selectedSettings = new List(); + + foreach (TreeNode treeNode in TvwSettings.Nodes.All()) + { + if (treeNode.Checked && treeNode.GetType() == typeof(SettingNode)) + { + selectedSettings.Add((SettingNode)treeNode); + } + } + + _progressIncrement = (int)Math.Floor(100.0f / selectedSettings.Count); + + return selectedSettings; + } + + private void Reset() + { + _progress = 0; + _progressIncrement = 0; + + PBar.Visible = true; + PBar.Value = 0; + LvwStatus.HeaderStyle = ColumnHeaderStyle.Clickable; // Add Header to ListView + LvwStatus.Items.Clear(); + LvwStatus.Refresh(); + } + + private void IncrementProgress() + { + _progress += _progressIncrement; + PBar.Value = _progress; + } + + private void DoProgress(int value) + { + _progress = value; + PBar.Value = _progress; + } + + // Check favored parent node including all child nodes + public void CheckNodes(TreeNode startNode) + { + startNode.Checked = true; + + foreach (TreeNode node in startNode.Nodes) + + CheckNodes(node); + } + + /// + /// Auto check child nodes when parent node is checked + /// + private void TvwSetting_AfterCheck(object sender, TreeViewEventArgs e) + { + TvwSettings.BeginUpdate(); + + foreach (TreeNode child in e.Node.Nodes) + { + child.Checked = e.Node.Checked; + } + + TvwSettings.EndUpdate(); + } + + /// + /// Method to auto. resize column and set the width to the width of the last item in ListView + /// + private void ResizeListViewColumns(ListView lv) + { + foreach (ColumnHeader column in lv.Columns) + { + column.Width = -2; + } + } + + /// + /// Check system for configured settings + /// + private async void BtnSettingsAnalyze_Click(object sender, EventArgs e) + { + Reset(); + LblStatus.Text = _doWait; + BtnSettingsAnalyze.Enabled = false; + + LvwStatus.BeginUpdate(); + + List selectedSettings = CollectSettingNodes(); + + foreach (SettingNode node in selectedSettings) + { + var setting = node.Setting; + ListViewItem state = new ListViewItem(node.Parent.Text + ": " + setting.ID()); + ConfiguredTaskAwaitable analyzeTask = Task.Factory.StartNew(() => setting.CheckSetting()).ConfigureAwait(true); + + bool shouldPerform = await analyzeTask; + + if (shouldPerform) + { + state.SubItems.Add(_failedConfigure); + state.BackColor = Color.LavenderBlush; + } + else + { + state.SubItems.Add(_successConfigure); + state.BackColor = Color.Honeydew; + } + + state.Tag = setting; + LvwStatus.Items.Add(state); + IncrementProgress(); + } + + DoProgress(100); + + // Summary + LblStatus.Text = _finishAnalyze; + BtnSettingsAnalyze.Enabled = true; + LvwStatus.EndUpdate(); + + ResizeListViewColumns(LvwStatus); + } + + /// + /// Apply selected settings + /// + /// + private async void ApplySettings(List treeNodes) + { + BtnSettingsDo.Enabled = false; + LvwStatus.BeginUpdate(); + + foreach (SettingNode node in treeNodes) + { + // Add status info + LblStatus.Text = _doWait + " (" + node.Text + ")"; + + var setting = node.Setting; + ConfiguredTaskAwaitable performTask = Task.Factory.StartNew(() => setting.DoSetting()).ConfigureAwait(true); + + var result = await performTask; + + var listItem = new ListViewItem(setting.ID()); + if (result) + { + listItem.SubItems.Add(_successApply); + listItem.BackColor = Color.Honeydew; + } + else + { + listItem.SubItems.Add(_failedApply); + listItem.BackColor = Color.LavenderBlush; + } + + LvwStatus.Items.Add(listItem); + IncrementProgress(); + } + + DoProgress(100); + + LblStatus.Text = _finishApply; + BtnSettingsDo.Enabled = true; + LvwStatus.EndUpdate(); + + ResizeListViewColumns(LvwStatus); + } + + /// + /// Revert selected settings + /// + private async void UndoSettings(List treeNodes) + { + LblStatus.Text = _doWait; + BtnSettingsUndo.Enabled = false; + LvwStatus.BeginUpdate(); + + foreach (SettingNode node in treeNodes) + { + var setting = node.Setting; + ConfiguredTaskAwaitable performTask = Task.Factory.StartNew(() => setting.UndoSetting()).ConfigureAwait(true); + + var result = await performTask; + + var listItem = new ListViewItem(setting.ID()); + if (result) + { + listItem.SubItems.Add(_successApply); + listItem.BackColor = Color.Honeydew; + } + else + { + listItem.SubItems.Add(_failedApply); + listItem.BackColor = Color.LavenderBlush; + } + + LvwStatus.Items.Add(listItem); + IncrementProgress(); + } + + DoProgress(100); + + LblStatus.Text = _finishUndo; + BtnSettingsUndo.Enabled = true; + LvwStatus.EndUpdate(); + + ResizeListViewColumns(LvwStatus); + } + + private void BtnSettingsDo_Click(object sender, EventArgs e) + { + Reset(); + + List performNodes = CollectSettingNodes(); + ApplySettings(performNodes); + } + + private void BtnSettingsUndo_Click(object sender, EventArgs e) + { + if (MessageBox.Show(_undoSettings, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) + { + Reset(); + + List performNodes = CollectSettingNodes(); + UndoSettings(performNodes); + } + } + + private void Info_Click(object sender, EventArgs e) + { + MessageBox.Show("Privatezilla" + "\nVersion " + Program.GetCurrentVersionTostring() + " (Phoenix)" + + "\n\nThe open source Windows 10 privacy settings app.\n\nThis is in no way related to Microsoft and a completely independent project.\r\n\n" + + "All infos and credits about this project on\n" + + "\tgithub.com/builtbybel/privatezilla\r\n\n" + + "You can also follow me on\n" + + "\ttwitter.com/builtbybel\r\n\n" + + "(C#) 2020, Builtbybel", + "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void LblMainMenu_Click(object sender, EventArgs e) + { + this.MainMenu.Show(Cursor.Position.X, Cursor.Position.Y); + } + + private void CheckRelease_Click(object sender, EventArgs e) + { + try + { + WebRequest hreq = WebRequest.Create(_releaseURL); + hreq.Timeout = 10000; + hreq.Headers.Set("Cache-Control", "no-cache, no-store, must-revalidate"); + + WebResponse hres = hreq.GetResponse(); + StreamReader sr = new StreamReader(hres.GetResponseStream()); + + LatestVersion = new Version(sr.ReadToEnd().Trim()); + + // Done and dispose! + sr.Dispose(); + hres.Dispose(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); // Update check failed! + } + + var equals = LatestVersion.CompareTo(CurrentVersion); + + if (equals == 0) + { + MessageBox.Show(_releaseUpToDate, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // Up-to-date + } + else if (equals < 0) + { + MessageBox.Show(_releaseUnofficial, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); // Unofficial + } + else // New release available! + { + if (MessageBox.Show("There is a new version available #" + LatestVersion + "\nYour are using version #" + CurrentVersion + "\n\nDo you want to open the @github/releases page?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) // New release available! + { + Process.Start("https://github.com/builtbybel/privatezilla/releases/tag/" + LatestVersion); + } + } + } + + private void Help_Click(object sender, EventArgs e) + { + MessageBox.Show(_helpApp, Help.Text, MessageBoxButtons.OK, MessageBoxIcon.Question); + } + + /// + /// Populate Setting files to Navigation > settings > LstPopulatePS + /// + private void PopulatePS() + { + // Switch to More + PnlPS.Visible = true; + LstPS.Visible = true; + + PnlSettings.Visible = false; + TvwSettings.Visible = false; + + // Clear list + LstPS.Items.Clear(); + + DirectoryInfo dirs = new DirectoryInfo(@"scripts"); + FileInfo[] listSettings = dirs.GetFiles("*.ps1"); + foreach (FileInfo fi in listSettings) + { + LstPS.Items.Add(Path.GetFileNameWithoutExtension(fi.Name)); + LstPS.Enabled = true; + } + } + + private void LblPS_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + // Show Info about feature + try + { + StreamReader OpenFile = new StreamReader(@"scripts\" + "readme.txt"); + MessageBox.Show(OpenFile.ReadToEnd(), "Info about this feature", MessageBoxButtons.OK); + OpenFile.Close(); + } + catch + { } + + // Refresh + PopulatePS(); + } + + private void LblSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + // Switch to Setting + PnlSettings.Visible = true; + TvwSettings.Visible = true; + + PnlPS.Visible = false; + LstPS.Visible = false; + } + + private void LstPS_SelectedIndexChanged(object sender, EventArgs e) + { + string psdir = @"scripts\" + LstPS.Text + ".ps1"; + + //Read PS content line by line + try + { + using (StreamReader sr = new StreamReader(@"scripts\" + LstPS.Text + ".ps1", Encoding.Default)) + { + StringBuilder content = new StringBuilder(); + + // writes line by line to the StringBuilder until the end of the file is reached + while (!sr.EndOfStream) + content.AppendLine(sr.ReadLine()); + + // View Code + TxtConsolePS.Text = content.ToString(); + + // View Info + TxtPSInfo.Text = _psInfo + string.Join(Environment.NewLine, System.IO.File.ReadAllLines(psdir).Where(s => s.StartsWith("###")).Select(s => s.Substring(3).Replace("###", "\r\n\n"))); + } + } + catch { } + } + + /// + /// Run custom PowerShell scripts + /// + private void BtnDoPS_Click(object sender, EventArgs e) + { + if (LstPS.CheckedItems.Count == 0) + { + MessageBox.Show(_psSelect, BtnDoPS.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + for (int i = 0; i < LstPS.Items.Count; i++) + { + if (LstPS.GetItemChecked(i)) + { + LstPS.SelectedIndex = i; + BtnDoPS.Text = "Processing"; + PnlPS.Enabled = false; + + //TxtOutputPS.Clear(); + using (PowerShell powerShell = PowerShell.Create()) + { + powerShell.AddScript(TxtConsolePS.Text); + powerShell.AddCommand("Out-String"); + Collection PSOutput = powerShell.Invoke(); + StringBuilder stringBuilder = new StringBuilder(); + foreach (PSObject pSObject in PSOutput) + stringBuilder.AppendLine(pSObject.ToString()); + + TxtOutputPS.Text = stringBuilder.ToString(); + + BtnDoPS.Text = "Apply"; + PnlPS.Enabled = true; + } + + // Done! + MessageBox.Show("Script " + "\"" + LstPS.Text + "\" " + _psSuccess, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + /// + /// Open PowerShell code view + /// + private void ChkCodePS_CheckedChanged(object sender, EventArgs e) + { + if (ChkCodePS.Checked == true) + { + ChkCodePS.Text = "Back"; + TxtConsolePS.Visible = true; + TxtOutputPS.Visible = false; + } + else + { + ChkCodePS.Text = "View code"; + TxtOutputPS.Visible = true; + TxtConsolePS.Visible = false; + } + } + + /// + /// Import PowerShell script files + /// + private void PSImport_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + + ofd.Filter = "*.txt|*.txt|*.ps1|*.ps1"; + ofd.DefaultExt = ".ps1"; + ofd.RestoreDirectory = true; + ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + ofd.FilterIndex = 2; + + string strDestPath = Application.StartupPath + @"\scripts"; + ofd.Multiselect = true; + if (ofd.ShowDialog() == DialogResult.OK) + { + foreach (string fileName in ofd.FileNames) + { + try + { + File.Copy(fileName, strDestPath + @"\" + Path.GetFileName(fileName)); + } + catch (Exception ex) + { MessageBox.Show(ex.Message, this.Text); } + } + } + + // Refresh + PopulatePS(); + } + + /// + /// Save opened PowerShell script files as new preset script files + /// + /// + /// + private void PSSaveAs_Click(object sender, EventArgs e) + { + if (ChkCodePS.Checked == false) + { + MessageBox.Show(_psSave, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "*.txt|*.txt|*.ps1|*.ps1"; + dlg.DefaultExt = ".ps1"; + dlg.RestoreDirectory = true; + dlg.InitialDirectory = Application.StartupPath + @"\scripts"; + dlg.FilterIndex = 2; + + try + { + if (dlg.ShowDialog() == DialogResult.OK) + { + File.WriteAllText(dlg.FileName, TxtConsolePS.Text, Encoding.UTF8); + //Refresh + PopulatePS(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + } + + private void PSMarketplace_Click(object sender, EventArgs e) + { + Process.Start("http://www.builtbybel.com/marketplace"); + } + + private void CommunityPkg_Click(object sender, EventArgs e) + { + Process.Start("https://github.com/builtbybel/privatezilla#community-package"); + } + + // Check if community package installed + private void CommunityPackageAvailable() + { + string path = @"scripts"; + if (Directory.Exists(path)) + { + LblPS.Visible = true; + CommunityPkg.Visible = false; + } + } + + private bool sortAscending = false; + + private void LvwStatus_ColumnClick(object sender, ColumnClickEventArgs e) + { + if (!sortAscending) + { + sortAscending = true; + } + else + { + sortAscending = false; + } + this.LvwStatus.ListViewItemSorter = new ListViewItemComparer(e.Column, sortAscending); + } + + private void BtnMenuPS_Click(object sender, EventArgs e) + { + this.PSMenu.Show(Cursor.Position.X, Cursor.Position.Y); + } + + private void PicOpenGitHubPage_Click(object sender, EventArgs e) + { + Process.Start("https://github.com/builtbybel/privatezilla"); + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/MainWindow.resx b/src/Privatezilla/MainWindow.resx new file mode 100644 index 0000000..84d1305 --- /dev/null +++ b/src/Privatezilla/MainWindow.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABGdBTUEAALGPC/xhBQAAAHtJREFUOE/t + kkEKg0AQBPclnvQXCjnrmwKiT8s17/ADetdqsgMreHDHEAhYUNDMMH2a8CsKHHGI2c0T16iymx6tSNnN + XXRMhS9844RWpKyZdiWeosYZrcTUTLssGkzLXCWGyhZUifIlOmw/8R9J/yXX3X89UAOPuv0WIWxtST6A + yKRghgAAAABJRU5ErkJggg== + + + + True + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAAiJJREFUSEvd + lU1r1FAYheMHSgUVVyIIBVvQYW5SsG66c9GFqC0qfiG69leoWXRyb6R2oRuhIH6s9AeI+/6CopaRYSY3 + Yy2CUHRh3RnPHc9M7k0npLPUB14m855z3klykzve/0127c0eLdQF7atn2perqE3WaurL54mQN4yH9tHA + gFkM+oTKKqqdBmqOsWoyL9uF0D3Ub2tIVRnvkslyTDk6kIuF8AilHnHMcMyluoFoRgt5Gcdrbr9X7VSo + 6526mnL70XmOc8nOhnthaNlm0zPa55mlsa6Iz2BdjpjSQeN0e1odtnLWD8jmx3q4z2gO3SCaLxizTm1h + nHIpHdE4WswNXXTc+5cFY8ucOeVSNqbDA8ZrZ/H4vqCcA+GDY/KjS5Qq4ToNsqj3lHJg+mabWpPhIUqV + GK+dRW1SykHzh21qnowPUqrELLidRW1RykHTuUVpEF2lVEkSqJt2Fu9Dh1IOhFeuSa5jHU5RLkWLuAbv + hp1F7jXlHC2iK7aJ9TP11X08+ydoG9AVDydSIR/As1XIZHgBb9OWY14OiH8fNyEX8Pm2H0A9oW0AesUr + 7tfX1uTj/bS5pCK6CIPZuH6tB/FxfH+H4++61jhGy4B0StU50Clk7tAynMRXcc/oR5KtofT+KwrDceXL + lTuqMSS+VAytIbRCaRv2cJzQ0/7etSOSQJ5DsGnCbG2Dw7/gsbzF1mhkXri7dPsFuJ13d7Jf/ct43h8o + 1jKqDLJlDQAAAABJRU5ErkJggg== + + + + 229, 19 + + + Welcome to the Modern Policy Editor, which allows you to apply group policies and custom settings in the form of PowerShell scripts and templates (bundled scripts). + +Select a script to view it's description. + +To check the code for vulnerabilities click on "View code". + +To obtain new objects (templates, scripts etc.) visit the Marketplace in the upper right menu. Privatezilla uses the Marketplace of the app "SharpApp". Since this app is from the same developer and the scripting is based upon Powershell, they are also compatible with each other. + + + + 132, 19 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL + EwAACxMBAJqcGAAAAohJREFUOE+Fkt1LU3EYx09ms9S0TEtNZ7kXnbYoKeiquhKK3QSZIFQU1b9QgReS + JV3VZcKZmzPnjuf4BqbTuujlwjBpitHS7bxOjQVqBBoR1dPznM7y0IoeOPwObN/P5zy/52H+rOqQ1OQS + lHEXrz6xhZSJwm7NY/z0/6oWlJMuQe1xcuI1BycPlwfl5n0hZQlPnml5mmn87d9VI6g+JycddfLqMAOw + qX48mePqldkaXpu0c/JUZUiLWYPKOgJfVgSVe3YuYTOiDNPAv7XUDWgTdYOaH89X7n4tWsWr3/ALAAOw + F5/ibgmKuiTYhc+OThHyA0oj4x5QThwbSsweGUx8cQsqYO/g7FXBzimwH8MVPTKUYbikW4Y9DyUoxHBB + QIJ8BOT6xEamtk+5eKhfA3efBtgCVCPA0auADQF2ToX6kUU4PKDp9t0IIPvOgAh5ZsBBDB/A8JnH76Ft + egWap5bBP/8Jvn7/AVRXX3xIs2/3i7CtI35OB5C9FgHjC+t6IIznaOLXO9WV58l0ewrgErQLZKfe786s + whiG26ZX4TZ+yUhiDR5pa3A6vKRfntme7YtvAMhOvROA7HcQ0BpBAIYJcCq8mG5HgMUfb2CcvHae7FV4 + 82SnGkUz2VN1GVsgO40uZd/aYQKQnUbnGVuCW69X4PrkMnjnNi7x0rNkmj0LAZu9BoDsNPdKY+60OKU4 + dzqPDy9ge8pve45P1O1bvAbAwUtNZKe50+JYTYtDN0+jI7u+OCZ7ZgpAVd4RKbX6ZjzWzvmbZYG5YGkg + Nl3cFftchMHU2prtFgqzMWDY+Fkd8NdqgYyC9khNfvubxjxvtDWXjQ5ls/PxLHbuY2b7u3DGg9kbzP1o + yU9i5UnNIXoRFwAAAABJRU5ErkJggg== + + + + 87 + + \ No newline at end of file diff --git a/src/Privatezilla/Privatezilla.csproj b/src/Privatezilla/Privatezilla.csproj new file mode 100644 index 0000000..f3b3c48 --- /dev/null +++ b/src/Privatezilla/Privatezilla.csproj @@ -0,0 +1,184 @@ + + + + + Debug + AnyCPU + {1CF5392E-0522-49D4-8343-B732BE762086} + WinExe + Privatezilla + Privatezilla + v4.7.2 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + app.manifest + + + icon.ico + + + bin\x64\ + + + x64 + bin\x64\Debug\ + + + x64 + bin\x64\Release\ + + + x64 + bin\x64\x64\ + + + + + + + + False + ..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + MainWindow.cs + + + + + + + + + + + + + + MainWindow.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + \ No newline at end of file diff --git a/src/Privatezilla/Program.cs b/src/Privatezilla/Program.cs new file mode 100644 index 0000000..d54fc60 --- /dev/null +++ b/src/Privatezilla/Program.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Privatezilla +{ + static class Program + { + + internal static string GetCurrentVersionTostring() => new Version(Application.ProductVersion).ToString(3); + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + if (Environment.OSVersion.Version.Build < 9200) + + MessageBox.Show("You are running Privatezilla on a system older than Windows 10. Privatezilla is limited to Windows 10 ONLY.", "Privatezilla", MessageBoxButtons.OK, MessageBoxIcon.Information); + else + Application.Run(new MainWindow()); + + } + } +} diff --git a/src/Privatezilla/Properties/AssemblyInfo.cs b/src/Privatezilla/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8cff9f4 --- /dev/null +++ b/src/Privatezilla/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Privatezilla")] +[assembly: AssemblyDescription("The alternate Windows 10 privacy settings app")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Builtbybel")] +[assembly: AssemblyProduct("Privatezilla")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("Privatezilla")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("1cf5392e-0522-49d4-8343-b732be762086")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.30.0")] +[assembly: AssemblyFileVersion("0.30.0")] diff --git a/src/Privatezilla/Properties/Resources.Designer.cs b/src/Privatezilla/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e48a15f --- /dev/null +++ b/src/Privatezilla/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Privatezilla.Properties { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Privatezilla.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/Privatezilla/Properties/Resources.resx b/src/Privatezilla/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/src/Privatezilla/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/Privatezilla/Properties/Settings.Designer.cs b/src/Privatezilla/Properties/Settings.Designer.cs new file mode 100644 index 0000000..1846830 --- /dev/null +++ b/src/Privatezilla/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Privatezilla.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/src/Privatezilla/Properties/Settings.settings b/src/Privatezilla/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/src/Privatezilla/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Privatezilla/Settings/Apps/AccountInfo.cs b/src/Privatezilla/Settings/Apps/AccountInfo.cs new file mode 100644 index 0000000..6488667 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/AccountInfo.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class AccountInfo : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userAccountInformation"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to account info"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/AppNotifications.cs b/src/Privatezilla/Settings/Apps/AppNotifications.cs new file mode 100644 index 0000000..52736a8 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/AppNotifications.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class AppNotifications : SettingBase + { + private const string AppKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable app notifications"; + } + + public override string Info() + { + return "The Action Center in Windows 10 collects and shows notifications and alerts from traditional Windows applications and system notifications, alongside those generated from modern apps.\nNotifications are then grouped in the Action Center by app and time.\nThis setting will disable all notifications from apps and other senders in settings."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(AppKey, "ToastEnabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "ToastEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "ToastEnabled", "1", RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/BackgroundApps.cs b/src/Privatezilla/Settings/Apps/BackgroundApps.cs new file mode 100644 index 0000000..70e3c06 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/BackgroundApps.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class BackgroundApps: SettingBase + { + private const string AppKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications"; + private const int DesiredValue =1; + + public override string ID() + { + return "Disable apps running in background"; + } + + public override string Info() + { + return "Windows 10 apps have no more permission to run in the background so they can't update their live tiles, fetch new data, and receive notifications."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(AppKey, "GlobalUserDisabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "GlobalUserDisabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "GlobalUserDisabled", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Calendar.cs b/src/Privatezilla/Settings/Apps/Calendar.cs new file mode 100644 index 0000000..8d06eff --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Calendar.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Calendar : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appointments"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to calendar"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Call.cs b/src/Privatezilla/Settings/Apps/Call.cs new file mode 100644 index 0000000..37f7110 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Call.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Call: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCall"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to call"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/CallHistory.cs b/src/Privatezilla/Settings/Apps/CallHistory.cs new file mode 100644 index 0000000..201c4ac --- /dev/null +++ b/src/Privatezilla/Settings/Apps/CallHistory.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class CallHistory: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCallHistory"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to call history"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Camera.cs b/src/Privatezilla/Settings/Apps/Camera.cs new file mode 100644 index 0000000..078f708 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Camera.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Camera: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to camera"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/CellularData.cs b/src/Privatezilla/Settings/Apps/CellularData.cs new file mode 100644 index 0000000..c6c5a1d --- /dev/null +++ b/src/Privatezilla/Settings/Apps/CellularData.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class CellularData : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\cellularData"; + private const string DesiredValue = "Deny"; + + public override string ID() + { + return "Disable app access to cellular data"; + } + + public override string Info() + { + return "Some Windows 10 devices have a SIM card and/or eSIM in them that lets you connect to a cellular data network (aka: LTE or Broadband), so you can get online in more places by using a cellular signal.\nIf you do not want any apps to be allowed to use cellular data, you can disable it with this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Contacts.cs b/src/Privatezilla/Settings/Apps/Contacts.cs new file mode 100644 index 0000000..29b6ac7 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Contacts.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Contacts : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to contacts"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/DiagnosticInformation.cs b/src/Privatezilla/Settings/Apps/DiagnosticInformation.cs new file mode 100644 index 0000000..f9a9d5e --- /dev/null +++ b/src/Privatezilla/Settings/Apps/DiagnosticInformation.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class DiagnosticInformation: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to diagnostics"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Documents.cs b/src/Privatezilla/Settings/Apps/Documents.cs new file mode 100644 index 0000000..4aad266 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Documents.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Documents: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\documentsLibrary"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to documents"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Email.cs b/src/Privatezilla/Settings/Apps/Email.cs new file mode 100644 index 0000000..470d9bc --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Email.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Email : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\email"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to email"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/EyeGaze.cs b/src/Privatezilla/Settings/Apps/EyeGaze.cs new file mode 100644 index 0000000..d3eea31 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/EyeGaze.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class EyeGaze : SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\gazeInput"; + private const string DesiredValue = "Deny"; + + public override string ID() + { + return "Disable app access to eye tracking"; + } + + public override string Info() + { + return "Disable app access to eye-gaze-based interaction"; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/FileSystem.cs b/src/Privatezilla/Settings/Apps/FileSystem.cs new file mode 100644 index 0000000..57a60bd --- /dev/null +++ b/src/Privatezilla/Settings/Apps/FileSystem.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class FileSystem: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to file system"; + } + + public override string Info() + { + return "This setting will disable app access to file system. Some apps may be restricted in their function or may no longer work at all."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Messaging.cs b/src/Privatezilla/Settings/Apps/Messaging.cs new file mode 100644 index 0000000..584e02c --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Messaging.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Messaging: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\chat"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to messaging"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Microphone.cs b/src/Privatezilla/Settings/Apps/Microphone.cs new file mode 100644 index 0000000..c06ae0c --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Microphone.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Microphone: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to microphone"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Motion.cs b/src/Privatezilla/Settings/Apps/Motion.cs new file mode 100644 index 0000000..5c2e617 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Motion.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Motion: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\activity"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to motion"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Notifications.cs b/src/Privatezilla/Settings/Apps/Notifications.cs new file mode 100644 index 0000000..5836183 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Notifications.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Notifications: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to notifications"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/OtherDevices.cs b/src/Privatezilla/Settings/Apps/OtherDevices.cs new file mode 100644 index 0000000..8ce0d17 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/OtherDevices.cs @@ -0,0 +1,57 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class OtherDevices: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetooth"; + private const string AppKey2 = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to other devices"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) && + RegistryHelper.StringEquals(AppKey2, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + Registry.SetValue(AppKey2, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Pictures.cs b/src/Privatezilla/Settings/Apps/Pictures.cs new file mode 100644 index 0000000..46960f7 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Pictures.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Pictures: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\picturesLibrary"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to pictures"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Radios.cs b/src/Privatezilla/Settings/Apps/Radios.cs new file mode 100644 index 0000000..246cbc2 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Radios.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Radios: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\radios"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to radios"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Tasks.cs b/src/Privatezilla/Settings/Apps/Tasks.cs new file mode 100644 index 0000000..0f02ebf --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Tasks.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Tasks: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userDataTasks"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to tasks"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/TrackingApps.cs b/src/Privatezilla/Settings/Apps/TrackingApps.cs new file mode 100644 index 0000000..1e73404 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/TrackingApps.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class TrackingApps: SettingBase + { + private const string AppKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable tracking of app starts"; + } + + public override string Info() + { + return "This allows you to quickly have access to your list of Most used apps both in the Start menu and when you search your device."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(AppKey, "Start_TrackProgs", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Start_TrackProgs", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Start_TrackProgs", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Apps/Videos.cs b/src/Privatezilla/Settings/Apps/Videos.cs new file mode 100644 index 0000000..a623c68 --- /dev/null +++ b/src/Privatezilla/Settings/Apps/Videos.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Apps +{ + internal class Videos: SettingBase + { + private const string AppKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\videosLibrary"; + private const string DesiredValue ="Deny"; + + public override string ID() + { + return "Disable app access to videos"; + } + + public override string Info() + { + return ""; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(AppKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AppKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Bloatware/RemoveUWPAll.cs b/src/Privatezilla/Settings/Bloatware/RemoveUWPAll.cs new file mode 100644 index 0000000..97552f6 --- /dev/null +++ b/src/Privatezilla/Settings/Bloatware/RemoveUWPAll.cs @@ -0,0 +1,72 @@ +using System; +using System.Management.Automation; +using System.IO; + +namespace Privatezilla.Setting.Bloatware +{ + internal class RemoveUWPAll : SettingBase + { + public override string ID() + { + return "Remove all built-in apps"; + } + + public override string Info() + { + return "This will remove all built-in apps except Microsoft Store."; + } + + public override bool CheckSetting() + { + // NOTE! OPTIMIZE + // Check if app Windows.Photos exists and return true as not configured + var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "Microsoft.Windows.Photos_8wekyb3d8bbwe"); + + if (Directory.Exists(appPath)) + { + return true; + } + + + return false; + } + + public override bool DoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-appxprovisionedpackage –online | where-object {$_.packagename –notlike “*store*”} | Remove-AppxProvisionedPackage –online"); + script.AddScript("Get-AppxPackage | where-object {$_.name –notlike “*store*”} | Remove-AppxPackage"); + + try + { + script.Invoke(); + } + catch + { } + } + + return true; + } + + public override bool UndoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\\AppXManifest.xml”}"); + + + try + { + script.Invoke(); + return true; + } + catch + {} + + return false; + } + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Bloatware/RemoveUWPDefaults.cs b/src/Privatezilla/Settings/Bloatware/RemoveUWPDefaults.cs new file mode 100644 index 0000000..ff67bd1 --- /dev/null +++ b/src/Privatezilla/Settings/Bloatware/RemoveUWPDefaults.cs @@ -0,0 +1,71 @@ +using System; +using System.Management.Automation; +using System.IO; + +namespace Privatezilla.Setting.Bloatware +{ + internal class RemoveUWPDefaults : SettingBase + { + public override string ID() + { + return "Remove all built-in apps except defaults"; + } + + public override string Info() + { + return "This will remove all built-in apps except the following:\nMicrosoft Store\nApp Installer\nCalendar\nMail\nCalculator\nCamera\nSkype\nGroove Music\nMaps\nPaint 3D\nYour Phone\nPhotos\nSticky Notes\nWeather\nXbox"; + } + + public override bool CheckSetting() + { + // NOTE! OPTIMIZE + // Check if app Windows.Photos exists and return false as configured + var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "Microsoft.Windows.Photos_8wekyb3d8bbwe"); + + if (Directory.Exists(appPath)) + { + return false; + } + + + return true; + } + + public override bool DoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-appxprovisionedpackage –online | where-object {$_.packagename –notlike “*store*” -and $_.packagename –notlike “*appinstaller*” -and $_.packagename –notlike “*calculator*” -and $_.packagename –notlike “*photos*” -and $_.packagename –notlike “*sticky*” -and $_.packagename –notlike “*skypeapp*” -and $_.packagename –notlike “*alarms*” -and $_.packagename –notlike “*maps*” -and $_.packagename –notlike “*camera*” -and $_.packagename –notlike “*xbox*” -and $_.packagename –notlike “*communicationssapps*” -and $_.packagename –notlike “*zunemusic*” -and $_.packagename –notlike “*mspaint*” -and $_.packagename –notlike “*yourphone*” -and $_.packagename –notlike “*bingweather*”} | Remove-AppxProvisionedPackage –online"); + script.AddScript("Get-AppxPackage | where-object {$_.name –notlike “*store*” -and $_.name –notlike “*appinstaller*” -and $_.name –notlike “*calculator*” -and $_.name –notlike “*photos*” -and $_.name –notlike “*sticky*” -and $_.name –notlike “*skypeapp*” -and $_.name –notlike“*alarms*” -and $_.name –notlike “*maps*” -and $_.name –notlike “*camera*” -and $_.name –notlike “*xbox*” -and $_.name –notlike “*communicationssapps*” -and $_.name –notlike “*zunemusic*” -and $_.name –notlike “*mspaint*” -and $_.name –notlike “*yourphone*” -and $_.name –notlike “*bingweather*”} | Remove-AppxPackage"); + + try + { + script.Invoke(); + } + catch + { } + } + + return true; + } + + public override bool UndoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\\AppXManifest.xml”}"); + + try + { + script.Invoke(); + return true; + } + catch + { } + + return false; + } + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Cortana/DisableBing.cs b/src/Privatezilla/Settings/Cortana/DisableBing.cs new file mode 100644 index 0000000..7041a59 --- /dev/null +++ b/src/Privatezilla/Settings/Cortana/DisableBing.cs @@ -0,0 +1,64 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Cortana +{ + internal class DisableBing : SettingBase + { + private const string BingKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Windows Search"; + private const string Bing2004Key = @"HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer"; //Disable Websearch on W1indows 10, version >=2004 + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Bing in Windows Search"; + } + + public override string Info() + { + return "Windows 10, by default, sends everything you search for in the Start Menu to their servers to give you results from Bing search."; + } + + public override bool CheckSetting() + + { + string releaseid = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString(); + + if (releaseid != "2004") + return !(RegistryHelper.IntEquals(BingKey, "BingSearchEnabled", DesiredValue)); + + else + return !(RegistryHelper.IntEquals(Bing2004Key, "DisableSearchBoxSuggestions", 1)); + + } + + + public override bool DoSetting() + { + try + { + Registry.SetValue(BingKey, "BingSearchEnabled", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(Bing2004Key, "DisableSearchBoxSuggestions", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(BingKey, "BingSearchEnabled", 1, RegistryValueKind.DWord); + Registry.SetValue(Bing2004Key, "DisableSearchBoxSuggestions", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Cortana/DisableCortana.cs b/src/Privatezilla/Settings/Cortana/DisableCortana.cs new file mode 100644 index 0000000..fd9adec --- /dev/null +++ b/src/Privatezilla/Settings/Cortana/DisableCortana.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Cortana +{ + internal class DisableCortana : SettingBase + { + private const string CortanaKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Windows Search"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Cortana"; + } + + public override string Info() + { + return "Cortana is Microsoft's virtual assistant that comes integrated into Windows 10.\nThis setting will disable Cortana permanently and prevent it from recording and storing your search habits and history."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(CortanaKey, "AllowCortana", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(CortanaKey, "AllowCortana", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(CortanaKey, "AllowCortana", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Cortana/UninstallCortana.cs b/src/Privatezilla/Settings/Cortana/UninstallCortana.cs new file mode 100644 index 0000000..755b258 --- /dev/null +++ b/src/Privatezilla/Settings/Cortana/UninstallCortana.cs @@ -0,0 +1,70 @@ +using System; +using System.Management.Automation; +using System.IO; + +namespace Privatezilla.Setting.Cortana +{ + internal class UninstallCortana : SettingBase + { + public override string ID() + { + return "Uninstall Cortana"; + } + + public override string Info() + { + return "This will uninstall the new Cortana app on Windows 10, version 2004."; + } + + public override bool CheckSetting() + { + // Cortana Package ID on Windows 10, version 2004 is *Microsoft.549981C3F5F10* + var appPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages", "Microsoft.549981C3F5F10"); + + if (Directory.Exists(appPath)) + { + return true; + } + + + return false; + } + + public override bool DoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-appxpackage *Microsoft.549981C3F5F10* | Remove-AppxPackage"); + + try + { + script.Invoke(); + } + catch + { } + } + + return true; + } + + public override bool UndoSetting() + { + using (PowerShell script = PowerShell.Create()) + { + script.AddScript("Get-AppXPackage -Name Microsoft.Windows.Cortana | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register \"$($_.InstallLocation)AppXManifest.xml}\""); + + try + { + script.Invoke(); + return true; + } + catch + { } + + return false; + } + + + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Defender/DisableSmartScreenStore.cs b/src/Privatezilla/Settings/Defender/DisableSmartScreenStore.cs new file mode 100644 index 0000000..0fa59b7 --- /dev/null +++ b/src/Privatezilla/Settings/Defender/DisableSmartScreenStore.cs @@ -0,0 +1,57 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Defender +{ + internal class DisableSmartScreenStore: SettingBase + { + private const string DefenderKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AppHost"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable SmartScreen for Store Apps"; + } + + public override string Info() + { + return "Windows Defender SmartScreen Filter helps protect your device by checking web content (URLs) that Microsoft Store apps use."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(DefenderKey, "EnableWebContentEvaluation", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(DefenderKey, "EnableWebContentEvaluation", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + + var RegKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\AppHost", true); + RegKey.DeleteValue("EnableWebContentEvaluation"); + + return true; + } + catch + { } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Edge/AutoFillCredits.cs b/src/Privatezilla/Settings/Edge/AutoFillCredits.cs new file mode 100644 index 0000000..ac0f2f1 --- /dev/null +++ b/src/Privatezilla/Settings/Edge/AutoFillCredits.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Edge +{ + internal class DisableAutoFillCredits : SettingBase + { + private const string EdgeKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable AutoFill for credit cards"; + } + + public override string Info() + { + return "Microsoft Edge's AutoFill feature lets users auto complete credit card information in web forms using previously stored information."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(EdgeKey, "AutofillCreditCardEnabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(EdgeKey, "AutofillCreditCardEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(EdgeKey, "AutofillCreditCardEnabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Edge/BlockEdgeRollout.cs b/src/Privatezilla/Settings/Edge/BlockEdgeRollout.cs new file mode 100644 index 0000000..8e69185 --- /dev/null +++ b/src/Privatezilla/Settings/Edge/BlockEdgeRollout.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Edge +{ + internal class BlockEdgeRollout : SettingBase + { + private const string EdgeKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Block Installation of New Microsoft Edge"; + } + + public override string Info() + { + return "This will block Windows 10 Update Force Installing of the new Chromium-based Microsoft Edge web browser if it's not installed already on the device."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(EdgeKey, "DoNotUpdateToEdgeWithChromium", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(EdgeKey, "DoNotUpdateToEdgeWithChromium", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(EdgeKey, "DoNotUpdateToEdgeWithChromium", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Edge/DisableSync.cs b/src/Privatezilla/Settings/Edge/DisableSync.cs new file mode 100644 index 0000000..cae6a59 --- /dev/null +++ b/src/Privatezilla/Settings/Edge/DisableSync.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Edge +{ + internal class DisableSync : SettingBase + { + private const string EdgeKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Disable synchronization of data"; + } + + public override string Info() + { + return "This setting will disable synchronization of data using Microsoft sync services."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(EdgeKey, "SyncDisabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(EdgeKey, "SyncDisabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(EdgeKey, "SyncDisabled", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Edge/EdgeBackground.cs b/src/Privatezilla/Settings/Edge/EdgeBackground.cs new file mode 100644 index 0000000..3d0446f --- /dev/null +++ b/src/Privatezilla/Settings/Edge/EdgeBackground.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Edge +{ + internal class EdgeBackground : SettingBase + { + private const string EdgeKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Prevent Edge running in background"; + } + + public override string Info() + { + return "On the new Chromium version of Microsoft Edge, extensions and other services can keep the browser running in the background even after it's closed."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(EdgeKey, "BackgroundModeEnabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(EdgeKey, "BackgroundModeEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(EdgeKey, "BackgroundModeEnabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Gaming/GameBar.cs b/src/Privatezilla/Settings/Gaming/GameBar.cs new file mode 100644 index 0000000..6fe21f5 --- /dev/null +++ b/src/Privatezilla/Settings/Gaming/GameBar.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Gaming +{ + internal class DisableGameBar : SettingBase + { + private const string GameBarKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\GameDVR"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Game Bar features"; + } + + public override string Info() + { + return "This setting will disable the Windows Game Recording and Broadcasting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(GameBarKey, "AllowGameDVR", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(GameBarKey, "AllowGameDVR", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(GameBarKey, "AllowGameDVR", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DiagnosticData.cs b/src/Privatezilla/Settings/Privacy/DiagnosticData.cs new file mode 100644 index 0000000..253c7e6 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DiagnosticData.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DiagnosticData : SettingBase + { + private const string DiagnosticKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Prevent using diagnostic data"; + } + + public override string Info() + { + return "This will turn off tailored experiences with relevant tips and recommendations by using your diagnostics data. Many people would call this telemetry, or even spying."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(DiagnosticKey, "TailoredExperiencesWithDiagnosticDataEnabled", DesiredValue) + ); + + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(DiagnosticKey, "TailoredExperiencesWithDiagnosticDataEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(DiagnosticKey, "TailoredExperiencesWithDiagnosticDataEnabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableAds.cs b/src/Privatezilla/Settings/Privacy/DisableAds.cs new file mode 100644 index 0000000..9b3e468 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableAds.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableAds : SettingBase + { + private const string AdsKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Advertising ID for Relevant Ads"; + } + + public override string Info() + { + return "Windows 10 comes integrated with advertising. Microsoft assigns a unique identificator to track your activity in the Microsoft Store and on UWP apps to target you with relevant ads."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(AdsKey, "Enabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AdsKey, "Enabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AdsKey, "Enabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableBiometrics.cs b/src/Privatezilla/Settings/Privacy/DisableBiometrics.cs new file mode 100644 index 0000000..6b37de3 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableBiometrics.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableBiometrics : SettingBase + { + private const string BiometricsKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Biometrics"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Windows Hello Biometrics"; + } + + public override string Info() + { + return "Windows Hello biometrics lets you sign in to your devices, apps, online services, and networks using your face, iris, or fingerprint"; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(BiometricsKey, "Enabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(BiometricsKey, "Enabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(BiometricsKey, "Enabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableCEIP.cs b/src/Privatezilla/Settings/Privacy/DisableCEIP.cs new file mode 100644 index 0000000..17bc37c --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableCEIP.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableCEIP : SettingBase + { + private const string CEIPKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\SQMClient\Windows"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Customer Experience Program"; + } + + public override string Info() + { + return "The Customer Experience Improvement Program (CEIP) is a feature that comes enabled by default on Windows 10, and it secretly collects and submits hardware and software usage information to Microsoft."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(CEIPKey, "CEIPEnable", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(CEIPKey, "CEIPEnable", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(CEIPKey, "CEIPEnable", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableCompTelemetry.cs b/src/Privatezilla/Settings/Privacy/DisableCompTelemetry.cs new file mode 100644 index 0000000..b19d115 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableCompTelemetry.cs @@ -0,0 +1,58 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableCompTelemetry : SettingBase + { + private const string TelemetryKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\CompatTelRunner.exe"; + private const string DesiredValue = @"%windir%\System32\taskkill.exe"; + + public override string ID() + { + return "Disable Compatibility Telemetry"; + } + + public override string Info() + { + return "This process is periodically collecting a variety of technical data about your computer and its performance and sending it to Microsoft for its Windows Customer Experience Improvement Program."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(TelemetryKey, "Debugger", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(TelemetryKey, "Debugger", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\CompatTelRunner.exe", true); + RegKey.DeleteValue("Debugger"); + + return true; + } + catch + { } + + return false; + + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableFeedback.cs b/src/Privatezilla/Settings/Privacy/DisableFeedback.cs new file mode 100644 index 0000000..72dca12 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableFeedback.cs @@ -0,0 +1,60 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableFeedback: SettingBase + { + private const string PeriodInNanoSeconds = @"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules"; + private const string NumberOfSIUFInPeriod = @"HKEY_CURRENT_USER\Software\Microsoft\Siuf\Rules"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Do not show feedback notifications"; + } + + public override string Info() + { + return "Windows 10 may also pop up from time to time and ask for feedback."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(PeriodInNanoSeconds, "PeriodInNanoSeconds", DesiredValue) && + RegistryHelper.IntEquals(NumberOfSIUFInPeriod, "NumberOfSIUFInPeriod", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(PeriodInNanoSeconds, "PeriodInNanoSeconds", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(NumberOfSIUFInPeriod, "NumberOfSIUFInPeriod", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + public override bool UndoSetting() + { + try + { + var RegKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Siuf\Rules", true); + RegKey.DeleteValue("NumberOfSIUFInPeriod"); + RegKey.DeleteValue("PeriodInNanoSeconds"); + return true; + + } + catch + { } + + return false; + } + + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableHEIP.cs b/src/Privatezilla/Settings/Privacy/DisableHEIP.cs new file mode 100644 index 0000000..25dada0 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableHEIP.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableHEIP: SettingBase + { + private const string HEIPKey = @"HKEY_CURRENT_USER\Software\Microsoft\Assistance\Client\1.0\Settings"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Help Experience Program"; + } + + public override string Info() + { + return "The Help Experience Improvement Program (HEIP) collects and send to Microsoft information about how you use Windows Help. This might reveal what problems you are having with your computer."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(HEIPKey, "ImplicitFeedback", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(HEIPKey, "ImplicitFeedback", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(HEIPKey, "ImplicitFeedback", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableLocation.cs b/src/Privatezilla/Settings/Privacy/DisableLocation.cs new file mode 100644 index 0000000..58f9a8e --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableLocation.cs @@ -0,0 +1,53 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableLocation : SettingBase + { + private const string LocationKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location"; + private const string DesiredValue = @"Deny"; + + public override string ID() + { + return "Disable Location tracking"; + } + + public override string Info() + { + return "Wherever you go, Windows 10 knows you're there. When Location Tracking is turned on, Windows and its apps are allowed to detect the current location of your computer or device."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.StringEquals(LocationKey, "Value", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(LocationKey, "Value", DesiredValue, RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + public override bool UndoSetting() + { + try + { + Registry.SetValue(LocationKey, "Value", "Allow", RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableMSExperiments.cs b/src/Privatezilla/Settings/Privacy/DisableMSExperiments.cs new file mode 100644 index 0000000..80ee2bb --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableMSExperiments.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableMSExperiments: SettingBase + { + private const string ExperimentationKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\System"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Settings Experimentation"; + + } + + public override string Info() + { + return "In certain builds of Windows 10, users could let Microsoft experiment with the system to study user preferences or device behavior. This allows Microsoft to “conduct experiments” with the settings on your PC and should be disabled with this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(ExperimentationKey, "AllowExperimentation", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(ExperimentationKey, "AllowExperimentation", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(ExperimentationKey, "AllowExperimentation", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableTelemetry.cs b/src/Privatezilla/Settings/Privacy/DisableTelemetry.cs new file mode 100644 index 0000000..3baa695 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableTelemetry.cs @@ -0,0 +1,62 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableTelemetry : SettingBase + { + private const string TelemetryKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DataCollection"; + private const string DiagTrack = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DiagTrack"; + private const string dmwappushservice = @"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Telemetry"; + } + + public override string Info() + { + return "This will prevent Windows from collecting usage information and setting diagnostic data to Basic, which is the lowest level available for all consumer versions of Windows 10.\nThe services diagtrack & dmwappushservice will also be disabled.\nNOTE: Diagnostic Data must be set to Full to get preview builds from Windows-Insider-Program! "; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(TelemetryKey, "AllowTelemetry", DesiredValue) && + RegistryHelper.IntEquals(DiagTrack, "Start", 4) && + RegistryHelper.IntEquals(dmwappushservice, "Start", 4) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(TelemetryKey, "AllowTelemetry", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(DiagTrack, "Start", 4, RegistryValueKind.DWord); + Registry.SetValue(dmwappushservice, "Start", 4, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(TelemetryKey, "AllowTelemetry", 3, RegistryValueKind.DWord); + Registry.SetValue(DiagTrack, "Start", 2, RegistryValueKind.DWord); + Registry.SetValue(dmwappushservice, "Start", 2, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableTimeline.cs b/src/Privatezilla/Settings/Privacy/DisableTimeline.cs new file mode 100644 index 0000000..3bdcd30 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableTimeline.cs @@ -0,0 +1,60 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableTimeline : SettingBase + { + private const string EnableActivityFeed = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\System"; + private const string PublishUserActivities = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\System"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Timeline feature"; + } + + public override string Info() + { + return "This collects a history of activities you've performed, including files you've opened and web pages you've viewed in Edge.\nIf Timeline isn’t for you, or you simply don’t want Windows 10 collecting your sensitive activities and information, you can disable Timeline completely with this setting.\nNote: A system reboot is required for the changes to take effect."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(EnableActivityFeed, "EnableActivityFeed", DesiredValue) && + RegistryHelper.IntEquals(PublishUserActivities, "PublishUserActivities", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(EnableActivityFeed, "EnableActivityFeed", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(PublishUserActivities, "PublishUserActivities", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\System", true); + RegKey.DeleteValue("EnableActivityFeed"); + RegKey.DeleteValue("PublishUserActivities"); + + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableTips.cs b/src/Privatezilla/Settings/Privacy/DisableTips.cs new file mode 100644 index 0000000..a7fd8a7 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableTips.cs @@ -0,0 +1,67 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableTips: SettingBase + { + private const string DisableSoftLanding = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent"; + private const string DisableWindowsSpotlightFeatures = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent"; + private const string DisableWindowsConsumerFeatures = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent"; + private const string DoNotShowFeedbackNotifications = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DataCollection"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Disable Windows Tips"; + } + + public override string Info() + { + return "You will no longer see Windows Tips, e.g. Spotlight and Consumer Features, Feedback Notifications etc."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(DisableSoftLanding, "DisableSoftLanding", DesiredValue) && + RegistryHelper.IntEquals(DisableWindowsSpotlightFeatures, "DisableWindowsSpotlightFeatures", DesiredValue) && + RegistryHelper.IntEquals(DisableWindowsConsumerFeatures, "DisableWindowsConsumerFeatures", DesiredValue) && + RegistryHelper.IntEquals(DoNotShowFeedbackNotifications, "DoNotShowFeedbackNotifications", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(DisableSoftLanding, "DisableSoftLanding", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(DisableWindowsSpotlightFeatures, "DisableWindowsSpotlightFeatures", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(DisableWindowsConsumerFeatures, "DisableWindowsConsumerFeatures", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(DoNotShowFeedbackNotifications, "DoNotShowFeedbackNotifications", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(DisableSoftLanding, "DisableSoftLanding", 0, RegistryValueKind.DWord); + Registry.SetValue(DisableWindowsSpotlightFeatures, "DisableWindowsSpotlightFeatures", 0, RegistryValueKind.DWord); + Registry.SetValue(DisableWindowsConsumerFeatures, "DisableWindowsConsumerFeatures", 0, RegistryValueKind.DWord); + Registry.SetValue(DoNotShowFeedbackNotifications, "DoNotShowFeedbackNotifications", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableTipsLockScreen.cs b/src/Privatezilla/Settings/Privacy/DisableTipsLockScreen.cs new file mode 100644 index 0000000..44f44f9 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableTipsLockScreen.cs @@ -0,0 +1,64 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableTipsLockScreen : SettingBase + { + private const string SpotlightKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string LockScreenKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string TipsTricksSuggestions = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Ads and Links on Lock Screen"; + + } + + public override string Info() + { + return "This setting will set your lock screen background options to a picture and turn off tips, fun facts and tricks from Microsoft."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(SpotlightKey, "RotatingLockScreenEnabled", DesiredValue) && + RegistryHelper.IntEquals(LockScreenKey, "RotatingLockScreenOverlayEnabled", DesiredValue) && + RegistryHelper.IntEquals(TipsTricksSuggestions, "SubscribedContent-338389Enabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(SpotlightKey, "RotatingLockScreenEnabled", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(LockScreenKey, "RotatingLockScreenOverlayEnabled", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(TipsTricksSuggestions, "SubscribedContent-338389Enabled", DesiredValue, RegistryValueKind.DWord); + return true; + + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(SpotlightKey, "RotatingLockScreenEnabled", 1, RegistryValueKind.DWord); + Registry.SetValue(LockScreenKey, "RotatingLockScreenOverlayEnabled", 1, RegistryValueKind.DWord); + Registry.SetValue(TipsTricksSuggestions, "SubscribedContent-338389Enabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/DisableWiFi.cs b/src/Privatezilla/Settings/Privacy/DisableWiFi.cs new file mode 100644 index 0000000..acd9546 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/DisableWiFi.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class DisableWiFi : SettingBase + { + private const string WiFiKey = @"HKEY_LOCAL_MACHINE\Software\Microsoft\WcmSvc\wifinetworkmanager\config"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Wi-Fi Sense"; + } + + public override string Info() + { + return "You should at least stop your PC from sending your Wi-Fi password."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(WiFiKey, "AutoConnectAllowedOEM", DesiredValue) + + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(WiFiKey, "AutoConnectAllowedOEM", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(WiFiKey, "AutoConnectAllowedOEM", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/GetMoreOutOfWindows.cs b/src/Privatezilla/Settings/Privacy/GetMoreOutOfWindows.cs new file mode 100644 index 0000000..5c55014 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/GetMoreOutOfWindows.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class GetMoreOutOfWindows: SettingBase + { + private const string GetKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Get Even More Out of Windows"; + } + + public override string Info() + { + return "Recent Windows 10 versions occasionally display a nag screen \"Get Even More Out of Windows\" when you sign-in to your user account. If you find it annoying, you can disable it with this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(GetKey, "ScoobeSystemSettingEnabled", DesiredValue) + + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(GetKey, "ScoobeSystemSettingEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(GetKey, "ScoobeSystemSettingEnabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/HandwritingData.cs b/src/Privatezilla/Settings/Privacy/HandwritingData.cs new file mode 100644 index 0000000..85b0bde --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/HandwritingData.cs @@ -0,0 +1,71 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class HandwritingData : SettingBase + { + private const string AllowInputPersonalization = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\InputPersonalization"; + private const string RestrictImplicitInkCollection = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\InputPersonalization"; + private const string RestrictImplicitTextCollection = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\InputPersonalization"; + private const string PreventHandwritingErrorReports = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports"; + private const string PreventHandwritingDataSharing = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\TabletPC"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Prevent using handwriting data"; + } + + public override string Info() + { + return "If you don’t want Windows to know and record all unique words that you use, like names and professional jargon, just enable this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(AllowInputPersonalization, "AllowInputPersonalization", 0) && + RegistryHelper.IntEquals(RestrictImplicitInkCollection, "RestrictImplicitInkCollection", DesiredValue) && + RegistryHelper.IntEquals(RestrictImplicitTextCollection, "RestrictImplicitTextCollection", DesiredValue) && + RegistryHelper.IntEquals(PreventHandwritingErrorReports, "PreventHandwritingErrorReports", DesiredValue) && + RegistryHelper.IntEquals(PreventHandwritingDataSharing, "PreventHandwritingDataSharing", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(AllowInputPersonalization, "AllowInputPersonalization", 0, RegistryValueKind.DWord); + Registry.SetValue(RestrictImplicitInkCollection, "RestrictImplicitInkCollection", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(RestrictImplicitTextCollection, "RestrictImplicitTextCollection", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(PreventHandwritingErrorReports, "PreventHandwritingErrorReports", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(PreventHandwritingDataSharing, "PreventHandwritingDataSharing", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(AllowInputPersonalization, "AllowInputPersonalization", 1, RegistryValueKind.DWord); + Registry.SetValue(RestrictImplicitInkCollection, "RestrictImplicitInkCollection", 0, RegistryValueKind.DWord); + Registry.SetValue(RestrictImplicitTextCollection, "RestrictImplicitTextCollection", 0, RegistryValueKind.DWord); + Registry.SetValue(PreventHandwritingErrorReports, "PreventHandwritingErrorReports", 0, RegistryValueKind.DWord); + Registry.SetValue(PreventHandwritingDataSharing, "PreventHandwritingDataSharing", 0, RegistryValueKind.DWord); ; + return true; + } + catch + { } + + return false; + } + + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/InstalledApps.cs b/src/Privatezilla/Settings/Privacy/InstalledApps.cs new file mode 100644 index 0000000..e1e04e6 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/InstalledApps.cs @@ -0,0 +1,56 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class InstalledApps : SettingBase + { + private const string InstalledKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Block automatic Installation of apps"; + } + + public override string Info() + { + return "When you sign-in to a new Windows 10 profile or device for the first time, chance is that you notice several third-party applications and games listed prominently in the Start menu.\nThis setting will block automatic Installation of suggested Windows 10 apps."; + } + + public override bool CheckSetting() + { + + return !( + RegistryHelper.IntEquals(InstalledKey, "SilentInstalledAppsEnabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(InstalledKey, "SilentInstalledAppsEnabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + + public override bool UndoSetting() + { + try + { + Registry.SetValue(InstalledKey, "SilentInstalledAppsEnabled", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/InventoryCollector.cs b/src/Privatezilla/Settings/Privacy/InventoryCollector.cs new file mode 100644 index 0000000..de92b75 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/InventoryCollector.cs @@ -0,0 +1,58 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class InventoryCollector : SettingBase + { + private const string InventoryKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\AppCompat"; + private const string AppTelemetryKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\AppCompat"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Disable Inventory Collector"; + } + + public override string Info() + { + return "The Inventory Collector inventories applications files devices and drivers on the system and sends the information to Microsoft. This information is used to help diagnose compatibility problems.\nNote: This setting setting has no effect if the Customer Experience Improvement Program is turned off. The Inventory Collector will be off."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(InventoryKey, "DisableInventory", DesiredValue) && + RegistryHelper.IntEquals(AppTelemetryKey, "AITEnable", 0) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(InventoryKey, "DisableInventory", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(AppTelemetryKey, "AITEnable", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(InventoryKey, "DisableInventory", 0, RegistryValueKind.DWord); + Registry.SetValue(AppTelemetryKey, "AITEnable", 1, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/SuggestedApps.cs b/src/Privatezilla/Settings/Privacy/SuggestedApps.cs new file mode 100644 index 0000000..1c10a57 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/SuggestedApps.cs @@ -0,0 +1,54 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class SuggestedApps : SettingBase + { + private const string SuggestedKey = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Block suggested apps in Start"; + } + + public override string Info() + { + return "This will block the Suggested Apps that occasionally appear on the Start menu."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(SuggestedKey, "SubscribedContent-338388Enabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(SuggestedKey, "SubscribedContent-338388Enabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(SuggestedKey, "SubscribedContent-338388Enabled", 1 , RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Privacy/SuggestedContent.cs b/src/Privatezilla/Settings/Privacy/SuggestedContent.cs new file mode 100644 index 0000000..e21a052 --- /dev/null +++ b/src/Privatezilla/Settings/Privacy/SuggestedContent.cs @@ -0,0 +1,64 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Privacy +{ + internal class SuggestedContent : SettingBase + { + private const string SubscribedContent338393 = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string SubscribedContent353694 = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const string SubscribedContent353696 = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Block suggested content in Settings app"; + } + + public override string Info() + { + return "To help new Windows 10 users to learn new features of Windows 10, Microsoft has started showing suggested content via a huge banner in Windows 10 Setting Apps. "; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(SubscribedContent338393, "SubscribedContent-338393Enabled", DesiredValue) && + RegistryHelper.IntEquals(SubscribedContent353694, "SubscribedContent-353694Enabled", DesiredValue) && + RegistryHelper.IntEquals(SubscribedContent353696, "SubscribedContent-353696Enabled", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(SubscribedContent338393, "SubscribedContent-338393Enabled", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(SubscribedContent353694, "SubscribedContent-353694Enabled", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(SubscribedContent353696, "SubscribedContent-353696Enabled", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(SubscribedContent338393, "SubscribedContent-338393Enabled", 1, RegistryValueKind.DWord); + Registry.SetValue(SubscribedContent353694, "SubscribedContent-353694Enabled", 1, RegistryValueKind.DWord); + Registry.SetValue(SubscribedContent353696, "SubscribedContent-353696Enabled", 1, RegistryValueKind.DWord); + + return true; + } + catch + { } + + return false; + } + + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Security/DisablePassword.cs b/src/Privatezilla/Settings/Security/DisablePassword.cs new file mode 100644 index 0000000..1bdcda9 --- /dev/null +++ b/src/Privatezilla/Settings/Security/DisablePassword.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Security +{ + internal class DisablePassword : SettingBase + { + private const string PasswordKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CredUI"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Disable password reveal button"; + } + + public override string Info() + { + return "The password reveal button can be used to display an entered password and should be disabled with this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(PasswordKey, "DisablePasswordReveal", DesiredValue) + ); + + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(PasswordKey, "DisablePasswordReveal", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(PasswordKey, "DisablePasswordReveal", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Security/WindowsDRM.cs b/src/Privatezilla/Settings/Security/WindowsDRM.cs new file mode 100644 index 0000000..473d2da --- /dev/null +++ b/src/Privatezilla/Settings/Security/WindowsDRM.cs @@ -0,0 +1,55 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Security +{ + internal class WindowsDRM : SettingBase + { + private const string DRMKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\WMDRM"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Disable DRM in Windows Media Player"; + } + + public override string Info() + { + return "If the Windows Media Digital Rights Management should not get access to the Internet (or intranet) for license acquisition and security upgrades, you can prevent it with this setting."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(DRMKey, "DisableOnline", DesiredValue) + ); + + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(DRMKey, "DisableOnline", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(DRMKey, "DisableOnline", 0, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Updates/BlockMajorUpdates.cs b/src/Privatezilla/Settings/Updates/BlockMajorUpdates.cs new file mode 100644 index 0000000..acf1415 --- /dev/null +++ b/src/Privatezilla/Settings/Updates/BlockMajorUpdates.cs @@ -0,0 +1,59 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Updates +{ + internal class BlockMajorUpdates : SettingBase + { + private const string TargetReleaseVersion = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate"; + private const string TargetReleaseVersionInfo = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate"; + private const int DesiredValue = 1; + + public override string ID() + { + return "Block major Windows updates"; + } + + public override string Info() + { + return "This setting called \"TargetReleaseVersionInfo\" prevents Windows 10 feature updates from being installed until the specified version reaches the end of support.\nIt will specify your currently used Windows 10 version as the target release version of Windows 10 that you wish the system to be on (supports only Pro and enterprise versions)."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(TargetReleaseVersion, "TargetReleaseVersion", DesiredValue) && + RegistryHelper.StringEquals(TargetReleaseVersionInfo, "TargetReleaseVersionInfo", WindowsHelper.GetOS()) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(TargetReleaseVersion, "TargetReleaseVersion", DesiredValue, RegistryValueKind.DWord); + Registry.SetValue(TargetReleaseVersionInfo, "TargetReleaseVersionInfo", WindowsHelper.GetOS(), RegistryValueKind.String); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\WindowsUpdate", true); + RegKey.DeleteValue("TargetReleaseVersion"); + RegKey.DeleteValue("TargetReleaseVersionInfo"); + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Updates/DisableUpdates.cs b/src/Privatezilla/Settings/Updates/DisableUpdates.cs new file mode 100644 index 0000000..555821b --- /dev/null +++ b/src/Privatezilla/Settings/Updates/DisableUpdates.cs @@ -0,0 +1,68 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Updates +{ + internal class DisableUpdates : SettingBase + { + private const string NoAutoUpdate = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"; + private const string AUOptions = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"; + private const string ScheduledInstallDay = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"; + private const string ScheduledInstallTime = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"; + + public override string ID() + { + return "Disable forced Windows updates"; + } + + public override string Info() + { + return "This will notify when updates are available, and you decide when to install them."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(NoAutoUpdate, "NoAutoUpdate",0) && + RegistryHelper.IntEquals(AUOptions, "AUOptions", 2) && + RegistryHelper.IntEquals(ScheduledInstallDay, "ScheduledInstallDay", 0) && + RegistryHelper.IntEquals(ScheduledInstallTime, "ScheduledInstallTime", 3) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(NoAutoUpdate, "NoAutoUpdate", 0, RegistryValueKind.DWord); + Registry.SetValue(AUOptions, "AUOptions", 2, RegistryValueKind.DWord); + Registry.SetValue(ScheduledInstallDay, "ScheduledInstallDay", 0, RegistryValueKind.DWord); + Registry.SetValue(ScheduledInstallTime, "ScheduledInstallTime", 3, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + Registry.SetValue(NoAutoUpdate, "NoAutoUpdate", 1, RegistryValueKind.DWord); + + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\WindowsUpdate\AU", true); + RegKey.DeleteValue("AUOptions"); + RegKey.DeleteValue("ScheduledInstallDay"); + RegKey.DeleteValue("ScheduledInstallTime"); + + return true; + } + catch + {} + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/Settings/Updates/UpdatesSharing.cs b/src/Privatezilla/Settings/Updates/UpdatesSharing.cs new file mode 100644 index 0000000..10afb75 --- /dev/null +++ b/src/Privatezilla/Settings/Updates/UpdatesSharing.cs @@ -0,0 +1,56 @@ +using Microsoft.Win32; + +namespace Privatezilla.Setting.Updates +{ + internal class DisableUpdatesSharing : SettingBase + { + private const string SharingKey = @"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeliveryOptimization"; + private const int DesiredValue = 0; + + public override string ID() + { + return "Disable Windows updates sharing"; + } + + public override string Info() + { + return "Windows 10 lets you download updates from several sources to speed up the process of updating the operating system. This will disable sharing your files by others and exposing your IP address to random computers."; + } + + public override bool CheckSetting() + { + return !( + RegistryHelper.IntEquals(SharingKey, "DODownloadMode", DesiredValue) + ); + } + + public override bool DoSetting() + { + try + { + Registry.SetValue(SharingKey, "DODownloadMode", DesiredValue, RegistryValueKind.DWord); + return true; + } + catch + { } + + return false; + } + + public override bool UndoSetting() + { + try + { + var RegKey = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\DeliveryOptimization", true); + RegKey.DeleteValue("DODownloadMode"); + + return true; + } + catch + { } + + return false; + } + + } +} \ No newline at end of file diff --git a/src/Privatezilla/app.manifest b/src/Privatezilla/app.manifest new file mode 100644 index 0000000..ea37ac5 --- /dev/null +++ b/src/Privatezilla/app.manifest @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + diff --git a/src/Privatezilla/github.png b/src/Privatezilla/github.png new file mode 100644 index 0000000..1ec1583 Binary files /dev/null and b/src/Privatezilla/github.png differ diff --git a/src/Privatezilla/icon.ico b/src/Privatezilla/icon.ico new file mode 100644 index 0000000..49dadb3 Binary files /dev/null and b/src/Privatezilla/icon.ico differ