@@ -52,7 +52,7 @@ ${StrLoc}
5252!define COPYRIGHT " {{copyright}}"
5353!define OUTFILE " {{out_file}}"
5454!define ARCH " {{arch}}"
55- !define PLUGINSPATH " {{additional_plugins_path}}"
55+ !define ADDITIONALPLUGINSPATH " {{additional_plugins_path}}"
5656!define ALLOWDOWNGRADES " {{allow_downgrades}}"
5757!define DISPLAYLANGUAGESELECTOR " {{display_language_selector}}"
5858!define INSTALLWEBVIEW2MODE " {{install_webview2_mode}}"
@@ -61,7 +61,8 @@ ${StrLoc}
6161!define WEBVIEW2INSTALLERPATH " {{webview2_installer_path}}"
6262!define MINIMUMWEBVIEW2VERSION " {{minimum_webview2_version}}"
6363!define UNINSTKEY " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}"
64- !define MANUPRODUCTKEY " Software\${MANUFACTURER}\${PRODUCTNAME}"
64+ !define MANUKEY " Software\${MANUFACTURER}"
65+ !define MANUPRODUCTKEY " ${MANUKEY}\${PRODUCTNAME}"
6566!define UNINSTALLERSIGNCOMMAND " {{uninstaller_sign_cmd}}"
6667!define ESTIMATEDSIZE " {{estimated_size}}"
6768!define STARTMENUFOLDER " {{start_menu_folder}}"
@@ -89,10 +90,8 @@ VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
8990VIAddVersionKey " FileVersion" " ${VERSION}"
9091VIAddVersionKey " ProductVersion" " ${VERSION}"
9192
92- ; Plugins path, currently exists for linux only
93- !if " ${PLUGINSPATH}" != " "
94- !addplugindir " ${PLUGINSPATH}"
95- !endif
93+ # additional plugins
94+ !addplugindir " ${ADDITIONALPLUGINSPATH}"
9695
9796; Uninstaller signing command
9897!if " ${UNINSTALLERSIGNCOMMAND}" != " "
@@ -101,7 +100,7 @@ VIAddVersionKey "ProductVersion" "${VERSION}"
101100
102101; Handle install mode, `perUser`, `perMachine` or `both`
103102!if " ${INSTALLMODE}" == " perMachine"
104- RequestExecutionLevel highest
103+ RequestExecutionLevel admin
105104!endif
106105
107106!if " ${INSTALLMODE}" == " currentUser"
@@ -628,7 +627,7 @@ Section Install
628627 !insertmacro NSIS_HOOK_PREINSTALL
629628 !endif
630629
631- !insertmacro CheckIfAppIsRunning
630+ !insertmacro CheckIfAppIsRunning " ${MAINBINARYNAME}.exe " " ${PRODUCTNAME} "
632631
633632 ; Copy main executable
634633 File " ${MAINBINARYSRCPATH}"
@@ -638,12 +637,12 @@ Section Install
638637 CreateDirectory " $INSTDIR\\{{this}}"
639638 {{/each}}
640639 {{# each resources}}
641- File /a " /oname={{this.[1]}}" " {{@key}}"
640+ File /a " /oname={{this.[1]}}" " {{no-escape @key}}"
642641 {{/each}}
643642
644643 ; Copy external binaries
645644 {{# each binaries}}
646- File /a " /oname={{this}}" " {{@key}}"
645+ File /a " /oname={{this}}" " {{no-escape @key}}"
647646 {{/each}}
648647
649648 ; Create file associations
@@ -765,7 +764,7 @@ Section Uninstall
765764 !insertmacro NSIS_HOOK_PREUNINSTALL
766765 !endif
767766
768- !insertmacro CheckIfAppIsRunning
767+ !insertmacro CheckIfAppIsRunning " ${MAINBINARYNAME}.exe " " ${PRODUCTNAME} "
769768
770769 ; Delete the app directory and its content from disk
771770 ; Copy main executable
@@ -843,12 +842,27 @@ Section Uninstall
843842 DeleteRegKey HKCU " ${UNINSTKEY}"
844843 !endif
845844
846- DeleteRegValue HKCU " ${MANUPRODUCTKEY}" " Installer Language"
845+ ; Removes the Autostart entry for ${PRODUCTNAME} from the HKCU Run key if it exists.
846+ ; This ensures the program does not launch automatically after uninstallation if it exists.
847+ ; If it doesn't exist, it does nothing.
848+ ; We do this when not updating (to preserve the registry value on updates)
849+ ${If} $UpdateMode <> 1
850+ DeleteRegValue HKCU " Software\Microsoft\Windows\CurrentVersion\Run" " ${PRODUCTNAME}"
851+ ${EndIf}
847852
848853 ; Delete app data if the checkbox is selected
849854 ; and if not updating
850855 ${If} $DeleteAppDataCheckboxState = 1
851856 ${AndIf} $UpdateMode <> 1
857+ ; Clear the install location $INSTDIR from registry
858+ DeleteRegKey SHCTX " ${MANUPRODUCTKEY}"
859+ DeleteRegKey /ifempty SHCTX " ${MANUKEY}"
860+
861+ ; Clear the install language from registry
862+ DeleteRegValue HKCU " ${MANUPRODUCTKEY}" " Installer Language"
863+ DeleteRegKey /ifempty HKCU " ${MANUPRODUCTKEY}"
864+ DeleteRegKey /ifempty HKCU " ${MANUKEY}"
865+
852866 SetShellVarContext current
853867 RmDir /r " $APPDATA\${BUNDLEID}"
854868 RmDir /r " $LOCALAPPDATA\${BUNDLEID}"
0 commit comments