Skip to content

Fix Windows installer cleanup#8576

Open
atavism wants to merge 5 commits intomainfrom
atavism/windows-service-delete
Open

Fix Windows installer cleanup#8576
atavism wants to merge 5 commits intomainfrom
atavism/windows-service-delete

Conversation

@atavism
Copy link
Contributor

@atavism atavism commented Mar 25, 2026

Copilot AI review requested due to automatic review settings March 25, 2026 14:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Windows Inno Setup installer to improve cleanup behavior during install/upgrade, addressing stale uninstall entries and pre-install service handling (issue #3103).

Changes:

  • Enable automatic closing of running applications during setup (CloseApplications=yes, RestartApplications=no).
  • Move service stop/delete logic from [Run] into PascalScript (CurStepChanged) and wait for the service to be fully deleted before continuing.
  • Add startup cleanup to remove stale uninstall registry entries whose uninstaller executable is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +324 to +352
function ExtractExecutablePath(const CommandLine: String): String;
var
S: String;
EndQuote: Integer;
FirstSpace: Integer;
begin
S := Trim(CommandLine);
if S = '' then begin
Result := '';
exit;
end;

if S[1] = '"' then begin
Delete(S, 1, 1);
EndQuote := Pos('"', S);
if EndQuote > 0 then begin
Result := Copy(S, 1, EndQuote - 1);
end else begin
Result := S;
end;
exit;
end;

FirstSpace := Pos(' ', S);
if FirstSpace > 0 then begin
Result := Copy(S, 1, FirstSpace - 1);
end else begin
Result := S;
end;
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExtractExecutablePath will incorrectly parse an unquoted executable path that contains spaces (e.g., C:\Program Files\...\unins*.exe /SILENT), returning C:\Program and causing RemoveStaleUninstallEntry to delete a valid uninstall registry key. Consider extracting up to the first .exe (or using a more robust command-line parser) before deciding the entry is stale.

Copilot uses AI. Check for mistakes.
Comment on lines +320 to +322
ServiceStopTimeoutMs = 20000;
ServicePollIntervalMs = 250;
UninstallRegSubKey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}_is1';
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServiceStopTimeoutMs is used as the timeout for waiting on service deletion (WaitForServiceDelete), not for waiting on the service to stop. Renaming this constant (or splitting stop vs delete timeouts) would make the intent clearer and reduce confusion for future changes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants