fix(windows): confirm manual installer launches

This commit is contained in:
Kevin Yue committed 2026-11-17 21:33:28 +08:00
1 parent ce6c97a2f7
commit 2251afab00
4 files changed
+35 -1

No files matched your search

+26
View File
@@ -2,6 +2,7 @@ Unicode true
RequestExecutionLevel admin
!include "MUI2.nsh"
!include "x64.nsh"
!include "FileFunc.nsh"
!ifndef PAYLOAD_DIR
!error "PAYLOAD_DIR is required"
@@ -33,12 +34,18 @@ VIAddVersionKey "FileVersion" "${BUILD_VERSION}"
VIAddVersionKey "LegalCopyright" "GP Connect contributors"
ShowInstDetails show
ShowUninstDetails show
Var InstallAction
!define MUI_ICON "${__FILEDIR__}\..\..\apps\gpauth\icons\windows\icon.ico"
!define MUI_UNICON "${MUI_ICON}"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${__FILEDIR__}\sidebar.bmp"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_TITLE "GP Connect is ready"
!define MUI_FINISHPAGE_TEXT "Open GP Connect from the Start menu."
!define MUI_WELCOMEPAGE_TITLE "$InstallAction GP Connect"
!define MUI_WELCOMEPAGE_TEXT "$InstallAction GP Connect for all users on this computer.$\r$\n$\r$\nClick $InstallAction to continue."
!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfirmInstall
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowInstallAction
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
@@ -62,6 +69,25 @@ Function .onInit
!error "Unsupported TARGET_ARCH"
!endif
SetRegView 64
StrCpy $InstallAction "Install"
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPConnect" "DisplayVersion"
${If} $0 != ""
StrCpy $InstallAction "Update"
${EndIf}
FunctionEnd
Function ConfirmInstall
${GetParameters} $0
ClearErrors
${GetOptions} $0 "/UPDATE" $1
${IfNot} ${Errors}
Abort
${EndIf}
FunctionEnd
Function ShowInstallAction
GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:$InstallAction"
FunctionEnd
Section "Install"