Service: remove the confusing Update-service menu item; make bin folder user-writable

Ed: a menu item a user has to know when to click is the wrong answer -- real users get
the service via the automatic self-update (version bump), full stop. Remove the menu item.

For developer/tester same-version refreshes, honour "stop it and update it": install now
grants Authenticated Users Modify on the service bin folder (icacls), so once the service
is stopped its binaries can be replaced with no admin -- the exact workflow Ed asked for.
Same trust posture as the auto-update copy (user-writable content run as SYSTEM); noted
for a future code-signed hardening.

The --update-service verb / DoUpdate stay as internal plumbing (no user-facing entry).

Gate: 40/40.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-17 15:09:48 +01:00
co-authored by Claude Opus 4.8
parent 9e75331daf
commit 5dfc4faec6
2 changed files with 30 additions and 4 deletions
+1 -4
View File
@@ -2228,8 +2228,6 @@ public sealed class MainForm : Form
install.Click += (_, _) => ServiceAction(ServiceControl.InstallVerb, "install", confirm: true);
var uninstall = new ToolStripMenuItem("&Uninstall service") { AccessibleName = "Uninstall service" };
uninstall.Click += (_, _) => ServiceAction(ServiceControl.UninstallVerb, "uninstall", confirm: true);
var update = new ToolStripMenuItem("Up&date service to this version") { AccessibleName = "Update service to this version — copies the currently-running RemSound build into the service" };
update.Click += (_, _) => ServiceAction(ServiceControl.UpdateVerb, "update", confirm: false);
var start = new ToolStripMenuItem("S&tart service") { AccessibleName = "Start service" };
start.Click += (_, _) => ServiceAction(ServiceControl.StartVerb, "start", confirm: false);
var stop = new ToolStripMenuItem("Sto&p service") { AccessibleName = "Stop service" };
@@ -2243,7 +2241,7 @@ public sealed class MainForm : Form
{
status, new ToolStripSeparator(),
configure, new ToolStripSeparator(),
install, uninstall, update, start, stop, new ToolStripSeparator(),
install, uninstall, start, stop, new ToolStripSeparator(),
activityLog, updateLog,
});
serviceMenu.DropDownOpening += (_, _) =>
@@ -2263,7 +2261,6 @@ public sealed class MainForm : Form
var installed = state != ServiceState.NotInstalled;
install.Enabled = !installed;
uninstall.Enabled = installed;
update.Enabled = installed; // refresh the service's copy with the running build (stop→copy→start)
start.Enabled = installed && state is ServiceState.Stopped;
stop.Enabled = installed && state is ServiceState.Running;
}