Incorporate plugin dissector into build in collection.
[obnox/wireshark/wip.git] / packaging / nsis / wireshark.nsi
1 ;
2 ; wireshark.nsi
3 ;
4 ; $Id$
5
6
7 ; Set the compression mechanism first.
8 ; As of NSIS 2.07, solid compression which makes installer about 1MB smaller
9 ; is no longer the default, so use the /SOLID switch.
10 ; This unfortunately is unknown to NSIS prior to 2.07 and creates an error.
11 ; So if you get an error here, please update to at least NSIS 2.07!
12 SetCompressor /SOLID lzma
13
14 InstType "un.Default (keep Personal Settings and WinPcap)"
15 InstType "un.All (remove all)"
16
17 ; Used to refresh the display of file association
18 !define SHCNE_ASSOCCHANGED 0x08000000
19 !define SHCNF_IDLIST 0
20
21 ; Used to add associations between file extensions and Wireshark
22 !define WIRESHARK_ASSOC "wireshark-capture-file"
23
24 ; ============================================================================
25 ; Header configuration
26 ; ============================================================================
27 ; The name of the installer
28 !define PROGRAM_NAME "Wireshark"
29 !if ${PLATFORM} == "win32"
30 !define BITS 32
31 !else
32 !define BITS 64
33 !endif
34
35 Name "${PROGRAM_NAME} ${VERSION} (${BITS}-bit)"
36
37 ; The file to write
38 OutFile "wireshark-${PLATFORM}-${VERSION}.exe"
39
40 ; Icon of installer and uninstaller
41 Icon "..\..\image\wiresharkinst.ico"
42 UninstallIcon "..\..\image\wiresharkinst.ico"
43
44 ; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
45 !define MUI_UNCONFIRMPAGE_TEXT_TOP "The following Wireshark installation will be uninstalled. Click 'Next' to continue."
46 ; Uninstall stuff (this text isn't used with the MODERN_UI!)
47 ;UninstallText "This will uninstall Wireshark.\r\nBefore starting the uninstallation, make sure Wireshark is not running.\r\nClick 'Next' to continue."
48
49 XPStyle on
50
51
52
53 ; ============================================================================
54 ; Modern UI
55 ; ============================================================================
56 ; The modern user interface will look much better than the common one.
57 ; However, as the development of the modern UI is still going on, and the script
58 ; syntax changes, you will need exactly that NSIS version, which this script is
59 ; made for. This is the current (December 2003) latest version: V2.0b4
60 ; If you are using a different version, it's not predictable what will happen.
61
62 !include "MUI.nsh"
63 ;!addplugindir ".\Plugins"
64
65 !define MUI_ICON "..\..\image\wiresharkinst.ico"
66 !define MUI_UNICON "..\..\image\wiresharkinst.ico"
67
68 !define MUI_COMPONENTSPAGE_SMALLDESC
69 !define MUI_FINISHPAGE_NOAUTOCLOSE
70 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
71 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Wireshark.\r\n\r\nBefore starting the installation, make sure Wireshark is not running.\r\n\r\nClick 'Next' to continue."
72 ;!define MUI_FINISHPAGE_LINK "Install WinPcap to be able to capture packets from a network!"
73 ;!define MUI_FINISHPAGE_LINK_LOCATION "http://www.winpcap.org"
74
75 ; NSIS shows Readme files by opening the Readme file with the default application for
76 ; the file's extension. "README.win32" won't work in most cases, because extension "win32"
77 ; is usually not associated with an appropriate text editor. We should use extension "txt"
78 ; for a text file or "html" for an html README file.
79 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NEWS.txt"
80 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show News"
81 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
82 !define MUI_FINISHPAGE_RUN "$INSTDIR\wireshark.exe"
83 !define MUI_FINISHPAGE_RUN_NOTCHECKED
84
85
86
87 !define MUI_PAGE_CUSTOMFUNCTION_SHOW myShowCallback
88
89 ; ============================================================================
90 ; MUI Pages
91 ; ============================================================================
92
93 !insertmacro MUI_PAGE_WELCOME
94 !insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
95 !insertmacro MUI_PAGE_COMPONENTS
96 Page custom DisplayAdditionalTasksPage
97 !insertmacro MUI_PAGE_DIRECTORY
98 Page custom DisplayWinPcapPage
99 !insertmacro MUI_PAGE_INSTFILES
100 !insertmacro MUI_PAGE_FINISH
101
102 !insertmacro MUI_UNPAGE_WELCOME
103 !insertmacro MUI_UNPAGE_CONFIRM
104 !insertmacro MUI_UNPAGE_COMPONENTS
105 !insertmacro MUI_UNPAGE_INSTFILES
106 !insertmacro MUI_UNPAGE_FINISH
107
108 ; ============================================================================
109 ; MUI Languages
110 ; ============================================================================
111
112 !insertmacro MUI_LANGUAGE "English"
113
114 ; ============================================================================
115 ; Reserve Files
116 ; ============================================================================
117
118   ;Things that need to be extracted on first (keep these lines before any File command!)
119   ;Only useful for BZIP2 compression
120
121   ReserveFile "AdditionalTasksPage.ini"
122   ReserveFile "WinPcapPage.ini"
123   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
124
125 ; ============================================================================
126 ; Section macros
127 ; ============================================================================
128 !include "Sections.nsh"
129
130 ; ========= Macro to unselect and disable a section =========
131
132 !macro DisableSection SECTION
133
134   Push $0
135     SectionGetFlags "${SECTION}" $0
136     IntOp $0 $0 & ${SECTION_OFF}
137     IntOp $0 $0 | ${SF_RO}
138     SectionSetFlags "${SECTION}" $0
139   Pop $0
140
141 !macroend
142
143 ; ========= Macro to enable (unreadonly) a section =========
144 !define SECTION_ENABLE   0xFFFFFFEF
145 !macro EnableSection SECTION
146
147   Push $0
148     SectionGetFlags "${SECTION}" $0
149     IntOp $0 $0 & ${SECTION_ENABLE}
150     SectionSetFlags "${SECTION}" $0
151   Pop $0
152
153 !macroend
154
155 ; ============================================================================
156 ; Services
157 ; ============================================================================
158 !include "servicelib.nsh"
159
160 ; ============================================================================
161 ; Command Line
162 ; ============================================================================
163 !include "FileFunc.nsh"
164
165 !insertmacro GetParameters
166 !insertmacro GetOptions
167
168 ; ============================================================================
169 ; License page configuration
170 ; ============================================================================
171 LicenseText "Wireshark is distributed under the GNU General Public License."
172 LicenseData "..\..\COPYING"
173
174 ; ============================================================================
175 ; Component page configuration
176 ; ============================================================================
177 ComponentText "The following components are available for installation."
178
179 ; Component check boxes
180 ; Commented out for NSIS v 2.0
181 ; EnabledBitmap "..\..\image\nsis-checked.bmp"
182 ; DisabledBitmap "..\..\image\nsis-unchecked.bmp"
183
184 ; ============================================================================
185 ; Directory selection page configuration
186 ; ============================================================================
187 ; The text to prompt the user to enter a directory
188 DirText "Choose a directory in which to install Wireshark."
189
190 ; The default installation directory
191 InstallDir $PROGRAMFILES\Wireshark\
192
193 ; See if this is an upgrade; if so, use the old InstallDir as default
194 InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\Wireshark "InstallDir"
195
196
197 ; ============================================================================
198 ; Install page configuration
199 ; ============================================================================
200 ShowInstDetails show
201 ShowUninstDetails show
202
203 ; ============================================================================
204 ; Functions and macros
205 ; ============================================================================
206 !macro UpdateIcons
207         Push $R0
208         Push $R1
209         Push $R2
210
211         !define UPDATEICONS_UNIQUE ${__LINE__}
212
213         IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}
214 UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE}:
215         System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
216         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
217
218 UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}:
219         MessageBox MB_OK|MB_ICONSTOP  \
220             "Can't find 'shell32.dll' library. Impossible to update icons" \
221             /SD IDOK
222         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
223
224 UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
225         !undef UPDATEICONS_UNIQUE
226         Pop $R2
227         Pop $R1
228         Pop $R0
229
230 !macroend
231
232 Function Associate
233         ; $R0 should contain the prefix to associate to Wireshark
234         Push $R1
235
236         ReadRegStr $R1 HKCR $R0 ""
237         StrCmp $R1 "" Associate.doRegister
238         Goto Associate.end
239 Associate.doRegister:
240         ;The extension is not associated to any program, we can do the link
241         WriteRegStr HKCR $R0 "" ${WIRESHARK_ASSOC}
242 Associate.end:
243         pop $R1
244 FunctionEnd
245
246 Function un.unlink
247         ; $R0 should contain the prefix to unlink
248         Push $R1
249
250         ReadRegStr $R1 HKCR $R0 ""
251         StrCmp $R1 ${WIRESHARK_ASSOC} un.unlink.doUnlink
252         Goto un.unlink.end
253 un.unlink.doUnlink:
254         ; The extension is associated with Wireshark so, we must destroy this!
255         DeleteRegKey HKCR $R0
256 un.unlink.end:
257         pop $R1
258 FunctionEnd
259
260 Var OLD_UNINSTALLER
261 Var OLD_INSTDIR
262 Var OLD_DISPLAYNAME
263 Var TMP_UNINSTALLER
264
265 Function .onInit
266   ; Copied from http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new
267   ReadRegStr $OLD_UNINSTALLER HKLM \
268     "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" \
269     "UninstallString"
270   StrCmp $OLD_UNINSTALLER "" done
271
272   ReadRegStr $OLD_INSTDIR HKLM \
273     "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe" \
274     "Path"
275   StrCmp $OLD_INSTDIR "" done
276
277   ReadRegStr $OLD_DISPLAYNAME HKLM \
278     "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" \
279     "DisplayName"
280   StrCmp $OLD_DISPLAYNAME "" done
281
282   MessageBox MB_YESNOCANCEL|MB_ICONQUESTION \
283     "$OLD_DISPLAYNAME is already installed.\
284     $\n$\nWould you like to uninstall it first?" \
285       /SD IDYES \
286       IDYES prep_uninstaller \
287       IDNO done
288   Abort
289  
290 ; Copy the uninstaller to $TEMP and run it.
291 ; The uninstaller normally does this by itself, but doesn't wait around
292 ; for the executable to finish, which means ExecWait won't work correctly.
293 prep_uninstaller:
294   ClearErrors
295   StrCpy $TMP_UNINSTALLER "$TEMP\wireshark_uninstaller.exe"
296   ; ...because we surround UninstallString in quotes.
297   StrCpy $0 $OLD_UNINSTALLER -1 1
298   StrCpy $1 "$TEMP\wireshark_uninstaller.exe"
299   StrCpy $2 1
300   System::Call 'kernel32::CopyFile(t r0, t r1, b r2) 1'
301   IfSilent silent_uninstall
302   ExecWait "$TMP_UNINSTALLER _?=$OLD_INSTDIR"
303   Goto cleanup
304
305 silent_uninstall:
306   ExecWait "$TMP_UNINSTALLER /S _?=$OLD_INSTDIR"
307
308 cleanup:
309   Delete "$TMP_UNINSTALLER"
310   
311 done:
312   ;Extract InstallOptions INI files
313   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini"
314   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "WinpcapPage.ini"
315 FunctionEnd
316
317 Function DisplayAdditionalTasksPage
318   !insertmacro MUI_HEADER_TEXT "Select Additional Tasks" "Which additional tasks should be done?"
319   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "AdditionalTasksPage.ini"
320 FunctionEnd
321
322 Function DisplayWinPcapPage
323   !insertmacro MUI_HEADER_TEXT "Install WinPcap?" "WinPcap is required to capture live network data. Should WinPcap be installed?"
324   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "WinPcapPage.ini"
325 FunctionEnd
326
327 ; ============================================================================
328 ; Installation execution commands
329 ; ============================================================================
330
331 Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key
332 ;Var WIRESHARK_UNINSTALL ;declare variable for holding the value of a registry key
333
334 Section "-Required"
335 ;-------------------------------------------
336
337 ;
338 ; Install for every user
339 ;
340 SetShellVarContext all
341
342
343
344 SetOutPath $INSTDIR
345 File "..\..\wiretap\wiretap-${WTAP_VERSION}.dll"
346 !ifdef ENABLE_LIBWIRESHARK
347 File "..\..\epan\libwireshark.dll"
348 !endif
349 File "..\..\wsutil\libwsutil.dll"
350 File "${GLIB_DIR}\bin\libgio-2.0-0.dll"
351 File "${GLIB_DIR}\bin\libglib-2.0-0.dll"
352 File "${GLIB_DIR}\bin\libgobject-2.0-0.dll"
353 File "${GLIB_DIR}\bin\libgmodule-2.0-0.dll"
354 !ifdef ICONV_DIR
355 File "${ICONV_DIR}\bin\iconv.dll"
356 !endif
357 File "${GETTEXT_DIR}\bin\intl.dll"
358 !ifdef ZLIB_DIR
359 File "${ZLIB_DIR}\zlib1.dll"
360 !endif
361 !ifdef C_ARES_DIR
362 File "${C_ARES_DIR}\cares.dll"
363 !endif
364 !ifdef ADNS_DIR
365 File "${ADNS_DIR}\..\${MSVC_VARIANT}\adns\adns_dll.dll"
366 !endif
367 !ifdef PCRE_DIR
368 File "${PCRE_DIR}\bin\pcre3.dll"
369 File "${PCRE_DIR}\man\cat3\pcrepattern.3.txt"
370 !endif
371 !ifdef KFW_DIR
372 File "${KFW_DIR}\bin\comerr32.dll"
373 File "${KFW_DIR}\bin\krb5_32.dll"
374 !endif
375 !ifdef GNUTLS_DIR
376 File "${GNUTLS_DIR}\bin\libgcrypt-11.dll"
377 File "${GNUTLS_DIR}\bin\libgnutls-26.dll"
378 File "${GNUTLS_DIR}\bin\libgnutls-extra-26.dll"
379 File "${GNUTLS_DIR}\bin\libgnutls-openssl-26.dll"
380 File "${GNUTLS_DIR}\bin\libgpg-error-0.dll"
381 File "${GNUTLS_DIR}\bin\libtasn1-3.dll"
382 !endif
383 !ifdef LUA_DIR
384 File "${LUA_DIR}\lua5.1.dll"
385 File "..\..\epan\wslua\init.lua"
386 File "..\..\epan\wslua\console.lua"
387 File "..\..\epan\wslua\dtd_gen.lua"
388 !endif
389 !ifdef SMI_DIR
390 File "${SMI_DIR}\lib\smi.dll"
391 !endif
392 File "..\..\README"
393 File "..\..\README.win32"
394 File "..\..\AUTHORS-SHORT"
395 File "..\..\COPYING"
396 File "NEWS.txt"
397 File "..\..\manuf"
398 File "..\..\services"
399 File "..\..\doc\ws.css"
400 File "..\..\doc\wireshark.html"
401 File "..\..\doc\wireshark-filter.html"
402 File "..\..\dumpcap.exe"
403 File "..\..\doc\dumpcap.html"
404 File "..\..\ipmap.html"
405
406 ; C-runtime redistributable
407 !ifdef VCREDIST_EXE
408 ; vcredist_x86.exe (MSVC V8) - copy and execute the redistributable installer
409 File "${VCREDIST_EXE}"
410 ExecWait '"$INSTDIR\vcredist_x86.exe"' $0
411 DetailPrint "vcredist_x86 returned $0"
412 !else
413 !ifdef MSVCR_DLL
414 ; msvcr*.dll (MSVC V7 or V7.1) - simply copy the dll file
415 !echo "IF YOU GET AN ERROR HERE, check the MSVC_VARIANT setting in config.nmake: MSVC2005 vs. MSVC2005EE!"
416 File "${MSVCR_DLL}"
417 !else
418 !if ${MSVC_VARIANT} != "MSVC6"
419 !error "C-Runtime redistributable for this package not available / not redistributable!"
420 !endif
421 !endif  ; MSVCR_DLL
422 !endif  ; VCREDIST_EXE
423
424
425 ; global config files - don't overwrite if already existing
426 ;IfFileExists cfilters dont_overwrite_cfilters
427 File "..\..\cfilters"
428 ;dont_overwrite_cfilters:
429 ;IfFileExists colorfilters dont_overwrite_colorfilters
430 File "..\..\colorfilters"
431 ;dont_overwrite_colorfilters:
432 ;IfFileExists dfilters dont_overwrite_dfilters
433 File "..\..\dfilters"
434 ;dont_overwrite_dfilters:
435 ;IfFileExists smi_modules dont_overwrite_smi_modules
436 File "..\..\smi_modules"
437 ;dont_overwrite_smi_modules:
438
439
440 ;
441 ; Install the Diameter DTD and XML files in the "diameter" subdirectory
442 ; of the installation directory.
443 ;
444 SetOutPath $INSTDIR\diameter
445 File "..\..\diameter\chargecontrol.xml"
446 File "..\..\diameter\dictionary.dtd"
447 File "..\..\diameter\dictionary.xml"
448 File "..\..\diameter\Ericsson.xml"
449 File "..\..\diameter\etsie2e4.xml"
450 File "..\..\diameter\gqpolicy.xml"
451 File "..\..\diameter\imscxdx.xml"
452 File "..\..\diameter\mobileipv4.xml"
453 File "..\..\diameter\nasreq.xml"
454 File "..\..\diameter\sip.xml"
455 File "..\..\diameter\sunping.xml"
456 File "..\..\diameter\TGPPGmb.xml"
457 File "..\..\diameter\TGPPRx.xml"
458 File "..\..\diameter\TGPPSh.xml"
459 SetOutPath $INSTDIR
460
461
462
463 ;
464 ; Install the RADIUS directory files in the "radius" subdirectory
465 ; of the installation directory.
466 ;
467 SetOutPath $INSTDIR\radius
468 File "..\..\radius\dictionary"
469 File "..\..\radius\dictionary.3com"
470 File "..\..\radius\dictionary.3gpp"
471 File "..\..\radius\dictionary.3gpp2"
472 File "..\..\radius\dictionary.acc"
473 File "..\..\radius\dictionary.alcatel"
474 File "..\..\radius\dictionary.alteon"
475 File "..\..\radius\dictionary.altiga"
476 File "..\..\radius\dictionary.aptis"
477 File "..\..\radius\dictionary.ascend"
478 File "..\..\radius\dictionary.aruba"
479 File "..\..\radius\dictionary.bay"
480 File "..\..\radius\dictionary.bintec"
481 File "..\..\radius\dictionary.bristol"
482 File "..\..\radius\dictionary.cablelabs"
483 File "..\..\radius\dictionary.cabletron"
484 File "..\..\radius\dictionary.cisco"
485 File "..\..\radius\dictionary.cisco.bbsm"
486 File "..\..\radius\dictionary.cisco.vpn3000"
487 File "..\..\radius\dictionary.cisco.vpn5000"
488 File "..\..\radius\dictionary.colubris"
489 File "..\..\radius\dictionary.columbia_university"
490 File "..\..\radius\dictionary.compat"
491 File "..\..\radius\dictionary.cosine"
492 File "..\..\radius\dictionary.ericsson"
493 File "..\..\radius\dictionary.erx"
494 File "..\..\radius\dictionary.extreme"
495 File "..\..\radius\dictionary.foundry"
496 File "..\..\radius\dictionary.freeradius"
497 File "..\..\radius\dictionary.gandalf"
498 File "..\..\radius\dictionary.garderos"
499 File "..\..\radius\dictionary.gemtek"
500 File "..\..\radius\dictionary.itk"
501 File "..\..\radius\dictionary.juniper"
502 File "..\..\radius\dictionary.karlnet"
503 File "..\..\radius\dictionary.livingston"
504 File "..\..\radius\dictionary.localweb"
505 File "..\..\radius\dictionary.merit"
506 File "..\..\radius\dictionary.microsoft"
507 File "..\..\radius\dictionary.mikrotik"
508 File "..\..\radius\dictionary.navini"
509 File "..\..\radius\dictionary.netscreen"
510 File "..\..\radius\dictionary.nokia"
511 File "..\..\radius\dictionary.nomadix"
512 File "..\..\radius\dictionary.propel"
513 File "..\..\radius\dictionary.quintum"
514 File "..\..\radius\dictionary.redback"
515 File "..\..\radius\dictionary.redcreek"
516 File "..\..\radius\dictionary.shasta"
517 File "..\..\radius\dictionary.shiva"
518 File "..\..\radius\dictionary.sonicwall"
519 File "..\..\radius\dictionary.springtide"
520 File "..\..\radius\dictionary.t_systems_nova"
521 File "..\..\radius\dictionary.telebit"
522 File "..\..\radius\dictionary.trapeze"
523 File "..\..\radius\dictionary.tunnel"
524 File "..\..\radius\dictionary.unisphere"
525 File "..\..\radius\dictionary.unix"
526 File "..\..\radius\dictionary.usr"
527 File "..\..\radius\dictionary.valemount"
528 File "..\..\radius\dictionary.versanet"
529 File "..\..\radius\dictionary.wispr"
530 File "..\..\radius\dictionary.xedia"
531 SetOutPath $INSTDIR
532
533 ;
534 ; install the dtds in the dtds subdirectory
535 ;
536 SetOutPath $INSTDIR\dtds
537 File "..\..\dtds\dc.dtd"
538 File "..\..\dtds\itunes.dtd"
539 File "..\..\dtds\mscml.dtd"
540 File "..\..\dtds\pocsettings.dtd"
541 File "..\..\dtds\presence.dtd"
542 File "..\..\dtds\reginfo.dtd"
543 File "..\..\dtds\rlmi.dtd"
544 File "..\..\dtds\rss.dtd"
545 File "..\..\dtds\smil.dtd"
546 File "..\..\dtds\xcap-caps.dtd"
547 File "..\..\dtds\xcap-error.dtd"
548 File "..\..\dtds\watcherinfo.dtd"
549 SetOutPath $INSTDIR
550
551 ; Install the TPNCP DAT file in the "tpncp" subdirectory
552 ; of the installation directory.
553 SetOutPath $INSTDIR\tpncp
554 File "..\..\tpncp\tpncp.dat"
555
556 ;
557 ; install the wimaxasncp TLV definitions in the wimaxasncp subdirectory
558 ;
559 SetOutPath $INSTDIR\wimaxasncp
560 File "..\..\wimaxasncp\dictionary.xml"
561 File "..\..\wimaxasncp\dictionary.dtd"
562 SetOutPath $INSTDIR
563
564 SetOutPath $INSTDIR\help
565 File "..\..\help\toc"
566 File "..\..\help\overview.txt"
567 File "..\..\help\getting_started.txt"
568 File "..\..\help\capturing.txt"
569 File "..\..\help\capture_filters.txt"
570 File "..\..\help\display_filters.txt"
571 File "..\..\help\faq.txt"
572
573 ; Write the uninstall keys for Windows
574 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "DisplayVersion" "${VERSION}"
575 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "DisplayName" "Wireshark ${VERSION}"
576 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString" '"$INSTDIR\uninstall.exe"'
577 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "Publisher" "The Wireshark developer community, http://www.wireshark.org"
578 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "HelpLink" "mailto:wireshark-users@wireshark.org"
579 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "URLInfoAbout" "http://www.wireshark.org"
580 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "URLUpdateInfo" "http://www.wireshark.org/download/win32/"
581 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "NoModify" 1
582 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "NoRepair" 1
583 WriteUninstaller "uninstall.exe"
584
585 ; Write an entry for ShellExecute
586 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe" "" '$INSTDIR\wireshark.exe'
587 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe" "Path" '$INSTDIR'
588
589 ; Create start menu entries (depending on additional tasks page)
590 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State"
591 StrCmp $0 "0" SecRequired_skip_StartMenu
592 SetOutPath $PROFILE
593 ;CreateDirectory "$SMPROGRAMS\Wireshark"
594 ; To qoute "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch11d.asp":
595 ; "Do not include Readme, Help, or Uninstall entries on the Programs menu."
596 Delete "$SMPROGRAMS\Wireshark\Wireshark Web Site.lnk"
597 ;WriteINIStr "$SMPROGRAMS\Wireshark\Wireshark Web Site.url" "InternetShortcut" "URL" "http://www.wireshark.org/"
598 CreateShortCut "$SMPROGRAMS\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
599 ;CreateShortCut "$SMPROGRAMS\Wireshark\Wireshark Manual.lnk" "$INSTDIR\wireshark.html"
600 ;CreateShortCut "$SMPROGRAMS\Wireshark\Display Filters Manual.lnk" "$INSTDIR\wireshark-filter.html"
601 ;CreateShortCut "$SMPROGRAMS\Wireshark\Wireshark Program Directory.lnk" "$INSTDIR"
602 ;CreateShortCut "$SMPROGRAMS\Wireshark\Uninstall Wireshark.lnk" "$INSTDIR\uninstall.exe"
603 SecRequired_skip_StartMenu:
604
605 ; is command line option "/desktopicon" set?
606 ${GetParameters} $R0
607 ${GetOptions} $R0 "/desktopicon=" $R1
608 StrCmp $R1 "no" SecRequired_skip_DesktopIcon
609 StrCmp $R1 "yes" SecRequired_install_DesktopIcon
610
611 ; Create desktop icon (depending on additional tasks page and command line option)
612 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State"
613 StrCmp $0 "0" SecRequired_skip_DesktopIcon
614 SecRequired_install_DesktopIcon:
615 CreateShortCut "$DESKTOP\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
616 SecRequired_skip_DesktopIcon:
617
618 ; is command line option "/quicklaunchicon" set?
619 ${GetParameters} $R0
620 ${GetOptions} $R0 "/quicklaunchicon=" $R1
621 StrCmp $R1 "no" SecRequired_skip_QuickLaunchIcon
622 StrCmp $R1 "yes" SecRequired_install_QuickLaunchIcon
623
624 ; Create quick launch icon (depending on additional tasks page and command line option)
625 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State"
626 StrCmp $0 "0" SecRequired_skip_QuickLaunchIcon
627 SecRequired_install_QuickLaunchIcon:
628 CreateShortCut "$QUICKLAUNCH\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
629 SecRequired_skip_QuickLaunchIcon:
630
631 ; Create File Extensions (depending on additional tasks page)
632 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "State"
633 StrCmp $0 "0" SecRequired_skip_FileExtensions
634 WriteRegStr HKCR ${WIRESHARK_ASSOC} "" "Wireshark capture file"
635 WriteRegStr HKCR "${WIRESHARK_ASSOC}\Shell\open\command" "" '"$INSTDIR\wireshark.exe" "%1"'
636 WriteRegStr HKCR "${WIRESHARK_ASSOC}\DefaultIcon" "" '"$INSTDIR\wireshark.exe",1'
637 push $R0
638         StrCpy $R0 ".5vw"
639         Call Associate
640         StrCpy $R0 ".acp"
641         Call Associate
642         StrCpy $R0 ".apc"
643         Call Associate
644         StrCpy $R0 ".atc"
645         Call Associate
646         StrCpy $R0 ".bfr"
647         Call Associate
648         StrCpy $R0 ".cap"
649         Call Associate
650         StrCpy $R0 ".enc"
651         Call Associate
652         StrCpy $R0 ".erf"
653         Call Associate
654         StrCpy $R0 ".fdc"
655         Call Associate
656         StrCpy $R0 ".pcap"
657         Call Associate
658         StrCpy $R0 ".pkt"
659         Call Associate
660         StrCpy $R0 ".snoop"
661         Call Associate
662         StrCpy $R0 ".syc"
663         Call Associate
664         StrCpy $R0 ".tpc"
665         Call Associate
666         StrCpy $R0 ".tr1"
667         Call Associate
668         StrCpy $R0 ".trace"
669         Call Associate
670         StrCpy $R0 ".trc"
671         Call Associate
672         StrCpy $R0 ".wpc"
673         Call Associate
674         StrCpy $R0 ".wpz"
675         Call Associate
676         StrCpy $R0 ".rf5"
677         Call Associate
678 ; if somethings added here, add it also to the uninstall section and the AdditionalTask page
679 pop $R0
680 !insertmacro UpdateIcons
681 SecRequired_skip_FileExtensions:
682
683 ; if running as a silent installer, don't try to install winpcap
684 IfSilent SecRequired_skip_Winpcap
685
686 ; Install WinPcap (depending on winpcap page setting)
687 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State"
688 StrCmp $0 "0" SecRequired_skip_Winpcap
689 ; Uinstall old WinPcap first
690 ReadRegStr $WINPCAP_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
691 IfErrors lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
692 ; from released version 3.1, WinPcap will uninstall an old version by itself
693 ;ExecWait '$WINPCAP_UNINSTALL' $0
694 ;DetailPrint "WinPcap uninstaller returned $0"
695 lbl_winpcap_notinstalled:
696 SetOutPath $INSTDIR
697 File "WinPcap_4_0_2.exe"
698 ExecWait '"$INSTDIR\WinPcap_4_0_2.exe"' $0
699 DetailPrint "WinPcap installer returned $0"
700 SecRequired_skip_Winpcap:
701
702 ; Load Winpcap NPF service at startup (depending on winpcap page)
703 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State"
704 StrCmp $0 "0" SecRequired_no_WinpcapService
705 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 2 ;set NPF to (SERVICE_AUTO_START)
706 !insertmacro SERVICE "start" "NPF" ""
707 Goto SecRequired_done_WinpcapService
708 SecRequired_no_WinpcapService:
709 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 3 ;set NPF to (SERVICE_DEMAND_START)
710 !insertmacro SERVICE "stop" "NPF" ""
711 SecRequired_done_WinpcapService:
712
713 ; If no user profile exists for Wireshark but for Ethereal, copy it over
714 SetShellVarContext current
715 IfFileExists $APPDATA\Wireshark profile_done
716 IfFileExists $APPDATA\Ethereal 0 profile_done
717 ;MessageBox MB_YESNO "This seems to be the first time you use Wireshark. Copy over the personal settings from Ethereal?" /SD IDYES IDNO profile_done
718 CreateDirectory $APPDATA\Wireshark
719 CopyFiles $APPDATA\Ethereal\*.* $APPDATA\Wireshark
720 profile_done:
721 SetShellVarContext all
722
723 SectionEnd ; "Required"
724
725 !ifdef GTK_DIR
726 Section "Wireshark" SecWireshark
727 ;-------------------------------------------
728 SetOutPath $INSTDIR
729 File "..\..\wireshark.exe"
730 File "${GTK_DIR}\bin\libgdk-win32-2.0-0.dll"
731 File "${GTK_DIR}\bin\libgdk_pixbuf-2.0-0.dll"
732 File "${GTK_DIR}\bin\libgtk-win32-2.0-0.dll"
733 File "${GTK_DIR}\bin\libatk-1.0-0.dll"
734 File "${GTK_DIR}\bin\libpango-1.0-0.dll"
735 File "${GTK_DIR}\bin\libpangowin32-1.0-0.dll"
736 !ifdef NEED_CAIRO_DLL
737 File "${GTK_DIR}\bin\libcairo-2.dll"
738 File "${GTK_DIR}\bin\libpangocairo-1.0-0.dll"
739 !endif
740 !ifdef NEED_LIBPNG_DLL
741 File "${GTK_DIR}\bin\libpng12-0.dll"
742 !endif
743 !ifdef NEED_LIBTIFF_DLL
744 File "${GTK_DIR}\bin\libtiff3.dll"
745 !endif
746 !ifdef NEED_LIBJPEG_DLL
747 File "${GTK_DIR}\bin\jpeg62.dll"
748 !endif
749 SetOutPath $INSTDIR\etc\gtk-2.0
750 File "${GTK_DIR}\etc\gtk-2.0\*.*"
751 SetOutPath $INSTDIR\etc\pango
752 File "${GTK_DIR}\etc\pango\pango.*"
753 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK_LIB_DIR}\loaders
754 File "${GTK_DIR}\lib\gtk-2.0\${GTK_LIB_DIR}\loaders\libpixbufloader-*.dll"
755 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK_LIB_DIR}\engines
756 File "${GTK_DIR}\lib\gtk-2.0\${GTK_LIB_DIR}\engines\libpixmap.dll"
757 SetOutPath $INSTDIR\lib\gtk-2.0\modules
758 File "${GTK_DIR}\lib\gtk-2.0\modules\libgail.dll"
759 # Not needed with pango 1.14.5
760 #SetOutPath $INSTDIR\lib\pango\${PANGO_LIB_DIR}\modules
761 #File "${GTK_DIR}\lib\pango\${PANGO_LIB_DIR}\modules\pango-*.dll"
762
763 ; GTK MS-Windows Engine (GTK-Wimp)
764 SetOutPath $INSTDIR\${GTK_WIMP_DLLDST_DIR}
765 File "${GTK_WIMP_DLLSRC_DIR}\libwimp.dll"
766 SetOutPath $INSTDIR\${GTK_WIMP_RCDST_DIR}
767 File "${GTK_WIMP_RCSRC_DIR}\gtkrc"
768
769 SectionEnd ; "Wireshark"
770 !endif
771
772
773 Section "TShark" SecTShark
774 ;-------------------------------------------
775 SetOutPath $INSTDIR
776 File "..\..\tshark.exe"
777 File "..\..\doc\tshark.html"
778 SectionEnd
779
780 SectionGroup "Plugins / Extensions" SecPluginsGroup
781
782 Section "Dissector Plugins" SecPlugins
783 ;-------------------------------------------
784 SetOutPath $INSTDIR\plugins\${VERSION}
785 File "..\..\plugins\agentx\agentx.dll"
786 File "..\..\plugins\artnet\artnet.dll"
787 File "..\..\plugins\asn1\asn1.dll"
788 File "..\..\plugins\ciscosm\ciscosm.dll"
789 File "..\..\plugins\docsis\docsis.dll"
790 File "..\..\plugins\enttec\enttec.dll"
791 File "..\..\plugins\ethercat\ethercat.dll"
792 File "..\..\plugins\giop\coseventcomm.dll"
793 File "..\..\plugins\giop\cosnaming.dll"
794 File "..\..\plugins\giop\parlay.dll"
795 File "..\..\plugins\giop\tango.dll"
796 File "..\..\plugins\gryphon\gryphon.dll"
797 File "..\..\plugins\infiniband\infiniband.dll"
798 File "..\..\plugins\irda\irda.dll"
799 File "..\..\plugins\m2m\m2m.dll"
800 File "..\..\plugins\profinet\profinet.dll"
801 File "..\..\plugins\sercosiii\sercosiii.dll"
802 File "..\..\plugins\unistim\unistim.dll"
803 File "..\..\plugins\wimax\wimax.dll"
804 File "..\..\plugins\wimaxasncp\wimaxasncp.dll"
805 SectionEnd
806
807 Section "Tree Statistics Plugin" SecStatsTree
808 ;-------------------------------------------
809 SetOutPath $INSTDIR\plugins\${VERSION}
810 File "..\..\plugins\stats_tree\stats_tree.dll"
811 SectionEnd
812
813 Section "Mate - Meta Analysis and Tracing Engine" SecMate
814 ;-------------------------------------------
815 SetOutPath $INSTDIR\plugins\${VERSION}
816 File "..\..\plugins\mate\mate.dll"
817 SectionEnd
818
819
820 !ifdef NET_SNMP_DIR
821 Section "SNMP MIBs" SecMIBs
822 ;-------------------------------------------
823 SetOutPath $INSTDIR\snmp\mibs
824 File "${NET_SNMP_DIR}\mibs\*.txt"
825 SectionEnd
826 !endif
827
828 !ifdef SMI_DIR
829 Section "SNMP MIBs" SecMIBs
830 ;-------------------------------------------
831 SetOutPath $INSTDIR\snmp\mibs
832 File "${SMI_DIR}\mibs\*"
833 SectionEnd
834 !endif
835
836 SectionGroupEnd ; "Plugins / Extensions"
837
838
839 SectionGroup "Tools" SecToolsGroup
840
841 Section "Editcap" SecEditcap
842 ;-------------------------------------------
843 SetOutPath $INSTDIR
844 File "..\..\editcap.exe"
845 File "..\..\doc\editcap.html"
846 SectionEnd
847
848 Section "Text2Pcap" SecText2Pcap
849 ;-------------------------------------------
850 SetOutPath $INSTDIR
851 File "..\..\text2pcap.exe"
852 File "..\..\doc\text2pcap.html"
853 SectionEnd
854
855 Section "Mergecap" SecMergecap
856 ;-------------------------------------------
857 SetOutPath $INSTDIR
858 File "..\..\mergecap.exe"
859 File "..\..\doc\mergecap.html"
860 SectionEnd
861
862 Section "Capinfos" SecCapinfos
863 ;-------------------------------------------
864 SetOutPath $INSTDIR
865 File "..\..\capinfos.exe"
866 File "..\..\doc\capinfos.html"
867 SectionEnd
868
869 Section "Rawshark" SecRawshark
870 ;-------------------------------------------
871 SetOutPath $INSTDIR
872 File "..\..\rawshark.exe"
873 File "..\..\doc\rawshark.html"
874 SectionEnd
875
876 SectionGroupEnd ; "Tools"
877
878 !ifdef HHC_DIR
879 Section "User's Guide" SecUsersGuide
880 ;-------------------------------------------
881 SetOutPath $INSTDIR
882 File "user-guide.chm"
883 SectionEnd
884 !endif
885
886 Section "Uninstall" un.SecUinstall
887 ;-------------------------------------------
888
889 ;
890 ; UnInstall for every user
891 ;
892 SectionIn 1 2
893 SetShellVarContext all
894
895 Delete "$INSTDIR\rawshark.exe"
896 IfErrors 0 NoRawsharkErrorMsg
897         MessageBox MB_OK "Please note: rawshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if rawshark.exe removed
898         Abort "Please note: rawshark.exe could not be removed, it's probably in use! Abort uninstall process!"
899 NoRawsharkErrorMsg:
900
901 Delete "$INSTDIR\tshark.exe"
902 IfErrors 0 NoTSharkErrorMsg
903         MessageBox MB_OK "Please note: tshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tshark.exe removed
904         Abort "Please note: tshark.exe could not be removed, it's probably in use! Abort uninstall process!"
905 NoTSharkErrorMsg:
906
907 Delete "$INSTDIR\wireshark.exe"
908 IfErrors 0 NoWiresharkErrorMsg
909         MessageBox MB_OK "Please note: wireshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if wireshark.exe removed
910         Abort "Please note: wireshark.exe could not be removed, it's probably in use! Abort uninstall process!"
911 NoWiresharkErrorMsg:
912
913 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark"
914 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Wireshark"
915 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe"
916
917 push $R0
918         StrCpy $R0 ".5vw"
919         Call un.unlink
920         StrCpy $R0 ".acp"
921         Call un.unlink
922         StrCpy $R0 ".apc"
923         Call un.unlink
924         StrCpy $R0 ".atc"
925         Call un.unlink
926         StrCpy $R0 ".bfr"
927         Call un.unlink
928         StrCpy $R0 ".cap"
929         Call un.unlink
930         StrCpy $R0 ".enc"
931         Call un.unlink
932         StrCpy $R0 ".erf"
933         Call un.unlink
934         StrCpy $R0 ".fdc"
935         Call un.unlink
936         StrCpy $R0 ".pcap"
937         Call un.unlink
938         StrCpy $R0 ".pkt"
939         Call un.unlink
940         StrCpy $R0 ".snoop"
941         Call un.unlink
942         StrCpy $R0 ".syc"
943         Call un.unlink
944         StrCpy $R0 ".tpc"
945         Call un.unlink
946         StrCpy $R0 ".tr1"
947         Call un.unlink
948         StrCpy $R0 ".trace"
949         Call un.unlink
950         StrCpy $R0 ".trc"
951         Call un.unlink
952         StrCpy $R0 ".wpc"
953         Call un.unlink
954         StrCpy $R0 ".wpz"
955         Call un.unlink
956         StrCpy $R0 ".rf5"
957         Call un.unlink
958 pop $R0
959
960 DeleteRegKey HKCR ${WIRESHARK_ASSOC}
961 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command"
962 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon"
963 !insertmacro UpdateIcons
964
965 Delete "$INSTDIR\etc\gtk-2.0\*.*"
966 Delete "$INSTDIR\etc\pango\*.*"
967 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
968 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
969 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
970 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
971 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
972 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
973 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.*"
974 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\loaders\*.*"
975 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\immodules\*.*"
976 Delete "$INSTDIR\lib\gtk-2.0\modules\*.*"
977 Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
978 Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
979 Delete "$INSTDIR\lib\pango\1.5.0\modules\*.*"
980 Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
981 Delete "$INSTDIR\help\*.*"
982 Delete "$INSTDIR\diameter\*.*"
983 Delete "$INSTDIR\snmp\mibs\*.*"
984 Delete "$INSTDIR\snmp\*.*"
985 Delete "$INSTDIR\tpncp\*.*"
986 Delete "$INSTDIR\wimaxasncp\*.*"
987 Delete "$INSTDIR\*.exe"
988 Delete "$INSTDIR\*.dll"
989 Delete "$INSTDIR\*.html"
990 Delete "$INSTDIR\ws.css"
991 Delete "$INSTDIR\COPYING"
992 Delete "$INSTDIR\AUTHORS-SHORT"
993 ; previous versions installed these files
994 Delete "$INSTDIR\*.manifest"
995 ; previous versions installed this file
996 Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
997 Delete "$INSTDIR\README*"
998 Delete "$INSTDIR\NEWS.txt"
999 Delete "$INSTDIR\manuf"
1000 Delete "$INSTDIR\services"
1001 Delete "$INSTDIR\pcrepattern.3.txt"
1002 Delete "$INSTDIR\user-guide.chm"
1003 Delete "$INSTDIR\example_snmp_users_file"
1004 Delete "$INSTDIR\ipmap.html"
1005 Delete "$INSTDIR\radius\*.*"
1006 Delete "$INSTDIR\dtds\*.*"
1007 Delete "$SMPROGRAMS\Wireshark\*.*"
1008 Delete "$SMPROGRAMS\Wireshark.lnk"
1009 Delete "$DESKTOP\Wireshark.lnk"
1010 Delete "$QUICKLAUNCH\Wireshark.lnk"
1011
1012 RMDir "$INSTDIR\etc\gtk-2.0"
1013 RMDir "$INSTDIR\etc\pango"
1014 RMDir "$INSTDIR\etc"
1015 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
1016 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
1017 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
1018 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
1019 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
1020 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
1021 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
1022 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
1023 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\engines"
1024 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\loaders"
1025 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\immodules"
1026 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0"
1027 RMDir "$INSTDIR\lib\gtk-2.0\modules"
1028 RMDir "$INSTDIR\lib\gtk-2.0"
1029 RMDir "$INSTDIR\lib\pango\1.2.0\modules"
1030 RMDir "$INSTDIR\lib\pango\1.2.0"
1031 RMDir "$INSTDIR\lib\pango\1.4.0\modules"
1032 RMDir "$INSTDIR\lib\pango\1.4.0"
1033 RMDir "$INSTDIR\lib\pango\1.5.0\modules"
1034 RMDir "$INSTDIR\lib\pango\1.5.0"
1035 RMDir "$INSTDIR\lib\pango"
1036 RMDir "$INSTDIR\lib"
1037 RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
1038 RMDir "$INSTDIR\share\themes\Default"
1039 RMDir "$INSTDIR\share\themes"
1040 RMDir "$INSTDIR\share"
1041 RMDir "$SMPROGRAMS\Wireshark"
1042 RMDir "$INSTDIR\help"
1043 RMDir "$INSTDIR\diameter"
1044 RMDir "$INSTDIR\snmp\mibs"
1045 RMDir "$INSTDIR\snmp"
1046 RMDir "$INSTDIR\radius"
1047 RMDir "$INSTDIR\dtds"
1048 RMDir "$INSTDIR\tpncp"
1049 RMDir "$INSTDIR\wimaxasncp"
1050 RMDir "$INSTDIR"
1051
1052 SectionEnd ; "Uinstall"
1053
1054 Section "Un.Plugins" un.SecPlugins
1055 ;-------------------------------------------
1056 SectionIn 1 2
1057 ;Delete "$INSTDIR\plugins\${VERSION}\*.*"
1058 ;Delete "$INSTDIR\plugins\*.*"
1059 ;RMDir "$INSTDIR\plugins\${VERSION}"
1060 ;RMDir "$INSTDIR\plugins"
1061 RMDir /r "$INSTDIR\plugins"
1062 SectionEnd
1063
1064 Section "Un.Global Settings" un.SecGlobalSettings
1065 ;-------------------------------------------
1066 SectionIn 1 2
1067 Delete "$INSTDIR\cfilters"
1068 Delete "$INSTDIR\colorfilters"
1069 Delete "$INSTDIR\dfilters"
1070 Delete "$INSTDIR\init.lua"
1071 Delete "$INSTDIR\console.lua"
1072 Delete "$INSTDIR\dtd_gen.lua"
1073 Delete "$INSTDIR\smi_modules"
1074 RMDir "$INSTDIR"
1075 SectionEnd
1076
1077 Section /o "Un.Personal Settings" un.SecPersonalSettings
1078 ;-------------------------------------------
1079 SectionIn 2
1080 SetShellVarContext current
1081 Delete "$APPDATA\Wireshark\*.*"
1082 RMDir "$APPDATA\Wireshark"
1083 SectionEnd
1084
1085 ;VAR un.WINPCAP_UNINSTALL
1086
1087 Section /o "Un.WinPcap" un.SecWinPcap
1088 ;-------------------------------------------
1089 SectionIn 2
1090 ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
1091 ;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
1092 ;MessageBox MB_OK "WinPcap $1"
1093 ExecWait '$1' $0
1094 DetailPrint "WinPcap uninstaller returned $0"
1095 ;SetRebootFlag true
1096 ;un.lbl_winpcap_notinstalled:
1097 SectionEnd
1098
1099 Section "-Un.Finally"
1100 ;-------------------------------------------
1101 SectionIn 1 2
1102 ; this test must be done after all other things uninstalled (e.g. Global Settings)
1103 IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
1104     MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if dir doesn't exist
1105 NoFinalErrorMsg:
1106 SectionEnd
1107
1108
1109 ; ============================================================================
1110 ; PLEASE MAKE SURE, THAT THE DESCRIPTIVE TEXT FITS INTO THE DESCRIPTION FIELD!
1111 ; ============================================================================
1112 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1113 !ifdef GTK_DIR
1114   !insertmacro MUI_DESCRIPTION_TEXT ${SecWireshark} "${PROGRAM_NAME} is a GUI network protocol analyzer."
1115 !endif
1116   !insertmacro MUI_DESCRIPTION_TEXT ${SecTShark} "TShark is a text based network protocol analyzer."
1117   !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} "Some plugins and extensions for both Wireshark and TShark."
1118   !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections."
1119   !insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Plugin for some extended statistics."
1120   !insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)."
1121 !ifdef NET_SNMP_DIR
1122   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
1123 !endif
1124 !ifdef SMI_DIR
1125   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
1126 !endif
1127   !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools."
1128   !insertmacro MUI_DESCRIPTION_TEXT ${SecEditCap} "Editcap is a program that reads a capture file and writes some or all of the packets into another capture file."
1129   !insertmacro MUI_DESCRIPTION_TEXT ${SecText2Pcap} "Text2pcap is a program that reads in an ASCII hex dump and writes the data into a libpcap-style capture file."
1130   !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Mergecap is a program that combines multiple saved capture files into a single output file"
1131   !insertmacro MUI_DESCRIPTION_TEXT ${SecCapinfos} "Capinfos is a program that provides information on capture files."
1132   !insertmacro MUI_DESCRIPTION_TEXT ${SecRawshark} "Rawshark is a raw packet filter."
1133 !ifdef HHC_DIR
1134   !insertmacro MUI_DESCRIPTION_TEXT ${SecUsersGuide} "Install the user's guide, so an internet connection is not required to read the help pages."
1135 !endif
1136 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1137
1138 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1139   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all Wireshark components."
1140   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous Wireshark versions)."
1141   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
1142   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
1143   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
1144 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1145
1146 ; ============================================================================
1147 ; Callback functions
1148 ; ============================================================================
1149 !ifdef GTK_DIR
1150 ; Disable File extensions if Wireshark isn't selected
1151 Function .onSelChange
1152         Push $0
1153         SectionGetFlags ${SecWireshark} $0
1154         IntOp  $0 $0 & 1
1155         IntCmp $0 0 onSelChange.unselect
1156         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "State" 1
1157         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "Flags" ""
1158         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 7" "Flags" ""
1159         Goto onSelChange.end
1160
1161 onSelChange.unselect:
1162         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "State" 0
1163         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "Flags" "DISABLED"
1164         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 7" "Flags" "DISABLED"
1165         Goto onSelChange.end
1166
1167 onSelChange.end:
1168         Pop $0
1169 FunctionEnd
1170 !endif
1171
1172
1173 !include "GetWindowsVersion.nsh"
1174 !include WinMessages.nsh
1175 !include "VersionCompare.nsh"
1176
1177 Var NPF_START ; NPF service registry key
1178 Var WINPCAP_NAME ; DisplayName from WinPcap installation
1179 Var WINPCAP_VERSION ; DisplayVersion from WinPcap installation
1180
1181 Function myShowCallback
1182
1183         ; Get the Windows version
1184         Call GetWindowsVersion
1185         Pop $R0 ; Windows Version
1186
1187         ; Check if we're able to run with this version
1188         StrCmp $R0 '95' lbl_winversion_unsupported
1189         StrCmp $R0 '98' lbl_winversion_unsupported
1190         StrCmp $R0 'ME' lbl_winversion_unsupported
1191         StrCmp $R0 'NT 4.0' lbl_winversion_unsupported_nt4
1192         Goto lbl_winversion_supported
1193 lbl_winversion_unsupported:
1194         MessageBox MB_OK \
1195             "Windows $R0 is no longer supported. The last known version working with 98/ME was Ethereal 0.99.0!" \
1196             /SD IDOK
1197             
1198         Quit
1199
1200 lbl_winversion_unsupported_nt4:
1201         MessageBox MB_OK \
1202             "Windows $R0 is no longer supported. The last known version working with NT 4.0 was Wireshark 0.99.4!" \
1203             /SD IDOK
1204         Quit
1205
1206 lbl_winversion_supported:
1207
1208         ; detect if WinPcap should be installed
1209         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Text" "Install WinPcap 4.0.2"
1210         ReadRegStr $WINPCAP_NAME HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName"
1211         IfErrors 0 lbl_winpcap_installed ;if RegKey is available, WinPcap is already installed
1212         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "WinPcap is currently not installed"
1213         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Flags" "DISABLED"
1214         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)"
1215         Goto lbl_winpcap_done
1216
1217 lbl_winpcap_installed:
1218         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$WINPCAP_NAME"
1219         ; Compare the installed build against the one we have.
1220         ReadRegStr $WINPCAP_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayVersion"
1221         StrCmp $WINPCAP_VERSION "" lbl_winpcap_do_install ; WinPcap is really old(?) or installed improperly.
1222         ${VersionCompare} $WINPCAP_VERSION "4.0.0.1040" $1 ; WinPcap 4.0.2
1223         StrCmp $1 "2" lbl_winpcap_do_install
1224
1225 ;lbl_winpcap_dont_install:
1226         ; The installed version is >= to what we have, so don't install
1227         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0"
1228         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If selected, the currently installed $WINPCAP_NAME will be uninstalled first."
1229         Goto lbl_winpcap_done
1230
1231 ;lbl_winpcap_dont_upgrade:
1232         ; force the user to upgrade by hand
1233         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0"
1234         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Flags" "DISABLED"
1235         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If you wish to install WinPcap 4.0.2, please uninstall $WINPCAP_NAME manually first."
1236         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Flags" "DISABLED"
1237         Goto lbl_winpcap_done
1238
1239 lbl_winpcap_do_install:
1240         ; seems to be an old version, install newer one
1241         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "1"
1242         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_NAME will be uninstalled first."
1243
1244 lbl_winpcap_done:
1245
1246         ; Disable NPF service setting for Win OT
1247         StrCmp $R0 '95' lbl_npf_disable
1248         StrCmp $R0 '98' lbl_npf_disable
1249         StrCmp $R0 'ME' lbl_npf_disable
1250         ; Enable NPF by default under Vista.
1251         StrCmp $R0 'Vista' lbl_npf_enable
1252         ReadRegDWORD $NPF_START HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start"
1253         ; (Winpcap may not be installed already, so no regKey is no error here)
1254         IfErrors lbl_npf_done ;RegKey not available, so do not set it
1255         IntCmp $NPF_START 2 0 lbl_npf_done lbl_npf_done
1256 lbl_npf_enable:
1257         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "1"
1258         Goto lbl_npf_done
1259         ;disable
1260 lbl_npf_disable:
1261         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "0"
1262         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "Flags" "DISABLED"
1263         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 9" "Flags" "DISABLED"
1264 lbl_npf_done:
1265
1266
1267         ; if Wireshark was previously installed, unselect previously not installed icons etc.
1268         ; detect if Wireshark is already installed ->
1269         ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString"
1270         IfErrors lbl_wireshark_notinstalled ;if RegKey is unavailable, Wireshark is not installed
1271
1272         ; only select Start Menu Group, if previously installed
1273         ; (we use the "all users" start menu, so select it first)
1274         SetShellVarContext all
1275         IfFileExists "$SMPROGRAMS\Wireshark\Wireshark.lnk" lbl_have_startmenu
1276         IfFileExists "$SMPROGRAMS\Wireshark.lnk" lbl_have_startmenu
1277         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State" "0"
1278 lbl_have_startmenu:
1279
1280         ; only select Desktop Icon, if previously installed
1281         IfFileExists "$DESKTOP\Wireshark.lnk" lbl_have_desktopicon
1282         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State" "0"
1283 lbl_have_desktopicon:
1284
1285         ; only select Quick Launch Icon, if previously installed
1286         IfFileExists "$QUICKLAUNCH\Wireshark.lnk" lbl_have_quicklaunchicon
1287         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State" "0"
1288 lbl_have_quicklaunchicon:
1289
1290 lbl_wireshark_notinstalled:
1291
1292
1293 FunctionEnd