From e7e533d8c6e51fc4be5892f89dccf06c25c7b721 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Fri, 8 May 2026 10:15:26 -0400 Subject: [PATCH] v0.1.1: GUI auto-elevates, installer stops service before file copy Two fixes for the v0.1.0 install experience: 1. Embed app.manifest with requestedExecutionLevel=requireAdministrator so the GUI always elevates. The named pipe is ACL'd to SYSTEM and the Administrators group, but UAC token splitting puts Admins in deny-only on the standard token, so launching the GUI from the Start Menu fails to connect with "Access is denied". The manifest forces UAC to elevate, surfaces the shield icon on the shortcut, and matches the reality that the GUI cannot function without admin rights. 2. Add a [Code] PrepareToInstall hook to webhook-server.iss that runs `sc stop WebhookServer` before file copy. Upgrade installs were failing on locked binaries because the running service held the exes open. sc returns non-zero on fresh installs (no service yet) which we ignore. Bumps Version to 0.1.1. Co-Authored-By: Claude Opus 4.7 (1M context) --- Directory.Build.props | 2 +- installer/webhook-server.iss | 15 ++++++++++++ .../WebhookServer.Gui.csproj | 1 + src/WebhookServer.Gui/app.manifest | 24 +++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/WebhookServer.Gui/app.manifest diff --git a/Directory.Build.props b/Directory.Build.props index 65b6f43..434a152 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 0.1.0 + 0.1.1 Justin Paul Justin Paul Webhook Server diff --git a/installer/webhook-server.iss b/installer/webhook-server.iss index 36c7314..5e940c8 100644 --- a/installer/webhook-server.iss +++ b/installer/webhook-server.iss @@ -77,3 +77,18 @@ Filename: "powershell.exe"; \ Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{app}\scripts\uninstall-service.ps1"""; \ Flags: runhidden; \ RunOnceId: "RemoveWebhookService" + +[Code] +function PrepareToInstall(var NeedsRestart: Boolean): String; +var + ResultCode: Integer; +begin + Result := ''; + // Stop the running service so its binaries are unlocked before file copy. + // Ignore failure - sc returns non-zero if the service doesn't exist (fresh + // install) or is already stopped, both of which are fine. + Exec(ExpandConstant('{sys}\sc.exe'), 'stop WebhookServer', '', SW_HIDE, + ewWaitUntilTerminated, ResultCode); + // Give the SCM a moment to actually release the executable. + Sleep(2000); +end; diff --git a/src/WebhookServer.Gui/WebhookServer.Gui.csproj b/src/WebhookServer.Gui/WebhookServer.Gui.csproj index 8308673..c0415de 100644 --- a/src/WebhookServer.Gui/WebhookServer.Gui.csproj +++ b/src/WebhookServer.Gui/WebhookServer.Gui.csproj @@ -16,6 +16,7 @@ true true ..\..\resources\webhook-server.ico + app.manifest Webhook Server diff --git a/src/WebhookServer.Gui/app.manifest b/src/WebhookServer.Gui/app.manifest new file mode 100644 index 0000000..fe654a1 --- /dev/null +++ b/src/WebhookServer.Gui/app.manifest @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + +