Service: one-click Update-service-to-this-version (no uninstall/reinstall)
Because the service now runs from its own admin-only copy, getting a new build into it meant uninstall+reinstall (two UAC prompts). Add a DoUpdate path + Service-menu item that does it in one: stop -> overwrite the ProgramData bin copy from the running app -> start. Wired as the --update-service verb (elevated), recognised by the service-verb gate. Enabled only when the service is installed; falls back to a plain install if not. Note: the service bin folder stays admin-only writable on purpose (a user-writable SYSTEM binary would be a privilege-escalation hole), so the copy is done elevated via the one UAC prompt rather than in-process. Gate: 40/40. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b8d0fa5a65
commit
fa554cbe35
@@ -1399,7 +1399,7 @@ internal static class SelfTest
|
||||
foreach (var verb in new[]
|
||||
{
|
||||
ServiceControl.RunVerb, ServiceControl.InstallVerb, ServiceControl.UninstallVerb,
|
||||
ServiceControl.StartVerb, ServiceControl.StopVerb,
|
||||
ServiceControl.UpdateVerb, ServiceControl.StartVerb, ServiceControl.StopVerb,
|
||||
})
|
||||
{
|
||||
Check(Program.IsServiceInvocation(new[] { verb }), $"'{verb}' must be recognised as a service invocation");
|
||||
@@ -1417,7 +1417,7 @@ internal static class SelfTest
|
||||
if (!loadedBefore)
|
||||
Check(!IsAssemblyLoaded(svcAsm), "deciding a normal launch must not load the Windows-service assembly");
|
||||
|
||||
return "normal launches stay load-safe; all five service verbs recognised (case-insensitive)";
|
||||
return "normal launches stay load-safe; all six service verbs recognised (case-insensitive)";
|
||||
}
|
||||
|
||||
/// <summary>The Service menu's "View service log" opens the newest diagnostic log — the log that says
|
||||
|
||||
Reference in New Issue
Block a user