5 ; Create an installer that only writes an uninstaller.
6 ; http://nsis.sourceforge.net/Signing_an_Uninstaller
9 !include 'LogicLib.nsh'
11 !include "StrFunc.nsh"
15 OutFile "${STAGING_DIR}\uninstall_installer.exe"
16 RequestExecutionLevel user
18 InstType "un.Default (keep Personal Settings and WinPcap)"
19 InstType "un.All (remove all)"
22 UninstallIcon "..\..\image\wiresharkinst.ico"
26 !define MUI_UNICON "..\..\image\wiresharkinst.ico"
28 ; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
29 !define MUI_UNCONFIRMPAGE_TEXT_TOP "The following ${PROGRAM_NAME} installation will be removed. Click 'Next' to continue."
30 ; Uninstall stuff (this text isn't used with the MODERN_UI!)
31 ;UninstallText "This will uninstall ${PROGRAM_NAME}.\r\nBefore starting the uninstallation, make sure ${PROGRAM_NAME} is not running.\r\nClick 'Next' to continue."
33 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
35 !insertmacro MUI_UNPAGE_WELCOME
36 !insertmacro MUI_UNPAGE_CONFIRM
37 !insertmacro MUI_UNPAGE_COMPONENTS
38 !insertmacro MUI_UNPAGE_INSTFILES
39 !insertmacro MUI_UNPAGE_FINISH
41 !insertmacro MUI_LANGUAGE "English"
43 ; ============================================================================
45 ; ============================================================================
46 !include "Sections.nsh"
48 ; ============================================================================
49 ; Uninstall page configuration
50 ; ============================================================================
51 ShowUninstDetails show
53 ; ============================================================================
54 ; Functions and macros
55 ; ============================================================================
58 ; MUST be the absolute path to our staging directory.
59 WriteUninstaller "${STAGING_DIR}\${UNINSTALLER_NAME}"
65 Function un.Disassociate
67 !insertmacro PushFileExtensions
70 ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
71 ReadRegStr $R0 HKCR $EXTENSION ""
72 StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister
73 Goto un.Disassociate.end
74 un.Disassociate.doDeregister:
75 ; The extension is associated with Wireshark so, we must destroy this!
76 DeleteRegKey HKCR $EXTENSION
77 DetailPrint "Deregistered file type: $EXTENSION"
88 !define EXECUTABLE_MARKER "EXECUTABLE_MARKER"
91 Section /o "Un.USBPcap" un.SecUSBPcap
92 ;-------------------------------------------
95 ${DisableX64FSRedirection}
98 ReadRegStr $1 HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "UninstallString"
100 ${EnableX64FSRedirection}
104 ${UnStrRep} $2 '$1' '\Uninstall.exe' ''
105 ${UnStrRep} $3 '$2' '"' ''
106 ExecWait '$1 _?=$3' $0
107 DetailPrint "USBPcap uninstaller returned $0"
109 Delete "$3\Uninstall.exe"
110 Delete "$INSTDIR\extcap\USBPcapCMD.exe"
117 Section "Uninstall" un.SecUinstall
118 ;-------------------------------------------
120 ; UnInstall for every user
123 SetShellVarContext all
125 !insertmacro IsWiresharkRunning
127 Push "${EXECUTABLE_MARKER}"
133 Push "${PROGRAM_NAME}"
146 ${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER}
148 ; IsWiresharkRunning should make sure everything is closed down so we *shouldn't* run
149 ; into any problems here.
150 Delete "$INSTDIR\$EXECUTABLE.exe"
151 IfErrors 0 deletionSuccess
152 MessageBox MB_OK "$EXECUTABLE.exe could not be removed. Is it in use?" /SD IDOK IDOK 0
153 Abort "$EXECUTABLE.exe could not be removed. Aborting the uninstall process."
161 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
162 DeleteRegKey HKEY_LOCAL_MACHINE "Software\${PROGRAM_NAME}"
163 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME}.exe"
167 DeleteRegKey HKCR ${WIRESHARK_ASSOC}
168 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command"
169 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon"
171 Delete "$INSTDIR\*.dll"
172 Delete "$INSTDIR\*.exe"
173 Delete "$INSTDIR\*.html"
174 Delete "$INSTDIR\*.qm"
175 Delete "$INSTDIR\accessible\*.*"
176 Delete "$INSTDIR\AUTHORS-SHORT"
177 Delete "$INSTDIR\COPYING*"
178 Delete "$INSTDIR\audio\*.*"
179 Delete "$INSTDIR\bearer\*.*"
180 Delete "$INSTDIR\diameter\*.*"
181 Delete "$INSTDIR\etc\gtk-2.0\*.*"
182 Delete "$INSTDIR\etc\gtk-3.0\*.*"
183 Delete "$INSTDIR\etc\pango\*.*"
184 Delete "$INSTDIR\extcap\androiddump.*"
185 Delete "$INSTDIR\extcap\randpktdump.*"
186 Delete "$INSTDIR\extcap\sshdump.*"
187 Delete "$INSTDIR\extcap\ciscodump.*"
188 Delete "$INSTDIR\extcap\udpdump.*"
189 Delete "$INSTDIR\help\*.*"
190 Delete "$INSTDIR\iconengines\*.*"
191 Delete "$INSTDIR\imageformats\*.*"
192 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.*"
193 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\immodules\*.*"
194 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\loaders\*.*"
195 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
196 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
197 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
198 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
199 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
200 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
201 Delete "$INSTDIR\lib\gtk-2.0\modules\*.*"
202 Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
203 Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
204 Delete "$INSTDIR\lib\pango\1.5.0\modules\*.*"
205 Delete "$INSTDIR\mediaservice\*.*"
206 Delete "$INSTDIR\platforms\*.*"
207 Delete "$INSTDIR\playlistformats\*.*"
208 Delete "$INSTDIR\printsupport\*.*"
209 Delete "$INSTDIR\share\glib-2.0\schemas\*.*"
210 Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
211 Delete "$INSTDIR\snmp\*.*"
212 Delete "$INSTDIR\snmp\mibs\*.*"
213 Delete "$INSTDIR\tpncp\*.*"
214 Delete "$INSTDIR\translations\*.*"
215 Delete "$INSTDIR\ui\*.*"
216 Delete "$INSTDIR\wimaxasncp\*.*"
217 Delete "$INSTDIR\ws.css"
218 ; previous versions installed these files
219 Delete "$INSTDIR\*.manifest"
220 ; previous versions installed this file
221 Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
222 Delete "$INSTDIR\README*"
223 Delete "$INSTDIR\NEWS.txt"
224 Delete "$INSTDIR\manuf"
225 Delete "$INSTDIR\wka"
226 Delete "$INSTDIR\services"
227 Delete "$INSTDIR\pdml2html.xsl"
228 Delete "$INSTDIR\pcrepattern.3.txt"
229 Delete "$INSTDIR\user-guide.chm"
230 Delete "$INSTDIR\example_snmp_users_file"
231 Delete "$INSTDIR\ipmap.html"
232 Delete "$INSTDIR\radius\*.*"
233 Delete "$INSTDIR\dtds\*.*"
234 Delete "$SMPROGRAMS\${PROGRAM_NAME}\*.*"
235 Delete "$SMPROGRAMS\${PROGRAM_NAME}.lnk"
236 Delete "$SMPROGRAMS\${PROGRAM_NAME_GTK}.lnk"
237 Delete "$SMPROGRAMS\${PROGRAM_NAME_QT}.lnk"
238 Delete "$SMPROGRAMS\Qtshark.lnk"
239 Delete "$DESKTOP\${PROGRAM_NAME}.lnk"
240 Delete "$DESKTOP\${PROGRAM_NAME_GTK}.lnk"
241 Delete "$DESKTOP\${PROGRAM_NAME_QT}.lnk"
242 Delete "$QUICKLAUNCH\${PROGRAM_NAME}.lnk"
243 Delete "$QUICKLAUNCH\${PROGRAM_NAME_GTK}.lnk"
244 Delete "$QUICKLAUNCH\${PROGRAM_NAME_QT}.lnk"
246 RMDir "$INSTDIR\accessible"
247 RMDir "$INSTDIR\audio"
248 RMDir "$INSTDIR\bearer"
249 RMDir "$INSTDIR\etc\gtk-2.0"
250 RMDir "$INSTDIR\etc\pango"
252 RMDir "$INSTDIR\extcap"
253 RMDir "$INSTDIR\iconengines"
254 RMDir "$INSTDIR\imageformats"
255 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
256 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
257 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
258 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
259 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
260 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
261 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
262 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
263 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\engines"
264 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\loaders"
265 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\immodules"
266 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0"
267 RMDir "$INSTDIR\lib\gtk-2.0\modules"
268 RMDir "$INSTDIR\lib\gtk-2.0"
269 RMDir "$INSTDIR\lib\pango\1.2.0\modules"
270 RMDir "$INSTDIR\lib\pango\1.2.0"
271 RMDir "$INSTDIR\lib\pango\1.4.0\modules"
272 RMDir "$INSTDIR\lib\pango\1.4.0"
273 RMDir "$INSTDIR\lib\pango\1.5.0\modules"
274 RMDir "$INSTDIR\lib\pango\1.5.0"
275 RMDir "$INSTDIR\lib\pango"
277 RMDir "$INSTDIR\mediaservice"
278 RMDir "$INSTDIR\platforms"
279 RMDir "$INSTDIR\playlistformats"
280 RMDir "$INSTDIR\printsupport"
281 RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
282 RMDir "$INSTDIR\share\themes\Default"
283 RMDir "$INSTDIR\share\themes"
284 RMDir "$INSTDIR\share"
285 RMDir "$SMPROGRAMS\${PROGRAM_NAME}"
286 RMDir "$INSTDIR\help"
287 RMDir "$INSTDIR\diameter"
288 RMDir "$INSTDIR\snmp\mibs"
289 RMDir "$INSTDIR\snmp"
290 RMDir "$INSTDIR\radius"
291 RMDir "$INSTDIR\dtds"
292 RMDir "$INSTDIR\tpncp"
293 RMDir "$INSTDIR\translations"
295 RMDir "$INSTDIR\wimaxasncp"
298 SectionEnd ; "Uinstall"
300 Section "Un.Plugins" un.SecPlugins
301 ;-------------------------------------------
303 ;Delete "$INSTDIR\plugins\${VERSION}\*.*"
304 ;Delete "$INSTDIR\plugins\*.*"
305 ;RMDir "$INSTDIR\plugins\${VERSION}"
306 ;RMDir "$INSTDIR\plugins"
307 RMDir /r "$INSTDIR\plugins"
310 Section "Un.Global Profiles" un.SecProfiles
311 ;-------------------------------------------
313 RMDir /r "$INSTDIR\profiles"
316 Section "Un.Global Settings" un.SecGlobalSettings
317 ;-------------------------------------------
319 Delete "$INSTDIR\cfilters"
320 Delete "$INSTDIR\colorfilters"
321 Delete "$INSTDIR\dfilters"
322 Delete "$INSTDIR\enterprises.tsv"
323 Delete "$INSTDIR\init.lua"
324 Delete "$INSTDIR\console.lua"
325 Delete "$INSTDIR\dtd_gen.lua"
326 Delete "$INSTDIR\smi_modules"
330 Section /o "Un.Personal Settings" un.SecPersonalSettings
331 ;-------------------------------------------
333 SetShellVarContext current
334 Delete "$APPDATA\${PROGRAM_NAME}\*.*"
335 RMDir "$APPDATA\${PROGRAM_NAME}"
336 DeleteRegKey HKCU "Software\${PROGRAM_NAME}"
339 ;VAR un.WINPCAP_UNINSTALL
341 Section /o "Un.WinPcap" un.SecWinPcap
342 ;-------------------------------------------
344 ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
345 ;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
347 ;MessageBox MB_OK "WinPcap $1" /SD IDOK
349 DetailPrint "WinPcap uninstaller returned $0"
352 ;un.lbl_winpcap_notinstalled:
355 Section "-Un.Finally"
356 ;-------------------------------------------
359 !insertmacro UpdateIcons
361 ; this test must be done after all other things uninstalled (e.g. Global Settings)
362 IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
363 MessageBox MB_OK "Unable to remove $INSTDIR." /SD IDOK IDOK 0 ; skipped if dir doesn't exist
367 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
368 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components."
369 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)."
370 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecProfiles} "Uninstall all global configuration profiles."
371 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
372 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
373 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
374 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUSBPcap} "Call USBPcap's uninstall program."
375 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
378 ; Editor modelines - http://www.wireshark.org/tools/modelines.html
383 ; indent-tabs-mode: nil
386 ; vi: set shiftwidth=4 tabstop=8 expandtab:
387 ; :indentSize=4:tabSize=8:noTabs=true: