aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/nsis
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-02-20 23:59:49 +0000
committerGerald Combs <gerald@wireshark.org>2013-02-20 23:59:49 +0000
commitab79e59866563a347f85aa597afc587a87dcdb97 (patch)
tree18015a16de436925828d72c1871d1819c20cd27d /packaging/nsis
parentceb5b89c849085684bdcff1eb1fcf764d7198f93 (diff)
Move the Wireshark-is-running check to a common macro and call it in
both the installer and uninstaller. Roll the .exe removal code into a loop and add missing executables. Add modelines and adjust accordingly. svn path=/trunk/; revision=47785
Diffstat (limited to 'packaging/nsis')
-rwxr-xr-xpackaging/nsis/common.nsh126
-rwxr-xr-xpackaging/nsis/uninstall.nsi103
-rw-r--r--packaging/nsis/wireshark.nsi38
3 files changed, 159 insertions, 108 deletions
diff --git a/packaging/nsis/common.nsh b/packaging/nsis/common.nsh
index 5734dcba21..b05449aea2 100755
--- a/packaging/nsis/common.nsh
+++ b/packaging/nsis/common.nsh
@@ -38,28 +38,28 @@ XPStyle on
!define SHCNF_IDLIST 0
!macro UpdateIcons
- Push $R0
- Push $R1
- Push $R2
-
- !define UPDATEICONS_UNIQUE ${__LINE__}
-
- IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}
+ Push $R0
+ Push $R1
+ Push $R2
+
+ !define UPDATEICONS_UNIQUE ${__LINE__}
+
+ IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}
UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE}:
- System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
- Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
+ System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+ Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}:
- MessageBox MB_OK|MB_ICONSTOP \
- "Can't find 'shell32.dll' library. Impossible to update icons" \
- /SD IDOK
- Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
+ MessageBox MB_OK|MB_ICONSTOP \
+ "Can't find 'shell32.dll' library. Impossible to update icons" \
+ /SD IDOK
+ Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
- !undef UPDATEICONS_UNIQUE
- Pop $R2
- Pop $R1
- Pop $R0
+ !undef UPDATEICONS_UNIQUE
+ Pop $R2
+ Pop $R1
+ Pop $R0
!macroend
@@ -75,29 +75,69 @@ UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
!define FILE_EXTENSION_MARKER "FILE_EXTENSION_MARKER"
!macro PushFileExtensions
- Push "${FILE_EXTENSION_MARKER}"
- Push ".wpz"
- Push ".wpc"
- Push ".vwr"
- Push ".trc"
- Push ".trace"
- Push ".tr1"
- Push ".tpc"
- Push ".syc"
- Push ".snoop"
- Push ".rf5"
- Push ".pkt"
- Push ".pcapng"
- Push ".pcap"
- Push ".out"
- Push ".ntar"
- Push ".fdc"
- Push ".erf"
- Push ".enc"
- Push ".cap"
- Push ".bfr"
- Push ".atc"
- Push ".apc"
- Push ".acp"
- Push ".5vw"
-!macroend \ No newline at end of file
+ Push "${FILE_EXTENSION_MARKER}"
+ Push ".wpz"
+ Push ".wpc"
+ Push ".vwr"
+ Push ".trc"
+ Push ".trace"
+ Push ".tr1"
+ Push ".tpc"
+ Push ".syc"
+ Push ".snoop"
+ Push ".rf5"
+ Push ".pkt"
+ Push ".pcapng"
+ Push ".pcap"
+ Push ".out"
+ Push ".ntar"
+ Push ".fdc"
+ Push ".erf"
+ Push ".enc"
+ Push ".cap"
+ Push ".bfr"
+ Push ".atc"
+ Push ".apc"
+ Push ".acp"
+ Push ".5vw"
+!macroend
+
+!macro IsWiresharkRunning
+; See if Wireshark is running
+; http://nsis.sourceforge.net/Check_whether_your_application_is_running
+${Do}
+
+ System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
+ IntCmp $R0 0 checkRunningSession
+ System::Call 'kernel32::CloseHandle(i $R0)'
+ Goto isRunning
+
+checkRunningSession:
+ System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
+ IntCmp $R0 0 notRunning
+ System::Call 'kernel32::CloseHandle(i $R0)'
+
+isRunning:
+ ; You'd better go catch it.
+ MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one is associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking
+ Quit
+
+notRunning:
+ ${ExitDo}
+
+continueChecking:
+${Loop}
+!macroend
+
+;
+; Editor modelines - http://www.wireshark.org/tools/modelines.html
+;
+; Local variables:
+; c-basic-offset: 4
+; tab-width: 8
+; indent-tabs-mode: nil
+; End:
+;
+; vi: set shiftwidth=4 tabstop=8 expandtab:
+; :indentSize=4:tabSize=8:noTabs=true:
+;
diff --git a/packaging/nsis/uninstall.nsi b/packaging/nsis/uninstall.nsi
index 064bd130a0..e01335375c 100755
--- a/packaging/nsis/uninstall.nsi
+++ b/packaging/nsis/uninstall.nsi
@@ -61,60 +61,68 @@ FunctionEnd
Var EXTENSION
Function un.Disassociate
- Push $R0
+ Push $R0
!insertmacro PushFileExtensions
- Pop $EXTENSION
- ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
- ReadRegStr $R0 HKCR $EXTENSION ""
- StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister
- Goto un.Disassociate.end
+ Pop $EXTENSION
+ ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
+ ReadRegStr $R0 HKCR $EXTENSION ""
+ StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister
+ Goto un.Disassociate.end
un.Disassociate.doDeregister:
- ; The extension is associated with Wireshark so, we must destroy this!
- DeleteRegKey HKCR $EXTENSION
- DetailPrint "Deregistered file type: $EXTENSION"
+ ; The extension is associated with Wireshark so, we must destroy this!
+ DeleteRegKey HKCR $EXTENSION
+ DetailPrint "Deregistered file type: $EXTENSION"
un.Disassociate.end:
- Pop $EXTENSION
- ${Loop}
+ Pop $EXTENSION
+ ${Loop}
- Pop $R0
+ Pop $R0
FunctionEnd
Section "-Required"
SectionEnd
+!define EXECUTABLE_MARKER "EXECUTABLE_MARKER"
+Var EXECUTABLE
+
Section "Uninstall" un.SecUinstall
;-------------------------------------------
-
;
; UnInstall for every user
;
SectionIn 1 2
SetShellVarContext all
-Delete "$INSTDIR\rawshark.exe"
-IfErrors 0 NoRawsharkErrorMsg
- MessageBox MB_OK "Please note: rawshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if rawshark.exe removed
- Abort "Please note: rawshark.exe could not be removed, it's probably in use! Abort uninstall process!"
-NoRawsharkErrorMsg:
-
-Delete "$INSTDIR\tshark.exe"
-IfErrors 0 NoTSharkErrorMsg
- MessageBox MB_OK "Please note: tshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tshark.exe removed
- Abort "Please note: tshark.exe could not be removed, it's probably in use! Abort uninstall process!"
-NoTSharkErrorMsg:
-
-Delete "$INSTDIR\Qtshark.exe"
-IfErrors 0 NoQtSharkErrorMsg
- MessageBox MB_OK "Please note: qtshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if qtshark.exe removed
- Abort "Please note: qtshark.exe could not be removed, it's probably in use! Abort uninstall process!"
-NoQtSharkErrorMsg:
-
-Delete "$INSTDIR\${PROGRAM_NAME}.exe"
-IfErrors 0 NoWiresharkErrorMsg
- MessageBox MB_OK "Please note: ${PROGRAM_NAME}.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if ${PROGRAM_NAME}.exe removed
- Abort "Please note: ${PROGRAM_NAME}.exe could not be removed, it's probably in use! Abort uninstall process!"
-NoWiresharkErrorMsg:
+!insertmacro IsWiresharkRunning
+
+Push "${EXECUTABLE_MARKER}"
+Push "dumpcap"
+Push "${PROGRAM_NAME}"
+Push "tshark"
+Push "qtshark"
+Push "editcap"
+Push "text2pcap"
+Push "mergecap"
+Push "reordercap"
+Push "capinfos"
+Push "rawshark"
+
+Pop $EXECUTABLE
+${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER}
+
+ ; IsWiresharkRunning should make sure everything is closed down so we *shouldn't* run
+ ; into any problems here.
+ Delete "$INSTDIR\$EXECUTABLE.exe"
+ IfErrors 0 deletionSuccess
+ MessageBox MB_OK "$EXECUTABLE.exe could not be removed. Is it in use?" IDOK 0 ;skipped if rawshark.exe removed
+ Abort "$EXECUTABLE.exe could not be removed. Aborting the uninstall process."
+
+deletionSuccess:
+ Pop $EXTENSION
+
+${Loop}
+
DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "Software\${PROGRAM_NAME}"
@@ -277,9 +285,22 @@ NoFinalErrorMsg:
SectionEnd
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components."
- !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)."
- !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
- !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
- !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
+
+;
+; Editor modelines - http://www.wireshark.org/tools/modelines.html
+;
+; Local variables:
+; c-basic-offset: 4
+; tab-width: 8
+; indent-tabs-mode: nil
+; End:
+;
+; vi: set shiftwidth=4 tabstop=8 expandtab:
+; :indentSize=4:tabSize=8:noTabs=true:
+;
diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi
index c6fd4bf8c6..233c254faa 100644
--- a/packaging/nsis/wireshark.nsi
+++ b/packaging/nsis/wireshark.nsi
@@ -210,30 +210,7 @@ Function .onInit
${EndIf}
!endif
-; See if Wireshark is running
-; http://nsis.sourceforge.net/Check_whether_your_application_is_running
- ${Do}
-
- System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
- IntCmp $R0 0 checkRunningSession
- System::Call 'kernel32::CloseHandle(i $R0)'
- Goto isRunning
-
-checkRunningSession:
- System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
- IntCmp $R0 0 notRunning
- System::Call 'kernel32::CloseHandle(i $R0)'
-
-isRunning:
- ; You'd better go catch it.
- MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one is associated programs is running. Please close it first" /SD IDCANCEL IDRETRY continueChecking
- Quit
-
-notRunning:
- ${ExitDo}
-
-continueChecking:
- ${Loop}
+!insertmacro IsWiresharkRunning
; Copied from http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new
ReadRegStr $OLD_UNINSTALLER HKLM \
@@ -1150,3 +1127,16 @@ lbl_have_quicklaunchicon:
lbl_wireshark_notinstalled:
FunctionEnd
+
+;
+; Editor modelines - http://www.wireshark.org/tools/modelines.html
+;
+; Local variables:
+; c-basic-offset: 4
+; tab-width: 8
+; indent-tabs-mode: nil
+; End:
+;
+; vi: set shiftwidth=4 tabstop=8 expandtab:
+; :indentSize=4:tabSize=8:noTabs=true:
+;