From f56e421eb3987d0bf014ea792fa9de0258cf91b1 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Mon, 28 Dec 2020 23:10:57 +0100 Subject: [PATCH 1/4] Add registry check for old Jamulus version and warn --- windows/installer.nsi | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/windows/installer.nsi b/windows/installer.nsi index 9c59b0162e..fe8917b856 100755 --- a/windows/installer.nsi +++ b/windows/installer.nsi @@ -77,6 +77,15 @@ LangString RUNNING_APP_MSG ${LANG_ENGLISH} \ ; LangString RUNNING_APP_MSG ${LANG_ITALIAN} \ ; "${APP_NAME} è in esecuzione. Chiudere l'applicazione prima di eseguire l'installazione." +LangString OLD_WRONG_REG_FOUND_EMPTY ${LANG_ENGLISH} \ + "Due to a bug, an old version of Jamulus might be installed to a wrong path on your computer. We couldn't detect the path of the uninstaller, so there might also be another problem. If you ignore this message the installer will continue, but you might end up with multiple Jamulus installations. You could try to search for the Uninstaller of the old version in your Program Files or Program Files (x86) directory." + +LangString OLD_WRONG_REG_FOUND ${LANG_ENGLISH} \ + "Due to a bug, an old version of Jamulus might be installed to a wrong path on your computer. If you ignore this message the installer will continue, but you might end up with multiple Jamulus installations. It is recommended to abort and restart the installer. To remove this old Jamulus version, please do so either via the Windows Uninstaller in settings or by launching the following file: " + +LangString OLD_WRONG_REG_FOUND_CONFIRM ${LANG_ENGLISH} \ + "If you continue without removing it, your installation might be broken! Are you sure you don't want to remove the old version?" + ; Abort the installer/uninstaller if Jamulus is running !macro _AbortOnRunningApp @@ -93,7 +102,6 @@ LangString RUNNING_APP_MSG ${LANG_ENGLISH} \ ; Installer !macro InstallApplication buildArch - !define prefix "${DEPLOY_PATH}\${buildArch}" !tempfile files @@ -194,12 +202,34 @@ Function .onInit ${EndIf} + retrywrong: + ; check if old, wrongly installed jamulus exists + ClearErrors + Var /GLOBAL OLD_WRONG_PATH_UNINST + StrCpy $OLD_WRONG_PATH_UNINST "" + ReadRegStr $OLD_WRONG_PATH_UNINST HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Jamulus" "UninstallString" + ${If} ${Errors} + ${Else} + ${IF} $UNINST_PATH == "" + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit + ${ELSE} + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit + ${ENDIF} + idontcare: + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall + goto quit + quit: + Abort + continueinstall: + ${EndIf} + ; Install for all users SetShellVarContext all ; Select installer language !insertmacro MUI_LANGDLL_DISPLAY - FunctionEnd ; Ensure Jamulus is installed into a new folder only, unless Jamulus is already installed there @@ -250,7 +280,6 @@ FunctionEnd !macroend Section "un.Install" - ; Delete the main application ${If} ${RunningX64} !insertmacro un.InstallFiles x86_64 From 01c5ef3918aa0a3e26af21aa268e58225640cc70 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Mon, 28 Dec 2020 23:36:34 +0100 Subject: [PATCH 2/4] Only execute check on 64 bit --- windows/installer.nsi | 49 ++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/windows/installer.nsi b/windows/installer.nsi index fe8917b856..502c450392 100755 --- a/windows/installer.nsi +++ b/windows/installer.nsi @@ -189,8 +189,29 @@ Function .onInit ReadRegStr $INSTDIR HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_VALUE}" IfErrors 0 +2 StrCpy $INSTDIR "$PROGRAMFILES64\${APP_NAME}" - - ${Else} + retrywrong: + ; check if old, wrongly installed jamulus exists + ClearErrors + Var /GLOBAL OLD_WRONG_PATH_UNINST + StrCpy $OLD_WRONG_PATH_UNINST "" + ReadRegStr $OLD_WRONG_PATH_UNINST HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Jamulus" "UninstallString" + ${If} ${Errors} + ${Else} + ${IF} $UNINST_PATH == "" + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit + ${ELSE} + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit + ${ENDIF} + idontcare: + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall + goto quit + quit: + Abort + continueinstall: + ${EndIf} + ${Else} SetRegView 32 SectionSetFlags ${Install_x86} ${SF_SELECTED} SectionSetFlags ${Install_x86_64} ${SECTION_OFF} @@ -201,30 +222,6 @@ Function .onInit StrCpy $INSTDIR "$PROGRAMFILES32\${APP_NAME}" ${EndIf} - - retrywrong: - ; check if old, wrongly installed jamulus exists - ClearErrors - Var /GLOBAL OLD_WRONG_PATH_UNINST - StrCpy $OLD_WRONG_PATH_UNINST "" - ReadRegStr $OLD_WRONG_PATH_UNINST HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Jamulus" "UninstallString" - ${If} ${Errors} - ${Else} - ${IF} $UNINST_PATH == "" - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit - ${ELSE} - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit - ${ENDIF} - idontcare: - MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall - goto quit - quit: - Abort - continueinstall: - ${EndIf} - ; Install for all users SetShellVarContext all From bab15069b00f930066dd7820631d7d09a6bda5bc Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Mon, 28 Dec 2020 23:41:56 +0100 Subject: [PATCH 3/4] Add source and code style changes --- windows/installer.nsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/windows/installer.nsi b/windows/installer.nsi index 502c450392..1d6d2a3c90 100755 --- a/windows/installer.nsi +++ b/windows/installer.nsi @@ -190,7 +190,7 @@ Function .onInit IfErrors 0 +2 StrCpy $INSTDIR "$PROGRAMFILES64\${APP_NAME}" retrywrong: - ; check if old, wrongly installed jamulus exists + ; check if old, wrongly installed jamulus exists. See https://stackoverflow.com/questions/27839860/nsis-check-if-registry-key-value-exists#27841158 ClearErrors Var /GLOBAL OLD_WRONG_PATH_UNINST StrCpy $OLD_WRONG_PATH_UNINST "" @@ -198,17 +198,17 @@ Function .onInit ${If} ${Errors} ${Else} ${IF} $UNINST_PATH == "" - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit ${ELSE} - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong + goto quit ${ENDIF} idontcare: MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall goto quit quit: - Abort + Abort continueinstall: ${EndIf} ${Else} From 3ca6391c849a7d1ea48569fa5bc5ed5dec299a3c Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Tue, 29 Dec 2020 21:18:34 +0100 Subject: [PATCH 4/4] Check for Uninstaller.exe instead for registry --- windows/installer.nsi | 54 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/windows/installer.nsi b/windows/installer.nsi index 1d6d2a3c90..8a5aa9bd75 100755 --- a/windows/installer.nsi +++ b/windows/installer.nsi @@ -77,15 +77,13 @@ LangString RUNNING_APP_MSG ${LANG_ENGLISH} \ ; LangString RUNNING_APP_MSG ${LANG_ITALIAN} \ ; "${APP_NAME} è in esecuzione. Chiudere l'applicazione prima di eseguire l'installazione." -LangString OLD_WRONG_REG_FOUND_EMPTY ${LANG_ENGLISH} \ - "Due to a bug, an old version of Jamulus might be installed to a wrong path on your computer. We couldn't detect the path of the uninstaller, so there might also be another problem. If you ignore this message the installer will continue, but you might end up with multiple Jamulus installations. You could try to search for the Uninstaller of the old version in your Program Files or Program Files (x86) directory." +LangString OLD_WRONG_VER_FOUND ${LANG_ENGLISH} \ + "Due to a bug, an old version of Jamulus might be installed to a wrong path on your computer. Do you want to remove it before installing this new version (we strongly recommend this)?" -LangString OLD_WRONG_REG_FOUND ${LANG_ENGLISH} \ - "Due to a bug, an old version of Jamulus might be installed to a wrong path on your computer. If you ignore this message the installer will continue, but you might end up with multiple Jamulus installations. It is recommended to abort and restart the installer. To remove this old Jamulus version, please do so either via the Windows Uninstaller in settings or by launching the following file: " - -LangString OLD_WRONG_REG_FOUND_CONFIRM ${LANG_ENGLISH} \ +LangString OLD_WRONG_VER_FOUND_CONFIRM ${LANG_ENGLISH} \ "If you continue without removing it, your installation might be broken! Are you sure you don't want to remove the old version?" - +LangString OLD_WRONG_VER_REMOVE_FAILED ${LANG_ENGLISH} \ + "FATAL: THE OLD UNINSTALLER FAILED. Once you click on OK the old version will remain on your PC and we will try to install the new version too. You can also press cancel and try to remove it on your own." ; Abort the installer/uninstaller if Jamulus is running !macro _AbortOnRunningApp @@ -189,28 +187,26 @@ Function .onInit ReadRegStr $INSTDIR HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_VALUE}" IfErrors 0 +2 StrCpy $INSTDIR "$PROGRAMFILES64\${APP_NAME}" - retrywrong: - ; check if old, wrongly installed jamulus exists. See https://stackoverflow.com/questions/27839860/nsis-check-if-registry-key-value-exists#27841158 - ClearErrors - Var /GLOBAL OLD_WRONG_PATH_UNINST - StrCpy $OLD_WRONG_PATH_UNINST "" - ReadRegStr $OLD_WRONG_PATH_UNINST HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Jamulus" "UninstallString" - ${If} ${Errors} - ${Else} - ${IF} $UNINST_PATH == "" - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_EMPTY)" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit - ${ELSE} - MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND) $OLD_WRONG_PATH_UNINST" /sd IDABORT IDIGNORE idontcare IDRETRY retrywrong - goto quit - ${ENDIF} - idontcare: - MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_REG_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall - goto quit - quit: - Abort - continueinstall: - ${EndIf} + + ; check if old, wrongly installed jamulus exists. See https://stackoverflow.com/questions/27839860/nsis-check-if-registry-key-value-exists#27841158 + IfFileExists "$PROGRAMFILES32\Jamulus\Uninstall.exe" wrong_install_found continueinstall + + wrong_install_found: + MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_FOUND)" /sd IDYES IDNO idontcare IDCANCEL quit + goto removeold + idontcare: + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall + goto removeold + removeold: + ExecWait "$PROGRAMFILES32\Jamulus\Uninstall.exe" $0 + ${IfNot} $0 == 0 + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continueinstall + goto quit + ${EndIf} + goto continueinstall + quit: + Abort + continueinstall: ${Else} SetRegView 32 SectionSetFlags ${Install_x86} ${SF_SELECTED}