Skip to content

Portable Tool for an Ideal Windows Setup

-added additional USB audio verification & fix update cache deletion

Greedeks3ff8f806edc1
diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
index d2cdf76c..a7fddb01 100644
--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
@@ -202,7 +202,8 @@ namespace GTweak.Utilities.Configuration
using RegistryKey subKey = regKey.OpenSubKey(subKeyName + @"\Properties");
if (subKey != null)
{
- if (subKey.GetValue("{a45c254e-df1c-4efd-8020-67d146a850e0},24")?.ToString() == "USB" && subKey.GetValue("{b3f8fa53-0004-438e-9003-51a46e139bfc},2")?.ToString()?.Contains(deviceID) == true)
+ if ((subKey.GetValue("{a45c254e-df1c-4efd-8020-67d146a850e0},24")?.ToString().ToLowerInvariant() == "usb" || subKey.GetValue("{a8b865dd-2e3d-4094-ad97-e593a70c75d6},6")?.ToString().ToLowerInvariant().Contains("usb") == true ||
+ subKey.GetValue("{a8b865dd-2e3d-4094-ad97-e593a70c75d6},8")?.ToString().ToLowerInvariant().Contains("usb") == true) && subKey.GetValue("{b3f8fa53-0004-438e-9003-51a46e139bfc},2")?.ToString()?.Contains(deviceID) == true)
{
string value = subKey.GetValue("{b3f8fa53-0004-438e-9003-51a46e139bfc},6")?.ToString();
return (true, value);
diff --git a/.Source/GTweak/Utilities/Helpers/Storage/TaskStorage.cs b/.Source/GTweak/Utilities/Helpers/Storage/TaskStorage.cs
index 6ae9c35c..2e2cea91 100644
--- a/.Source/GTweak/Utilities/Helpers/Storage/TaskStorage.cs
+++ b/.Source/GTweak/Utilities/Helpers/Storage/TaskStorage.cs
@@ -31,6 +31,19 @@
@"Microsoft\Office\OfficeTelemetryAgentLogOn",
@"Microsoft\Office\Office 15 Subscription Heartbeat" };
+ internal static readonly string[] winUpdatesTasks = {
+ @"Microsoft\Windows\UpdateOrchestrator\Report policies",
+ @"Microsoft\Windows\UpdateOrchestrator\Schedule Scan",
+ @"Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task",
+ @"Microsoft\Windows\UpdateOrchestrator\Schedule Work",
+ @"Microsoft\Windows\UpdateOrchestrator\Start Oobe Expedite Work",
+ @"Microsoft\Windows\UpdateOrchestrator\StartOobeAppsScanAfterUpdate",
+ @"Microsoft\Windows\UpdateOrchestrator\StartOobeAppsScan_LicenseAccepted",
+ @"Microsoft\Windows\UpdateOrchestrator\USO_UxBroker",
+ @"Microsoft\Windows\UpdateOrchestrator\UUS Failover Task",
+ @"Microsoft\Windows\WindowsUpdate\Refresh Group Policy Cache",
+ @"Microsoft\Windows\WindowsUpdate\Scheduled Start"};
+
internal static readonly string[] memoryDiagTasks = {
@"Microsoft\Windows\MemoryDiagnostic\ProcessMemoryDiagnosticEvents",
@"Microsoft\Windows\MemoryDiagnostic\RunFullMemoryDiagnostic" };
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index 84db08fa..02e32edf 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -227,20 +227,20 @@ namespace GTweak.Utilities.Tweaks
Task.Run(delegate
{
string value = isChoose ? "4" : "3";
- TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"cmd.exe /c reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WalletService /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\VacSvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\spectrum /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\SharedRealitySvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\perceptionsimulation /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MixedRealityOpenXRSvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\MapsBroker /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\EntAppSvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\embeddedmode /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\wlidsvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\WEPHOSTSVC /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\StorSvc /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\ClipSVC /t REG_DWORD /v Start /d {value} /f & " +
- $"reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\InstallService /t REG_DWORD /v Start /d {value} /f");
+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $@"cmd.exe /c reg add HKLM\SYSTEM\CurrentControlSet\Services\WalletService /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\VacSvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\spectrum /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\SharedRealitySvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\perceptionsimulation /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\MixedRealityOpenXRSvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\MapsBroker /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\EntAppSvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\embeddedmode /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\wlidsvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\WEPHOSTSVC /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\StorSvc /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\ClipSVC /t REG_DWORD /v Start /d {value} /f & " +
+ $@"reg add HKLM\SYSTEM\CurrentControlSet\Services\InstallService /t REG_DWORD /v Start /d {value} /f");
});
break;
case "TglButton5":
@@ -415,20 +415,7 @@ namespace GTweak.Utilities.Tweaks
{
Task.Run(delegate
{
- string cachePath = Path.Combine(StoragePaths.SystemDisk, @"Windows\SoftwareDistribution\Download");
-
- string[] WinUpdateTasks = new string[] {
- @"Microsoft\Windows\UpdateOrchestrator\Report policies",
- @"Microsoft\Windows\UpdateOrchestrator\Schedule Scan",
- @"Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task",
- @"Microsoft\Windows\UpdateOrchestrator\Schedule Work",
- @"Microsoft\Windows\UpdateOrchestrator\Start Oobe Expedite Work",
- @"Microsoft\Windows\UpdateOrchestrator\StartOobeAppsScanAfterUpdate",
- @"Microsoft\Windows\UpdateOrchestrator\StartOobeAppsScan_LicenseAccepted",
- @"Microsoft\Windows\UpdateOrchestrator\USO_UxBroker",
- @"Microsoft\Windows\UpdateOrchestrator\UUS Failover Task",
- @"Microsoft\Windows\WindowsUpdate\Refresh Group Policy Cache",
- @"Microsoft\Windows\WindowsUpdate\Scheduled Start"};
+ string cachePath = $@"{StoragePaths.SystemDisk}Windows\SoftwareDistribution\Download";
try
{
@@ -443,13 +430,23 @@ namespace GTweak.Utilities.Tweaks
}
TakingOwnership.GrantAdministratorsAccess(cachePath, TakingOwnership.SE_OBJECT_TYPE.SE_UNKNOWN_OBJECT_TYPE);
- Directory.Delete(cachePath, true);
+
+ string[] files = Directory.GetFiles(cachePath);
+ foreach (string file in files)
+ {
+ File.SetAttributes(file, FileAttributes.Normal);
+ File.Delete(file);
+ }
+
+ string[] directories = Directory.GetDirectories(cachePath);
+ foreach (string path in directories)
+ Directory.Delete(path, true);
}
- SetTaskStateOwner(false, WinUpdateTasks);
+ SetTaskStateOwner(false, winUpdatesTasks);
}
else
- SetTaskStateOwner(true, WinUpdateTasks);
+ SetTaskStateOwner(true, winUpdatesTasks);
}
catch (Exception ex) { Debug.WriteLine(ex); }
});