Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ shared between the two views and is never removed.
Deliver a header through policy as usual. The next elevated run moves it into that key and
blanks the copy in policy, which every user can read. The policy value is emptied, not deleted,
so the setting still shows as managed. The GUI shows a saved header masked and saves a new one
only after Unlock. BootstrapMate never writes a header to its logs, `session.json` or
when you click Save on the Prefs tab. BootstrapMate never writes a header to its logs, `session.json` or
`last-run.json`, and it redacts `--headers` from every logged command line.

## Reporting
Expand Down Expand Up @@ -318,6 +318,14 @@ policy for each, and either one locks the Prefs tab's "Show progress dialog" swi
sets the dialog's icon. `SilentMode` and `VerboseMode` from policy or settings turn
those modes on, and a CLI switch cannot turn them off.

The GUI Prefs tab edits every setting that policy does not manage; policy-set fields show in gray
under one note at the top of the tab. Edits stay pending until you click Save, which writes them to
`HKLM\SOFTWARE\BootstrapMate\Settings`. An unelevated GUI asks for administrator approval at that
point and runs a headless, elevated copy of itself (`--apply-settings <pipe>`). The values travel
over a named pipe that only the user, Administrators and SYSTEM can open, never through a file.
The writer re-reads policy and never writes a managed value. Declining the prompt keeps the edits
pending.

## csharpDialog authorisation key

When csharpDialog is managed with an authorisation key, it opens only for a caller that
Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapMate.App/BootstrapMate.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<!-- Suppress MVVMTK0045: field-based [ObservableProperty] AOT warning.
Partial property approach fails with current WinUI XAML compiler + CsWinRT combination. -->
<NoWarn>$(NoWarn);MVVMTK0045</NoWarn>
<!-- Program.cs owns Main so the headless settings writer starts without XAML. -->
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN</DefineConstants>
</PropertyGroup>

<!-- Build timestamp for version display -->
Expand Down
7 changes: 2 additions & 5 deletions src/BootstrapMate.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ public MainWindow()
// Apply Mica backdrop for modern Windows 11 look
SystemBackdrop = new MicaBackdrop();

// Open on Prefs when asked to (the elevated relaunch from Unlock passes --prefs);
// Prefs is also the first tab, so this is the default either way.
NavView.SelectedItem = BootstrapMate.Core.PrefsElevation.OpensOnPrefs(Environment.GetCommandLineArgs().Skip(1))
? NavView.MenuItems.OfType<NavigationViewItem>().First(i => (string?)i.Tag == "prefs")
: NavView.MenuItems[0];
// Prefs is the first tab.
NavView.SelectedItem = NavView.MenuItems[0];
}

private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
Expand Down
31 changes: 31 additions & 0 deletions src/BootstrapMate.App/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using BootstrapMate.Core;

namespace BootstrapMate.App;

/// <summary>
/// Entry point. Replaces the XAML-generated Main (DISABLE_XAML_GENERATED_MAIN) so the elevated
/// settings writer (--apply-settings &lt;pipe&gt;) runs headless and exits before any window exists.
/// </summary>
public static class Program
{
[STAThread]
private static int Main(string[] args)
{
if (PrefsSettingsWriter.IsApplyRequest(args))
{
return PrefsSettingsWriter.ApplyPipeName(args) is { } pipeName
? PrefsSettingsWriter.Apply(pipeName)
: PrefsSettingsWriter.ExitUsage;
}

WinRT.ComWrappersSupport.InitializeComWrappers();
Microsoft.UI.Xaml.Application.Start(p =>
{
var context = new Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(
Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread());
SynchronizationContext.SetSynchronizationContext(context);
new App();
});
return 0;
}
}
Loading
Loading