Skip to content

Commit

Permalink
Add additional Windows Explorer options
Browse files Browse the repository at this point in the history
  • Loading branch information
cschneegans committed Jul 31, 2024
1 parent f6c3f9f commit e0554ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ public record class Configuration(
bool VMwareTools,
bool VirtIoGuestTools,
bool PreventDeviceEncryption,
bool ClassicContextMenu
bool ClassicContextMenu,
bool ShowFileExtensions,
HideModes HideFiles
)
{
public static Configuration Default => new(
Expand Down Expand Up @@ -312,7 +314,9 @@ bool ClassicContextMenu
VMwareTools: false,
VirtIoGuestTools: false,
PreventDeviceEncryption: false,
ClassicContextMenu: false
ClassicContextMenu: false,
ShowFileExtensions: false,
HideFiles: HideModes.Hidden
);
}

Expand Down
31 changes: 30 additions & 1 deletion modifier/Optimizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ public record class EnabledProcessAuditSettings(
bool IncludeCommandLine
) : IProcessAuditSettings;

public enum HideModes
{
None, HiddenSystem, Hidden
}

public class DisabledProcessAuditSettings : IProcessAuditSettings;

class OptimizationsModifier(ModifierContext context) : Modifier(context)
Expand All @@ -18,6 +23,30 @@ public override void Process()
{
CommandAppender appender = GetAppender(CommandConfig.Specialize);

{
IEnumerable<string> SetExplorerOptions(string rootKey, string subKey)
{
if (Configuration.ShowFileExtensions)
{
yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""HideFileExt"" /t REG_DWORD /d 0 /f");
}

switch (Configuration.HideFiles)
{
case HideModes.None:
yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f");
yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""ShowSuperHidden"" /t REG_DWORD /d 1 /f");
break;
case HideModes.HiddenSystem:
yield return CommandBuilder.RegistryCommand(@$"add ""{rootKey}\{subKey}\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"" /v ""Hidden"" /t REG_DWORD /d 1 /f");
break;
case HideModes.Hidden:
break;
}
}
appender.Append(CommandBuilder.RegistryDefaultUserCommand(SetExplorerOptions));
}

if (Configuration.DisableDefender)
{
if (Configuration.DisableDefenderPE)
Expand Down Expand Up @@ -58,7 +87,7 @@ public override void Process()
);
}

if(Configuration.DisableSac)
if (Configuration.DisableSac)
{
appender.Append(
CommandBuilder.RegistryCommand(@"add ""HKLM\SYSTEM\CurrentControlSet\Control\CI\Policy"" /v VerifiedAndReputablePolicyState /t REG_DWORD /d 0 /f")
Expand Down

0 comments on commit e0554ae

Please sign in to comment.