summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2008-10-21 16:44:35 +0000
committerGerald Combs <gerald@wireshark.org>2008-10-21 16:44:35 +0000
commit96fc0e8f989d489b8972512fb0f47d285d82a5c2 (patch)
tree59bf21b5cf2776a46d1e88db0bbf8a8212b1a6c5 /packaging
parent119d44988009dca988a86a7806d25c129a6defbd (diff)
downloadwireshark-96fc0e8f989d489b8972512fb0f47d285d82a5c2.tar.gz
Detect a previous Wireshark installation and let the user uninstall it first.
svn path=/trunk/; revision=26509
Diffstat (limited to 'packaging')
-rw-r--r--packaging/nsis/wireshark.nsi45
1 files changed, 26 insertions, 19 deletions
diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi
index 59ed1d80bd..4f6ab7d394 100644
--- a/packaging/nsis/wireshark.nsi
+++ b/packaging/nsis/wireshark.nsi
@@ -261,7 +261,33 @@ un.unlink.end:
pop $R1
FunctionEnd
+Var OLD_UNINSTALLER
+Var OLD_DISPLAYNAME
+
Function .onInit
+ ; Copied from http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new
+ ReadRegStr $OLD_UNINSTALLER HKLM \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" \
+ "UninstallString"
+ StrCmp $OLD_UNINSTALLER "" done
+
+ ReadRegStr $OLD_DISPLAYNAME HKLM \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" \
+ "DisplayName"
+ StrCmp $OLD_DISPLAYNAME "" done
+
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+ "$OLD_DISPLAYNAME is already installed. $\n$\nClick `OK` to remove it \
+ or `Cancel` to cancel this upgrade." \
+ IDOK uninst
+ Abort
+
+;Run the uninstaller
+uninst:
+ ClearErrors
+ ExecWait $OLD_UNINSTALLER
+
+done:
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "WinpcapPage.ini"
@@ -1138,25 +1164,6 @@ Var WINPCAP_VERSION ; DisplayVersion from WinPcap installation
Function myShowCallback
-; Uinstall old Wireshark first
-; XXX - doesn't work, but kept here for further experiments
-;ReadRegStr $WIRESHARK_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString"
-;IfErrors lbl_wireshark_notinstalled ;if RegKey is unavailable, WinPcap is not installed
-;MessageBox MB_YESNO|MB_ICONQUESTION "Uninstall the old Wireshark version first (recommended)?"
-; Hide the installer while uninstalling
-;GetDlgItem $0 $HWNDPARENT 1
-;FindWindow $0 "#32770" "" $HWNDPARENT
-;MessageBox MB_OK "Window $0"
-;ShowWindow $0 ${SW_HIDE}
-;HideWindow
-;ExecWait '$WIRESHARK_UNINSTALL' $0
-;DetailPrint "WinPcap uninstaller returned $0"
-;GetDlgItem $0 $HWNDPARENT 1
-;ShowWindow $0 ${SW_SHOW}
-;MessageBox MB_OK "Uninstalled"
-;lbl_wireshark_notinstalled:
-
-
; Get the Windows version
Call GetWindowsVersion
Pop $R0 ; Windows Version