Setup: Fix modern uninstaller wizard and legacy uninstall launch behavior#2980
Open
NotEnsoul wants to merge 3 commits into
Open
Setup: Fix modern uninstaller wizard and legacy uninstall launch behavior#2980NotEnsoul wants to merge 3 commits into
NotEnsoul wants to merge 3 commits into
Conversation
Contributor
Author
|
i also added a uninstall welcome page because it felt weird leaving it like that |
dmex
added a commit
that referenced
this pull request
Jul 7, 2026
Co-Authored-By: NotEnsoul <285614582+NotEnsoul@users.noreply.github.com>
dmex
approved these changes
Jul 7, 2026
There was a problem hiding this comment.
Pull request overview
Fixes uninstall behavior in CustomSetupTool for both the modern wizard and the legacy TaskDialog flow, ensuring the correct UI/pages are shown for uninstallation and that the app is not incorrectly launched after a cancelled/failed uninstall. It also improves UAC-cancel handling to avoid spurious error dialogs.
Changes:
- Adds dedicated uninstall wizard pages/flow and wires uninstall progress/completion/error UI states.
- Introduces a
SetupCompletedflag to gate “start application” behavior in the legacy TaskDialog flow. - Suppresses error reporting when elevation is cancelled and updates dialog resources/IDs for the new uninstall UI.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/CustomSetupTool/wizard.c | Adds uninstall wizard page/proc, updates wizard routing/captions, and adjusts uninstall-specific UI text and error handling. |
| tools/CustomSetupTool/uninstall.c | Sets SetupCompleted on successful uninstall and posts uninstall-final messages. |
| tools/CustomSetupTool/setup.h | Extends PH_SETUP_CONTEXT flags with SetupCompleted and declares the new uninstall page proc. |
| tools/CustomSetupTool/resource.rc | Adds IDD_UNINSTALL_WELCOME, adds uninstall “remove settings” checkbox, and fixes subtitle control IDs on completed/error pages. |
| tools/CustomSetupTool/resource.h | Adds new dialog/control IDs for uninstall welcome and remove-settings checkbox. |
| tools/CustomSetupTool/main.c | Prevents launching the application unless install completed successfully in legacy TaskDialog flow. |
| tools/CustomSetupTool/install.c | Sets SetupCompleted on successful install completion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1198
to
+1210
| switch (header->code) | ||
| { | ||
| case PSN_SETACTIVE: | ||
| SetupSetWizardButtons(WindowHandle, PSWIZB_BACK | PSWIZB_NEXT, TRUE, TRUE, FALSE, TRUE); | ||
| SetupSetWizardButtonText(context->ParentWindowHandle, IDC_PROPSHEET_NEXT, L"Uninstall"); | ||
| if (!PhGetOwnTokenAttributes().Elevated) | ||
| { | ||
| Button_SetElevationRequiredState(GetDlgItem(context->ParentWindowHandle, IDC_PROPSHEET_NEXT), TRUE); | ||
| } | ||
| break; | ||
| case PSN_QUERYCANCEL: | ||
| return !SetupCancelWizard(WindowHandle, context); | ||
| case PSN_WIZNEXT: |
| PhDereferenceObject(applicationFileName); | ||
| } | ||
| } | ||
| SetWindowLongPtr(WindowHandle, DWLP_MSGRESULT, TRUE); |
Comment on lines
+116
to
118
| Context->SetupCompleted = TRUE; | ||
| PostMessage(Context->DialogHandle, SETUP_SHOWUNINSTALLFINAL, 0, 0); | ||
| return STATUS_SUCCESS; |
Comment on lines
+1393
to
1396
| else if (status != STATUS_CANCELLED && status != NTSTATUS_FROM_WIN32(ERROR_CANCELLED)) | ||
| { | ||
| PhShowStatus(NULL, L"Unable to restart the application.", status, 0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves two related uninstallation issues in the
CustomSetupToolsetup and uninstall dialog flow:CustomSetupToolwith-uninstalllaunched the property sheet wizard (SetupShowWizard) but defaulted to the installation layout and pages, rendering interactive uninstallation broken.SetupShowWizardto conditionally load a newIDD_UNINSTALLconfirmation page and registerSetupUninstallPageDlgProcwhen uninstallation mode is detected.SetupInstallPageDlgProc,SetupCompletedPageDlgProc, andSetupErrorPageDlgProcto display correct descriptions and hide the "Start application" checkbox on uninstallation.Button_SetElevationRequiredStateon the first page, drawing the stock UAC shield icon.SetupShowDialog(TaskDialog) implementation, selecting "Remove application settings" and clicking "Cancel" would launch System Informer upon exit. This occurred because the verification checkbox state was evaluated without checking if the installation completed successfully.SetupCompletedflag insideFlagsunion in thePH_SETUP_CONTEXTstructure, tracking successful completions in both the installer and uninstaller threads.SetupShowDialogto only run the application if setup succeeded (SetupCompleted == TRUEandSetupMode == SetupCommandInstall).STATUS_CANCELLEDandNTSTATUS_FROM_WIN32(ERROR_CANCELLED)), preventing unexpected error alerts.