From 09b00a5f85e61d0dd3e23f32383482c0cba049be Mon Sep 17 00:00:00 2001 From: theitaliandeveloper Date: Wed, 29 Oct 2025 13:37:05 +0100 Subject: [PATCH] Stuff --- Perfect11.sln | 6 ++ Perfect11/Library/Utilities.cs | 8 --- Perfect11/Properties/Resources.resx | 3 + .../Perfect11.Inbox.DisableVBS.csproj | 55 +++++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++++++ tweaks/Perfect11.Inbox.DisableVBS/Tweak.cs | 70 +++++++++++++++++++ .../Perfect11.Inbox.RemoveWindowsAI/Tweak.cs | 3 +- 7 files changed, 169 insertions(+), 9 deletions(-) create mode 100644 tweaks/Perfect11.Inbox.DisableVBS/Perfect11.Inbox.DisableVBS.csproj create mode 100644 tweaks/Perfect11.Inbox.DisableVBS/Properties/AssemblyInfo.cs create mode 100644 tweaks/Perfect11.Inbox.DisableVBS/Tweak.cs diff --git a/Perfect11.sln b/Perfect11.sln index 69c9905..615c708 100644 --- a/Perfect11.sln +++ b/Perfect11.sln @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.Widgets", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.UninstallEdge", "tweaks\Perfect11.Inbox.UninstallEdge\Perfect11.Inbox.UninstallEdge.csproj", "{A33DF785-C123-48E2-B21E-A229FC8FFB55}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfect11.Inbox.DisableVBS", "tweaks\Perfect11.Inbox.DisableVBS\Perfect11.Inbox.DisableVBS.csproj", "{998241DA-25C9-4CB6-B893-7158A387C030}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -63,6 +65,10 @@ Global {A33DF785-C123-48E2-B21E-A229FC8FFB55}.Debug|Any CPU.Build.0 = Debug|Any CPU {A33DF785-C123-48E2-B21E-A229FC8FFB55}.Release|Any CPU.ActiveCfg = Release|Any CPU {A33DF785-C123-48E2-B21E-A229FC8FFB55}.Release|Any CPU.Build.0 = Release|Any CPU + {998241DA-25C9-4CB6-B893-7158A387C030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {998241DA-25C9-4CB6-B893-7158A387C030}.Debug|Any CPU.Build.0 = Debug|Any CPU + {998241DA-25C9-4CB6-B893-7158A387C030}.Release|Any CPU.ActiveCfg = Release|Any CPU + {998241DA-25C9-4CB6-B893-7158A387C030}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Perfect11/Library/Utilities.cs b/Perfect11/Library/Utilities.cs index 26c406b..60ff62a 100644 --- a/Perfect11/Library/Utilities.cs +++ b/Perfect11/Library/Utilities.cs @@ -69,26 +69,19 @@ namespace Perfect11.Library { try { - // Use your PowerShell.Execute helper string packageFullName = PowerShell.Execute( "Get-AppxPackage -AllUsers | Where-Object { $_.PackageFullName -like '*" + app +"*' } | Select-Object -ExpandProperty PackageFullName" ); - if (string.IsNullOrWhiteSpace(packageFullName)) { return "Sticky Notes package not found."; } - Console.WriteLine($"Found package: {packageFullName}"); - - // Get current user SID string userSid = WindowsIdentity.GetCurrent().User?.Value; if (string.IsNullOrEmpty(userSid)) { return "Unable to get current user SID."; } - - // Registry base path string basePath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore"; string[] subKeys = { @@ -96,7 +89,6 @@ namespace Perfect11.Library $@"EndOfLife\S-1-5-18\{packageFullName}", $@"Deprovisioned\{packageFullName}" }; - foreach (var subKey in subKeys) { try diff --git a/Perfect11/Properties/Resources.resx b/Perfect11/Properties/Resources.resx index f348e7a..4e9ef1a 100644 --- a/Perfect11/Properties/Resources.resx +++ b/Perfect11/Properties/Resources.resx @@ -120,12 +120,15 @@ ..\Resources\EI.CFG.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + EI.CFG for Windows ..\Resources\unattend-OOBEAutomate.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + Unattend.xml for OOBE automation ..\Resources\UWPSystemAppList.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + List of UWP System Apps ..\Resources\Images\win11logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/tweaks/Perfect11.Inbox.DisableVBS/Perfect11.Inbox.DisableVBS.csproj b/tweaks/Perfect11.Inbox.DisableVBS/Perfect11.Inbox.DisableVBS.csproj new file mode 100644 index 0000000..ae4ea70 --- /dev/null +++ b/tweaks/Perfect11.Inbox.DisableVBS/Perfect11.Inbox.DisableVBS.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {998241DA-25C9-4CB6-B893-7158A387C030} + Library + Properties + Perfect11.Inbox.DisableVBS + Perfect11.Inbox.DisableVBS + v4.8 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {b3f8761a-b4b2-4378-9fe8-06bbfc39fce6} + Perfect11.TweaksInterface + False + + + + \ No newline at end of file diff --git a/tweaks/Perfect11.Inbox.DisableVBS/Properties/AssemblyInfo.cs b/tweaks/Perfect11.Inbox.DisableVBS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..93215aa --- /dev/null +++ b/tweaks/Perfect11.Inbox.DisableVBS/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Perfect11 Inbox Tweaks")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Vichingo455")] +[assembly: AssemblyProduct("Perfect11")] +[assembly: AssemblyCopyright("Copyright © 2025 Vichingo455")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("998241da-25c9-4cb6-b893-7158a387c030")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tweaks/Perfect11.Inbox.DisableVBS/Tweak.cs b/tweaks/Perfect11.Inbox.DisableVBS/Tweak.cs new file mode 100644 index 0000000..879bc2e --- /dev/null +++ b/tweaks/Perfect11.Inbox.DisableVBS/Tweak.cs @@ -0,0 +1,70 @@ +using Microsoft.Win32; +using Perfect11.TweaksInterface; +using System; +using System.Diagnostics; +using System.IO; + +namespace Perfect11.Inbox.DisableVBS +{ + public class Tweak : IPlugin + { + public string Name => "Disable VBS"; + public string Description => "Disables Virtualization Based Security and Credential Guard (requires additional steps)"; + public string Category => "Annoyances"; + public string Execute() + { + void RunCommand(string command) + { + var psi = new ProcessStartInfo("cmd.exe", "/c " + command) + { + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + //Verb = "runas" + }; + + using (var process = Process.Start(psi)) + { + process.WaitForExit(); + if (process.ExitCode != 0) + { + throw new InvalidOperationException($"Comando fallito: {command}"); + } + } + } + try + { + Registry.SetValue( + @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa", + "LsaCfgFlags", + 0, + RegistryValueKind.DWord + ); + Registry.SetValue( + @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceGuard", + "LsaCfgFlags", + 0, + RegistryValueKind.DWord + ); + RunCommand("mountvol X: /s"); + string windowsDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows); + string source = Path.Combine(windowsDir, @"System32\SecConfig.efi"); + string dest = @"X:\EFI\Microsoft\Boot\SecConfig.efi"; + Directory.CreateDirectory(Path.GetDirectoryName(dest)); + File.Copy(source, dest, true); + RunCommand(@"bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d ""DebugTool"" /application osloader"); + RunCommand(@"bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path ""\EFI\Microsoft\Boot\SecConfig.efi"""); + RunCommand(@"bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}"); + RunCommand(@"bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS"); + RunCommand(@"bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:"); + RunCommand("mountvol X: /d"); + return "Disabling Credential Guard is almost done!\r\nNow, restart your system and when asked, press F3 or the Windows key to disable both credential guard and virtualization based security.\r\nAfter reboot, you might need to set up your PIN again."; + } + catch (Exception ex) + { + throw new Exception("Error: " + ex.Message); + } + } + } +} diff --git a/tweaks/Perfect11.Inbox.RemoveWindowsAI/Tweak.cs b/tweaks/Perfect11.Inbox.RemoveWindowsAI/Tweak.cs index be29ae9..f0b1ab1 100644 --- a/tweaks/Perfect11.Inbox.RemoveWindowsAI/Tweak.cs +++ b/tweaks/Perfect11.Inbox.RemoveWindowsAI/Tweak.cs @@ -1,4 +1,5 @@ using Perfect11.TweaksInterface; +using System; using System.Diagnostics; using System.Windows.Forms; @@ -37,7 +38,7 @@ namespace Perfect11.Inbox.RemoveWindowsAI } else { - return "Operation aborted by user."; + throw new Exception("Operation aborted by user."); } } }