Skip to content

Commit b7c9a87

Browse files
added option to enable verbose status when logging in and shutting down, added directory optimization option for explorer.exe and fixed a bug in the settings loader where the file stream did not advance when a field was disabled, which led to incorrect offsets
1 parent 0c965c5 commit b7c9a87

File tree

8 files changed

+63
-22
lines changed

8 files changed

+63
-22
lines changed

OS Stimulator.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@
205205
<ItemGroup>
206206
<Resource Include="Program\Privacy_and_Security\_notes.txt" />
207207
</ItemGroup>
208+
<ItemGroup>
209+
<Resource Include="notes.txt" />
210+
</ItemGroup>
208211
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
209212
<PropertyGroup>
210213
<PostBuildEvent>call ..\..\Build-Incrementor.exe ..\..\Properties\AssemblyInfo.cs</PostBuildEvent>

Program/Applications/ImageGlass.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ private static async Task ImageGlass() => await Task.Run(() =>
5151
Directory.CreateDirectory(RunContextInfo.Windows.UserHomePath + "\\AppData\\Local\\ImageGlass");
5252

5353
File.Copy(RunContextInfo.ExecutablePath + "\\assets\\ImageGlass\\igconfig.json", RunContextInfo.Windows.UserHomePath + "\\AppData\\Local\\ImageGlass\\igconfig.json");
54+
File.Copy(RunContextInfo.ExecutablePath + "\\assets\\ImageGlass\\igconfig.json", "C:\\Program Files\\ImageGlass\\igconfig.json");
5455

5556
Log.FastLog("Done", LogSeverity.Info, IMAGEGLASS_SOURCE);
5657
}

Program/OptionSelector.xaml.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,25 +175,25 @@ private void None_Click(Object sender, RoutedEventArgs e)
175175
private unsafe void Save_Click(Object sender, RoutedEventArgs e)
176176
{
177177
redo:
178-
OpenFileDialog openFileDialog = new();
179-
openFileDialog.InitialDirectory = RunContextInfo.ExecutablePath;
180-
openFileDialog.FileName = _configuration.Filename;
181-
openFileDialog.CheckFileExists = false;
182-
openFileDialog.Filter = "Configuration file (*.cfg)|*.cfg|All files (*.*)|*.*";
183-
openFileDialog.FilterIndex = 1;
184-
openFileDialog.Title = "Select " + Title + " file";
178+
SaveFileDialog saveFileDialog = new();
179+
saveFileDialog.InitialDirectory = RunContextInfo.ExecutablePath;
180+
saveFileDialog.FileName = _configuration.Filename;
181+
saveFileDialog.CheckFileExists = false;
182+
saveFileDialog.Filter = "Configuration file (*.cfg)|*.cfg|All files (*.*)|*.*";
183+
saveFileDialog.FilterIndex = 1;
184+
saveFileDialog.Title = "Select " + Title + " file";
185185

186-
if (!(Boolean)openFileDialog.ShowDialog()!) return;
186+
if (!(Boolean)saveFileDialog.ShowDialog()!) return;
187187

188188
FileStream fileStream;
189189

190190
try
191191
{
192-
fileStream = new(openFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.Read, 4096, false);
192+
fileStream = new(saveFileDialog.FileName, FileMode.Create, FileAccess.Write, FileShare.Read, 4096, FileOptions.SequentialScan);
193193
}
194194
catch (Exception exception)
195195
{
196-
Log.FastLog($"Failed to open '{openFileDialog.FileName}' in write mode: {exception.Message}", LogSeverity.Error, "SaveConfig");
196+
Log.FastLog($"Failed to open '{saveFileDialog.FileName}' in write mode: {exception.Message}", LogSeverity.Error, "SaveConfig");
197197
goto redo;
198198
}
199199

@@ -207,7 +207,7 @@ private unsafe void Save_Click(Object sender, RoutedEventArgs e)
207207

208208
fileStream.Flush(true);
209209

210-
Log.FastLog($"Wrote config for '{Title}' to {openFileDialog.FileName}", LogSeverity.Info, "SaveConfig");
210+
Log.FastLog($"Wrote config for '{Title}' to {saveFileDialog.FileName}", LogSeverity.Info, "SaveConfig");
211211

212212
fileStream.Close();
213213
fileStream.Dispose();
@@ -230,7 +230,7 @@ private unsafe void Load_Click(Object sender, RoutedEventArgs e)
230230

231231
try
232232
{
233-
fileStream = new(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, false);
233+
fileStream = new(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.SequentialScan);
234234
}
235235
catch (Exception exception)
236236
{
@@ -250,7 +250,11 @@ private unsafe void Load_Click(Object sender, RoutedEventArgs e)
250250

251251
for (Int32 i = 0; i < _optionsLength; ++i)
252252
{
253-
if (!_checkBoxes[i].IsEnabled) continue;
253+
if (!_checkBoxes[i].IsEnabled)
254+
{
255+
++fileStream.Position;
256+
continue;
257+
}
254258

255259
Byte isChecked = (Byte)fileStream.ReadByte();
256260
_checkBoxes[i].IsChecked = *(Boolean*)&isChecked;

Program/Privacy_and_Security/AttackSurfaceReduction.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private static Task AttackSurfaceReduction()
2929
catch
3030
{
3131
System.Windows.Forms.MessageBox.Show(
32-
"Unable to set asr rules, Windows Defender not installed or broken powershell integration.",
32+
"Unable to set ASR rules, Windows Defender not installed or broken powershell integration.",
3333
"Not supported",
3434
System.Windows.Forms.MessageBoxButtons.OK,
3535
System.Windows.Forms.MessageBoxIcon.Error);
@@ -56,22 +56,22 @@ private static Task AttackSurfaceReduction()
5656

5757
OptionSelector.Option[] options =
5858
[
59-
new(false, false, "Block abuse of exploited vulnerable signed drivers", null!),
59+
new(false, false, "*Block abuse of exploited vulnerable signed drivers", "breaks MSI Afterburner"),
6060
new(false, false, "Block Adobe Reader from creating child processes", null!),
6161
new(false, false, "Block all Office applications from creating child processes", null!),
6262
new(false, false, "Block credential stealing from the Windows local security authority subsystem (lsass.exe)", null!),
6363
new(false, false, "Block executable content from email client and webmail", null!),
64-
new(false, false, "Block executable files from running unless they meet a prevalence, age, or trusted list criterion", null!),
64+
new(false, false, "*Block executable files from running unless they meet a prevalence, age, or trusted list criterion", "breaks things"),
6565
new(false, false, "Block execution of potentially obfuscated scripts", null!),
6666
new(false, false, "Block JavaScript or VBScript from launching downloaded executable content", null!),
6767
new(false, false, "Block Office applications from creating executable content", null!),
6868
new(false, false, "Block Office applications from injecting code into other processes", null!),
6969
new(false, false, "Block Office communication application from creating child processes", null!),
7070
new(false, false, "Block persistence through WMI event subscription. (file and folder exclusions not supported)", null!),
71-
new(false, false, "Block process creations originating from PSExec and WMI commands", null!),
71+
new(false, false, "*Block process creations originating from PSExec and WMI commands", "breaks Windows Server Manager"),
7272
new(false, false, "Block rebooting machine in Safe Mode (preview)", null!),
7373
new(false, false, "Block untrusted and unsigned processes that run from USB", null!),
74-
new(false, false, "Block use of copied or impersonated system tools (preview)", null!),
74+
new(false, false, "*Block use of copied or impersonated system tools (preview)", "breaks VeraCrypt"),
7575
new(false, false, "Block Webshell creation for Servers", null!),
7676
new(false, false, "Block Win32 API calls from Office macros", null!),
7777
new(false, false, "Use advanced protection against ransomware", null!),

Program/Privacy_and_Security/SystemSecurity/Harden.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private async static Task Harden()
3131
new(false, false, "Set default app for .cmd to notepad", null!),
3232
new(true, false, "Set default app for .vbs to notepad", null!),
3333
new(true, false, "Set default app for .vbe to notepad", null!),
34-
new(true, false, "*Block system apps in firewall (see tooltip)", "notepad.exe, regsvr32.exe, mshta.exe, wscript.exe, cscript.exe, runscripthelper.exe, hh.exe"),
34+
new(true, false, "*Block system apps in firewall (see tooltip)", "notepad.exe, regsvr32.exe, mshta.exe, wscript.exe, cscript.exe, runscripthelper.exe, hh.exe"),
3535
new(true, false, "Deactivate anonymous Sam-Account enumeration", null!),
3636
new(true, false, "Activate Anti-spoof for facial recognition", null!),
3737
new(true, false, "Deactivate camera on locked screen", null!),

Program/System_Base_Configuration/Pacify.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ private async static Task Pacify()
4040
new(true, false, "Disable OneDrive Notifications in Explorer", null!),
4141
new(true, false, "Show more apps in the start menu", null!),
4242
new(true, false, "Enable Numlock on start", null!),
43+
new(true, false, "*Don't automatically choose the appropriate folder type", "This will speed up file explorer browsing in large directories, where normally it would first index all files and load all preview images of all videos"),
4344
];
4445

45-
OptionSelector optionSelector = new("Streamline & Pacify", options, new(true, 0, "pacify.cfg"));
46+
OptionSelector optionSelector = new("Streamline & Pacify", options, new(true, 1, "pacify.cfg"));
4647
optionSelector.ShowDialog();
4748

4849
if (!optionSelector.Result.CommitSelection) return;
@@ -522,6 +523,24 @@ await Task.Run(() =>
522523
Log.FastLog("[MACHINE] Enabling Numlock after boot failed with: " + exception.Message, LogSeverity.Error, PACIFY_SOURCE);
523524
}
524525

526+
try
527+
{
528+
if (optionSelector.Result.UserSelection[27])
529+
{
530+
Log.FastLog("[User] Don't automatically choose the appropriate folder type", LogSeverity.Info, PACIFY_SOURCE);
531+
532+
RegistryKey shell = Registry.CurrentUser.OpenSubKey("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell", true);
533+
shell?.DeleteSubKeyTree("BagMRU", false);
534+
shell?.DeleteSubKeyTree("Bags", false);
535+
536+
Registry.SetValue("HKEY_CURRENT_USER\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell", "FolderType", "NotSpecified", RegistryValueKind.String);
537+
}
538+
}
539+
catch (Exception exception)
540+
{
541+
Log.FastLog("[User] Don't automatically choose the appropriate folder type failed with: " + exception.Message, LogSeverity.Error, PACIFY_SOURCE);
542+
}
543+
525544
Util.RestartExplorerForUser();
526545
});
527546

Program/System_Base_Configuration/StabilityReliability.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ private async static Task StabilityReliability()
2626
new(true, false, "*Remove dynamic user home directory links", "By default, the documents, video and image folders are linked to each other,\nthis can lead to some unexpected behavior,\nlike copying the contents of all folders when only copying the documents folder."),
2727
new(true, false, "*Use old boot policy", "Allows to enter the recovery menu during boot (F8)"),
2828
new(true, false, "*Enable BSoD messages", "The old bluescreen of death | more crash information"),
29+
new(true, false, "*Verbose System Status", "This is on by default on Windows Server | for example shows: Ending Services, Waiting for session manager etc instead of Shutting down"),
2930
new(true, false, "*Show 'End Task' Button", "Allows you to end a task when right clicking an app in the task bar"),
3031
];
3132

32-
OptionSelector optionSelector = new("Stability & Reliability", options, new(true, 0, "stability.cfg"));
33+
OptionSelector optionSelector = new("Stability & Reliability", options, new(true, 1, "stability.cfg"));
3334
optionSelector.ShowDialog();
3435

3536
if (!optionSelector.Result.CommitSelection) return;
@@ -203,6 +204,19 @@ await Task.Run(() =>
203204
try
204205
{
205206
if (optionSelector.Result.UserSelection[10])
207+
{
208+
Log.FastLog("[MACHINE] Enabling Verbose System Status", LogSeverity.Info, STABILITY_RELIABILITY_SOURCE);
209+
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "VerboseStatus", 1, RegistryValueKind.DWord);
210+
}
211+
}
212+
catch (Exception exception)
213+
{
214+
Log.FastLog("[MACHINE] Enabling Verbose System Status failed with: " + exception.Message, LogSeverity.Error, STABILITY_RELIABILITY_SOURCE);
215+
}
216+
217+
try
218+
{
219+
if (optionSelector.Result.UserSelection[11])
206220
{
207221
Log.FastLog("[USER] Enabling 'End Task' Button", LogSeverity.Info, STABILITY_RELIABILITY_SOURCE);
208222
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings", "TaskbarEndTask", 1, RegistryValueKind.DWord);

Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
)]
2424

2525
[assembly: AssemblyVersion("1.0.0.0")]
26-
[assembly: AssemblyFileVersion("1.0.0.776")]
26+
[assembly: AssemblyFileVersion("1.0.0.796")]
2727
[assembly: AssemblyInformationalVersion("api testing")]

0 commit comments

Comments
 (0)