From fa6c05bedb81e6bfe1f1001930057f266a979aac Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 17 Jan 2025 12:04:15 +0800 Subject: [PATCH 1/3] fix(nsis): uninstaller installdir reg clean up --- .changes/nsis-cleanup-installdir-reg.md | 5 +++++ .../src/bundle/windows/nsis/installer.nsi | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changes/nsis-cleanup-installdir-reg.md diff --git a/.changes/nsis-cleanup-installdir-reg.md b/.changes/nsis-cleanup-installdir-reg.md new file mode 100644 index 000000000000..cbe26219fdc8 --- /dev/null +++ b/.changes/nsis-cleanup-installdir-reg.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +Fix NSIS uninstaller not cleaning up `Software\${MANUFACTURER}\${PRODUCTNAME}` registry key used for the install location diff --git a/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi b/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi index 5270de2ad04c..0b5783db181d 100644 --- a/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi +++ b/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi @@ -56,7 +56,8 @@ ${StrLoc} !define WEBVIEW2INSTALLERPATH "{{webview2_installer_path}}" !define MINIMUMWEBVIEW2VERSION "{{minimum_webview2_version}}" !define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}" -!define MANUPRODUCTKEY "Software\${MANUFACTURER}\${PRODUCTNAME}" +!define MANUKEY "Software\${MANUFACTURER}" +!define MANUPRODUCTKEY "${MANUKEY}\${PRODUCTNAME}" !define UNINSTALLERSIGNCOMMAND "{{uninstaller_sign_cmd}}" !define ESTIMATEDSIZE "{{estimated_size}}" !define STARTMENUFOLDER "{{start_menu_folder}}" @@ -834,7 +835,14 @@ Section Uninstall DeleteRegKey HKCU "${UNINSTKEY}" !endif + ; Clear the install location $INSTDIR from registry + DeleteRegKey SHCTX "${MANUPRODUCTKEY}" + DeleteRegKey /ifempty SHCTX "${MANUKEY}" + + ; Clear the install language from registry DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language" + DeleteRegKey /ifempty HKCU "${MANUPRODUCTKEY}" + DeleteRegKey /ifempty HKCU "${MANUKEY}" ; Delete app data if the checkbox is selected ; and if not updating From 536471e7c0122bbeb0cfc7080b255f25986ab302 Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 20 Jan 2025 18:56:43 +0800 Subject: [PATCH 2/3] Clear on `Delete the application data` is checked --- .../src/bundle/windows/nsis/installer.nsi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi b/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi index 0b5783db181d..8ed4adc0b58f 100644 --- a/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi +++ b/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi @@ -835,19 +835,19 @@ Section Uninstall DeleteRegKey HKCU "${UNINSTKEY}" !endif - ; Clear the install location $INSTDIR from registry - DeleteRegKey SHCTX "${MANUPRODUCTKEY}" - DeleteRegKey /ifempty SHCTX "${MANUKEY}" - - ; Clear the install language from registry - DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language" - DeleteRegKey /ifempty HKCU "${MANUPRODUCTKEY}" - DeleteRegKey /ifempty HKCU "${MANUKEY}" - ; Delete app data if the checkbox is selected ; and if not updating ${If} $DeleteAppDataCheckboxState = 1 ${AndIf} $UpdateMode <> 1 + ; Clear the install location $INSTDIR from registry + DeleteRegKey SHCTX "${MANUPRODUCTKEY}" + DeleteRegKey /ifempty SHCTX "${MANUKEY}" + + ; Clear the install language from registry + DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language" + DeleteRegKey /ifempty HKCU "${MANUPRODUCTKEY}" + DeleteRegKey /ifempty HKCU "${MANUKEY}" + SetShellVarContext current RmDir /r "$APPDATA\${BUNDLEID}" RmDir /r "$LOCALAPPDATA\${BUNDLEID}" From 17cf4715373e7010c3f211686512aea37b4b83ca Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Mon, 20 Jan 2025 22:03:17 +0200 Subject: [PATCH 3/3] Update .changes/nsis-cleanup-installdir-reg.md --- .changes/nsis-cleanup-installdir-reg.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/nsis-cleanup-installdir-reg.md b/.changes/nsis-cleanup-installdir-reg.md index cbe26219fdc8..4e8f7967d6c9 100644 --- a/.changes/nsis-cleanup-installdir-reg.md +++ b/.changes/nsis-cleanup-installdir-reg.md @@ -2,4 +2,4 @@ 'tauri-bundler': 'patch:bug' --- -Fix NSIS uninstaller not cleaning up `Software\${MANUFACTURER}\${PRODUCTNAME}` registry key used for the install location +Clean up `Software\${MANUFACTURER}\${PRODUCTNAME}` registry key in the NSIS uninstaller if "Delete application data" option is checked when uninstalling.