Skip to content

Commit

Permalink
Added vc_redist.x64 remove func 🍔
Browse files Browse the repository at this point in the history
  • Loading branch information
Inestic committed Mar 14, 2022
1 parent 3103df1 commit 9401448
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
9 changes: 7 additions & 2 deletions SophiApp/SophiApp/Customisations/CustomisationConstants.cs
Expand Up @@ -198,8 +198,12 @@ internal static class CustomisationConstants
internal const string _348_PRODUCT_NAME = "ProductName";
internal const string _349_DOWNLOAD_URL = "https://aka.ms/vs/17/release/vc_redist.x64.exe";
internal const string _349_VC_REDISTR_FOR_VS_2022 = "Visual C++ Redistributable for Visual Studio 2022";
internal const string _349_VC_REDISTRX64 = "vc_redist.x64.exe";
internal const string _349_VC_REDISTRX64_ARGS = "/install /passive /norestart";
internal const string _349_VC_REDISTRX64_EXE = "vc_redist.x64.exe";
internal const string _349_VC_REDISTRX64_REGISTRY_PATH = @"SOFTWARE\Classes\Installer\Dependencies\VC,redist.x64,amd64,14.31,bundle";
internal const string _349_VC_REDISTRX64_LOG_PATTERN = "dd_vcredist_amd64_*.log";
internal const string _349_VC_REDISTRX64_NAME_PATTERN = "Microsoft Visual C++ 2015-2022 Redistributable (x64)";
internal const string _349_VC_REDISTRX64_UNINSTALL_ARGS = "/uninstall /passive /norestart";
internal const string _349_VC_REDISTRX64_INSTALL_ARGS = "/install /passive /norestart";
internal const string _349_VC_VERSION_URL = "https://raw.githubusercontent.com/aaronparker/vcredist/main/VcRedist/VisualCRedistributables.json";
internal const byte _400_DISABLED_VALUE = 1;
internal const string _400_HIDE_ADDED_APPS = "HideRecentlyAddedApps";
Expand Down Expand Up @@ -626,6 +630,7 @@ function MinimizeWindow
internal const string POLICIES_SYSTEM_PATH = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
internal const string POWERCFG_EXE = "powercfg.exe";
internal const string POWERSHELL_EXE = "powershell.exe";
internal static readonly string ENVIRONMENT_PROGRAM_DATA = Environment.GetEnvironmentVariable("ProgramData");
internal const string PROCESS_AUDIT_DISABLED_ARGS = @"/set /subcategory:""{0CCE922B-69AE-11D9-BED3-505054503030}"" /success:disable /failure:disable";
internal const string PROCESS_AUDIT_ENABLED_ARGS = @"/set /subcategory:""{0CCE922B-69AE-11D9-BED3-505054503030}"" /success:enable /failure:enable";
internal const string PROCESS_CREATION_ENABLED = "ProcessCreationIncludeCmdLine_Enabled";
Expand Down
19 changes: 17 additions & 2 deletions SophiApp/SophiApp/Customisations/CustomisationOs.cs
Expand Up @@ -881,10 +881,25 @@ public static void _349(bool IsChecked)
{
if (IsChecked)
{
var installer = $"{Environment.GetEnvironmentVariable(TEMP)}\\{_349_VC_REDISTRX64}";
var temp = Environment.GetEnvironmentVariable(TEMP);
var installer = $"{temp}\\{_349_VC_REDISTRX64_EXE}";
WebHelper.Download(_349_DOWNLOAD_URL, installer);
ProcessHelper.StartWait(installer, _349_VC_REDISTRX64_ARGS);
ProcessHelper.StartWait(installer, _349_VC_REDISTRX64_INSTALL_ARGS);
FileHelper.TryDeleteFile(installer);
Directory.EnumerateFileSystemEntries(temp, _349_VC_REDISTRX64_LOG_PATTERN)
.ToList()
.ForEach(log => FileHelper.TryDeleteFile(log));

return;
}

var vcRedistrGuid = RegHelper.GetStringValue(RegistryHive.LocalMachine, _349_VC_REDISTRX64_REGISTRY_PATH, null);
var vcCachePath = $@"{ENVIRONMENT_PROGRAM_DATA}\Package Cache\{vcRedistrGuid}\{_349_VC_REDISTRX64_EXE}";
var vcFileVersion = FileVersionInfo.GetVersionInfo(vcCachePath);

if (vcFileVersion.ProductName.Contains(_349_VC_REDISTRX64_NAME_PATTERN))
{
ProcessHelper.StartWait(vcCachePath, _349_VC_REDISTRX64_UNINSTALL_ARGS);
}
}

Expand Down
5 changes: 3 additions & 2 deletions SophiApp/SophiApp/Customisations/CustomisationStatus.cs
Expand Up @@ -183,7 +183,7 @@ public static bool _230() => UwpHelper.PackageExist(_230_UWP_WEB_EXPERIENCE)

public static bool _232() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, _232_SHOW_SECONDS) == ENABLED_VALUE;

public static bool _233() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, TASKBAR_SEARCH_PATH, TASKBAR_SEARCH_MODE) == TASKBAR_SEARCH_HIDE_VALUE;
public static bool _234() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, TASKBAR_SEARCH_PATH, TASKBAR_SEARCH_MODE) == TASKBAR_SEARCH_HIDE_VALUE;

public static bool _235() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, TASKBAR_SEARCH_PATH, TASKBAR_SEARCH_MODE) == TASKBAR_SEARCH_ICON_VALUE;

Expand Down Expand Up @@ -256,7 +256,8 @@ public static bool _259() => RegHelper.GetNullableIntValue(RegistryHive.CurrentU
public static bool _261() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, ADVANCED_EXPLORER_PATH, _261_DISALLOW_WINDOWS_SHAKE) != ENABLED_VALUE;

public static bool _300() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, STORAGE_POLICY_PATH, STORAGE_POLICY_01)
.HasNullOrValue(DISABLED_VALUE).Invert();
.HasNullOrValue(DISABLED_VALUE)
.Invert();

public static bool _302() => RegHelper.GetNullableIntValue(RegistryHive.CurrentUser, STORAGE_POLICY_PATH, STORAGE_POLICY_2048) == _302_STORAGE_POLICY_MONTH_VALUE;

Expand Down

0 comments on commit 9401448

Please sign in to comment.