Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
-fix #26 for other products os
Greedeks1c0ce846dca7
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex cc07b5f6..6fdeb09e 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -531,10 +531,10 @@<EmbeddedResource Include="Properties\Resources.resx"><Generator>ResXFileCodeGenerator</Generator><LastGenOutput>Resources.Designer.cs</LastGenOutput>+ <SubType>Designer</SubType></EmbeddedResource><None Include="packages.config" /><None Include="Resources\Blank.gz" />- <None Include="Resources\gatherosstatemodified.gz" /><None Include="Resources\hosts.gz" /><None Include="Resources\Tickets.gz" /><None Include="Resources\Ultimate Performance.pow.gz" />diff --git a/.Source/GTweak/Properties/Resources.Designer.cs b/.Source/GTweak/Properties/Resources.Designer.csindex c9cb9961..4c162988 100644--- a/.Source/GTweak/Properties/Resources.Designer.cs+++ b/.Source/GTweak/Properties/Resources.Designer.cs@@ -70,16 +70,6 @@ namespace GTweak.Properties {}}- /// <summary>- /// Поиск локализованного ресурса типа System.Byte[].- /// </summary>- internal static byte[] gatherosstatemodified {- get {- object obj = ResourceManager.GetObject("gatherosstatemodified", resourceCulture);- return ((byte[])(obj));- }- }-/// <summary>/// Поиск локализованного ресурса типа System.Byte[]./// </summary>diff --git a/.Source/GTweak/Properties/Resources.resx b/.Source/GTweak/Properties/Resources.resxindex fde181c4..e5db6074 100644--- a/.Source/GTweak/Properties/Resources.resx+++ b/.Source/GTweak/Properties/Resources.resx@@ -121,9 +121,6 @@<data name="Blank" type="System.Resources.ResXFileRef, System.Windows.Forms"><value>..\Resources\Blank.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>- <data name="gatherosstatemodified" type="System.Resources.ResXFileRef, System.Windows.Forms">- <value>..\Resources\gatherosstatemodified.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </data><data name="hosts" type="System.Resources.ResXFileRef, System.Windows.Forms"><value>..\Resources\hosts.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></data>diff --git a/.Source/GTweak/Resources/Tickets.gz b/.Source/GTweak/Resources/Tickets.gzindex d3b59c5a..0ff8f377 100644Binary files a/.Source/GTweak/Resources/Tickets.gz and b/.Source/GTweak/Resources/Tickets.gz differdiff --git a/.Source/GTweak/Resources/gatherosstatemodified.gz b/.Source/GTweak/Resources/gatherosstatemodified.gzdeleted file mode 100644index 8f0080c3..00000000Binary files a/.Source/GTweak/Resources/gatherosstatemodified.gz and /dev/null differdiff --git a/.Source/GTweak/Utilities/Helpers/Storage/WinKeyStorage.cs b/.Source/GTweak/Utilities/Helpers/Storage/WinKeyStorage.csindex 710a5c7e..f3798175 100644--- a/.Source/GTweak/Utilities/Helpers/Storage/WinKeyStorage.cs+++ b/.Source/GTweak/Utilities/Helpers/Storage/WinKeyStorage.cs@@ -6,17 +6,24 @@ namespace GTweak.Utilities.Helpers.Storage{internal static readonly Dictionary<(string pattern, byte words), string> keysKMS = new Dictionary<(string pattern, byte words), string>{- { ("Home|Single|Language", 3), @"7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH" },{ ("Home", 1), @"TX9XD-98N7V-6WMQ6-BX7FG-H8Q99" },+ { ("Home|N", 2), @"4CPRK-NM3K3-X6XXQ-RXX86-WXCHW" },+ { ("Home|Single|Language", 3), @"7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH" },{ ("Education", 1), @"NW6C2-QMPVW-D7KKK-3GKT6-VCFB2" },- { ("Enterprise|LSTB", 2), @"7YMNV-PG77F-K66KT-KG9VQ-TCQGB" },- { ("Enterprise|N|LTSC", 3), @"92NFX-8DJQP-P6BBQ-THF9C-7CG2H" },+ { ("Education|N", 2), @"WH4N-8QGBV-H22JP-CT43Q-MDWWJ" },+ { ("Enterprise", 1), @"NPPR9-FWDCX-D2C8J-H872K-2YT43" },{ ("Enterprise|N", 2), @"DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4" },{ ("Enterprise|G", 2), @"YYVX9-NTFWV-6MDM3-9PT4T-4M68B" },- { ("Enterprise", 1), @"ND4DX-39KJY-FYWQ9-X6XKT-VCFCF" },- { ("Core|Single|Language", 3), @"BT79Q-G7N6G-PGBYW-4YWX6-6F4BT" },+ { ("Enterprise|LSTB", 2), @"7YMNV-PG77F-K66KT-KG9VQ-TCQGB" },+ { ("Enterprise|LTSC", 2), @"M7XTQ-FN8P6-TTKYV-9D4CC-J462D" },+ { ("Enterprise|N|G", 3), @"44RPN-FTY23-9VTTB-MP9BX-T84FV" },+ { ("Enterprise|N|LTSC", 3), @"92NFX-8DJQP-P6BBQ-THF9C-7CG2H" },{ ("Core", 1), @"KTNPV-KTRK4-3RRR8-39X6W-W44T3" },- { ("Pro", 1), @"W269N-WFGWX-YVC9B-4J6C9-T83GX" }+ { ("Core|Single|Language", 3), @"BT79Q-G7N6G-PGBYW-4YWX6-6F4BT" },+ { ("Pro", 1), @"W269N-WFGWX-YVC9B-4J6C9-T83GX" },+ { ("Pro|N", 2), @"MH37W-N47XK-V7XM9-C7227-GCQG9" },+ { ("Pro|for|Workstations", 3), @"N9FNHH-K3HBT-3W4TD-6383H-6XYWF" },+ { ("Pro|N|for|Workstations", 4), @"9FNHH-K3HBT-3W4TD-6383H-6XYWF" },};internal static readonly Dictionary<(string pattern, byte words), string> keysHWID = new Dictionary<(string pattern, byte words), string>diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.csindex 94c288c0..2c1d244d 100644--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs@@ -81,39 +81,30 @@ namespace GTweak.Utilities.Tweaksnew UnarchiveManager(StoragePaths.FolderLocation + @"\Tickets.json", Properties.Resources.Tickets);+ CommandExecutor.RunCommand($@"/c del /f /q {StoragePaths.SystemDisk}ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\*.xml & del /f /q {StoragePaths.SystemDisk}ProgramData\Microsoft\Windows\ClipSVC\Install\Migration\*.xml");+ string originalGeo = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\International\Geo", "Name", string.Empty);+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", "US", RegistryValueKind.String);+ foreach (string service in new string[] { "ClipSVC", "wlidsvc", "sppsvc", "KeyIso", "LicenseManager", "Winmgmt" })+ CommandExecutor.RunCommand($"sc config {service} start= auto && sc start {service}");+ await Task.Delay(3000);+try{string jsonPath = Path.Combine(StoragePaths.FolderLocation, "Tickets.json");string jsonContent = File.Exists(jsonPath) ? File.ReadAllText(jsonPath) : "[]";List<Metadata> metadataList = JsonConvert.DeserializeObject<List<Metadata>>(jsonContent) ?? new List<Metadata>();- Metadata file = metadataList.FirstOrDefault(f => f.Filename.IndexOf(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "OSProductPfn", string.Empty), StringComparison.OrdinalIgnoreCase) >= 0);-- if (file != null)- {- XDocument xmlDoc = XDocument.Parse(file.Content);- xmlDoc.Save(Path.Combine(StoragePaths.SystemDisk, "ProgramData", "Microsoft", "Windows", "ClipSVC", "GenuineTicket", file.Filename));- await Task.Delay(3000);- CommandExecutor.RunCommand("clipup -v -o", true);- }- else- {- string path = Path.Combine(StoragePaths.FolderLocation, "gatherosstatemodified.exe");- new UnarchiveManager(path, Properties.Resources.gatherosstatemodified);- RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", path, "~ RUNASADMIN WINXPSP3", RegistryValueKind.String);- DateTime userTime = DateTime.Now;- CommandExecutor.RunCommand($"Set-Date -Date '{new DateTime(2022, 10, 11, 12, 0, 0):yyyy-MM-dd HH:mm:ss}'", true);- await Task.Delay(2000);- CommandExecutor.RunCommand($@"{path} /c Pfn={RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "OSProductPfn", string.Empty)};PKeyIID=465145217131314304264339481117862266242033457260311819664735280", true);- await Task.Delay(1000);- CommandExecutor.RunCommand($"Set-Date -Date '{userTime:yyyy-MM-dd HH:mm:ss}'", true);- CommandExecutor.RunCommand($"clipup -v -o -altto {StoragePaths.FolderLocation}", true);- }+ Metadata file = metadataList.FirstOrDefault(f => f.Filename.IndexOf(RegistryHelp.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "OSProductPfn", string.Empty), StringComparison.OrdinalIgnoreCase) >= 0) ?? metadataList.FirstOrDefault(f => f.Filename.Equals("KMS.xml", StringComparison.OrdinalIgnoreCase));+ XDocument xmlDoc = XDocument.Parse(file.Content);+ xmlDoc.Save(Path.Combine(StoragePaths.SystemDisk, "ProgramData", "Microsoft", "Windows", "ClipSVC", "GenuineTicket", "GenuineTicket.xml"));+ await Task.Delay(3000);+ CommandExecutor.RunCommand("clipup -v -o", true);}catch (Exception ex) { Debug.WriteLine(ex.Message); }await Task.Delay(1000);await RunCommand("/c slmgr.vbs //b /ato", 3500);CommandExecutor.RunCommand($"/c timeout /t 10 && rd /s /q {StoragePaths.FolderLocation}");+ RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\International\Geo", "Name", originalGeo, RegistryValueKind.String);new WindowsLicense().LicenseStatus();