Ethercat plugin
[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 !ifdef GTK1_DIR & GTK2_DIR
15 InstType "Wireshark (GTK2 user interface)"
16 InstType "Wireshark (legacy GTK1 user interface)"
17 !endif
18
19 InstType "un.Default (keep Personal Settings and WinPcap)"
20 InstType "un.All (remove all)"
21
22 ; Used to refresh the display of file association
23 !define SHCNE_ASSOCCHANGED 0x08000000
24 !define SHCNF_IDLIST 0
25
26 ; Used to add associations between file extensions and Wireshark
27 !define WIRESHARK_ASSOC "wireshark-file"
28
29 ; ============================================================================
30 ; Header configuration
31 ; ============================================================================
32 ; The name of the installer
33 !define PROGRAM_NAME "Wireshark"
34
35 Name "${PROGRAM_NAME} ${VERSION}"
36
37 ; The file to write
38 OutFile "${DEST}-setup-${VERSION}.exe"
39
40 ; Icon of installer and uninstaller
41 Icon "..\..\image\wireshark.ico"
42 UninstallIcon "..\..\image\wireshark.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\wireshark.ico"
66 !define MUI_UNICON "..\..\image\wireshark.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.next1_${UPDATEICONS_UNIQUE} UpdateIcons.error1_${UPDATEICONS_UNIQUE}
214 UpdateIcons.next1_${UPDATEICONS_UNIQUE}:
215         GetDllVersion "$SYSDIR\shell32.dll" $R0 $R1
216         IntOp $R2 $R0 / 0x00010000
217         IntCmp $R2 4 UpdateIcons.next2_${UPDATEICONS_UNIQUE} UpdateIcons.error2_${UPDATEICONS_UNIQUE}
218 UpdateIcons.next2_${UPDATEICONS_UNIQUE}:
219         System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
220         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
221
222 UpdateIcons.error1_${UPDATEICONS_UNIQUE}:
223         MessageBox MB_OK|MB_ICONSTOP  "Can't find 'shell32.dll' library. Impossible to update icons"
224         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
225 UpdateIcons.error2_${UPDATEICONS_UNIQUE}:
226         MessageBox MB_OK|MB_ICONINFORMATION "You should install the free 'Microsoft Layer for Unicode' to update Wireshark capture file icons"
227         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
228 UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
229         !undef UPDATEICONS_UNIQUE
230         Pop $R2
231         Pop $R1
232         Pop $R0
233
234 !macroend
235
236 Function Associate
237         ; $R0 should contain the prefix to associate to Wireshark
238         Push $R1
239
240         ReadRegStr $R1 HKCR $R0 ""
241         StrCmp $R1 "" Associate.doRegister
242         Goto Associate.end
243 Associate.doRegister:
244         ;The extension is not associated to any program, we can do the link
245         WriteRegStr HKCR $R0 "" ${WIRESHARK_ASSOC}
246 Associate.end:
247         pop $R1
248 FunctionEnd
249
250 Function un.unlink
251         ; $R0 should contain the prefix to unlink
252         Push $R1
253
254         ReadRegStr $R1 HKCR $R0 ""
255         StrCmp $R1 ${WIRESHARK_ASSOC} un.unlink.doUnlink
256         Goto un.unlink.end
257 un.unlink.doUnlink:
258         ; The extension is associated with Wireshark so, we must destroy this!
259         DeleteRegKey HKCR $R0
260 un.unlink.end:
261         pop $R1
262 FunctionEnd
263
264 Function .onInit
265   ;Extract InstallOptions INI files
266   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini"
267   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "WinpcapPage.ini"
268 FunctionEnd
269
270 Function DisplayAdditionalTasksPage
271   !insertmacro MUI_HEADER_TEXT "Select Additional Tasks" "Which additional tasks should be done?"
272   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "AdditionalTasksPage.ini"
273 FunctionEnd
274
275 Function DisplayWinPcapPage
276   !insertmacro MUI_HEADER_TEXT "Install WinPcap?" "WinPcap is required to capture live network data. Should WinPcap be installed?"
277   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "WinPcapPage.ini"
278 FunctionEnd
279
280 ; ============================================================================
281 ; Installation execution commands
282 ; ============================================================================
283
284 Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key
285 ;Var WIRESHARK_UNINSTALL ;declare variable for holding the value of a registry key
286
287 Section "-Required"
288 ;-------------------------------------------
289
290 ;
291 ; Install for every user
292 ;
293 !ifdef GTK1_DIR & GTK2_DIR
294 SectionIn 1 2 RO
295 !endif
296 SetShellVarContext all
297
298
299
300 SetOutPath $INSTDIR
301 File "..\..\wiretap\wiretap-${WTAP_VERSION}.dll"
302 !ifdef ENABLE_LIBWIRESHARK
303 File "..\..\epan\libwireshark.dll"
304 !endif
305 File "${GLIB_DIR}\bin\libglib-2.0-0.dll"
306 File "${GLIB_DIR}\bin\libgmodule-2.0-0.dll"
307 File "${GLIB_DIR}\bin\libgobject-2.0-0.dll"
308 File "${ICONV_DIR}\bin\iconv.dll"
309 File "${GETTEXT_DIR}\bin\intl.dll"
310 !ifdef ZLIB_DIR
311 File "${ZLIB_DIR}\zlib1.dll"
312 !endif
313 !ifdef ADNS_DIR
314 File "${ADNS_DIR}\adns_win32\LIB\adns_dll.dll"
315 !endif
316 !ifdef PCRE_DIR
317 File "${PCRE_DIR}\bin\pcre.dll"
318 File "${PCRE_DIR}\man\cat3\pcrepattern.3.txt"
319 !endif
320 !ifdef KFW_DIR
321 File "${KFW_DIR}\bin\comerr32.dll"
322 File "${KFW_DIR}\bin\krb5_32.dll"
323 !endif
324 !ifdef GNUTLS_DIR
325 File "${GNUTLS_DIR}\bin\libgcrypt-11.dll"
326 File "${GNUTLS_DIR}\bin\libgnutls-13.dll"
327 File "${GNUTLS_DIR}\bin\libgnutls-extra-13.dll"
328 File "${GNUTLS_DIR}\bin\libgnutls-openssl-13.dll"
329 File "${GNUTLS_DIR}\bin\libgpg-error-0.dll"
330 File "${GNUTLS_DIR}\bin\libtasn1-3.dll"
331 !endif
332 !ifdef LUA_DIR
333 File "${LUA_DIR}\lib\dll\lua5.1.dll"
334 File "..\..\epan\wslua\init.lua"
335 File "..\..\epan\wslua\console.lua"
336 File "..\..\epan\wslua\dtd_gen.lua"
337 !endif
338 !ifdef SMI_DIR
339 File "${SMI_DIR}\lib\smi.dll"
340 !endif
341 File "..\..\FAQ"
342 File "..\..\README"
343 File "..\..\README.win32"
344 File "..\..\AUTHORS-SHORT"
345 File "..\..\COPYING"
346 File "NEWS.txt"
347 File "..\..\manuf"
348 File "..\..\services"
349 File "..\..\doc\wireshark.html"
350 File "..\..\doc\wireshark-filter.html"
351 File "..\..\dumpcap.exe"
352 File "..\..\doc\dumpcap.html"
353 File "..\..\example_snmp_users_file"
354
355 ; C-runtime redistributable
356 !ifdef VCREDIST_EXE
357 ; vcredist_x86.exe (MSVC V8) - copy and execute the redistributable installer
358 File "${VCREDIST_EXE}"
359 ExecWait '"$INSTDIR\vcredist_x86.exe"' $0
360 DetailPrint "vcredist_x86 returned $0"
361 !else
362 !ifdef MSVCR_DLL
363 ; msvcr*.dll (MSVC V7 or V7.1) - simply copy the dll file
364 File "${MSVCR_DLL}"
365 !else
366 !if ${MSVC_VARIANT} != "MSVC6"
367 !error "C-Runtime redistributable for this package not available / not redistributable!"
368 !endif
369 !endif  ; MSVCR_DLL
370 !endif  ; VCREDIST_EXE
371
372
373 ; global config files - don't overwrite if already existing
374 ;IfFileExists cfilters dont_overwrite_cfilters
375 File "..\..\cfilters"
376 ;dont_overwrite_cfilters:
377 ;IfFileExists colorfilters dont_overwrite_colorfilters
378 File "..\..\colorfilters"
379 ;dont_overwrite_colorfilters:
380 ;IfFileExists dfilters dont_overwrite_dfilters
381 File "..\..\dfilters"
382 ;dont_overwrite_dfilters:
383 ;IfFileExists dfilters dont_overwrite_smi_modules
384 File "..\..\smi_modules"
385 ;dont_overwrite_smi_modules:
386
387
388 ;
389 ; Install the Diameter DTD and XML files in the "diameter" subdirectory
390 ; of the installation directory.
391 ;
392 SetOutPath $INSTDIR\diameter
393 File "..\..\diameter\chargecontrol.xml"
394 File "..\..\diameter\dictionary.dtd"
395 File "..\..\diameter\dictionary.xml"
396 File "..\..\diameter\etsie2e4.xml"
397 File "..\..\diameter\gqpolicy.xml"
398 File "..\..\diameter\imscxdx.xml"
399 File "..\..\diameter\mobileipv4.xml"
400 File "..\..\diameter\nasreq.xml"
401 File "..\..\diameter\sip.xml"
402 File "..\..\diameter\sunping.xml"
403 File "..\..\diameter\TGPPSh.xml"
404 SetOutPath $INSTDIR
405
406
407
408 ;
409 ; Install the RADIUS directory files in the "radius" subdirectory
410 ; of the installation directory.
411 ;
412 SetOutPath $INSTDIR\radius
413 File "..\..\radius\dictionary"
414 File "..\..\radius\dictionary.3com"
415 File "..\..\radius\dictionary.3gpp"
416 File "..\..\radius\dictionary.3gpp2"
417 File "..\..\radius\dictionary.acc"
418 File "..\..\radius\dictionary.alcatel"
419 File "..\..\radius\dictionary.alteon"
420 File "..\..\radius\dictionary.altiga"
421 File "..\..\radius\dictionary.aptis"
422 File "..\..\radius\dictionary.ascend"
423 File "..\..\radius\dictionary.bay"
424 File "..\..\radius\dictionary.bintec"
425 File "..\..\radius\dictionary.bristol"
426 File "..\..\radius\dictionary.cablelabs"
427 File "..\..\radius\dictionary.cabletron"
428 File "..\..\radius\dictionary.cisco"
429 File "..\..\radius\dictionary.cisco.bbsm"
430 File "..\..\radius\dictionary.cisco.vpn3000"
431 File "..\..\radius\dictionary.cisco.vpn5000"
432 File "..\..\radius\dictionary.colubris"
433 File "..\..\radius\dictionary.columbia_university"
434 File "..\..\radius\dictionary.compat"
435 File "..\..\radius\dictionary.cosine"
436 File "..\..\radius\dictionary.ericsson"
437 File "..\..\radius\dictionary.erx"
438 File "..\..\radius\dictionary.extreme"
439 File "..\..\radius\dictionary.foundry"
440 File "..\..\radius\dictionary.freeradius"
441 File "..\..\radius\dictionary.gandalf"
442 File "..\..\radius\dictionary.garderos"
443 File "..\..\radius\dictionary.gemtek"
444 File "..\..\radius\dictionary.itk"
445 File "..\..\radius\dictionary.juniper"
446 File "..\..\radius\dictionary.karlnet"
447 File "..\..\radius\dictionary.livingston"
448 File "..\..\radius\dictionary.localweb"
449 File "..\..\radius\dictionary.merit"
450 File "..\..\radius\dictionary.microsoft"
451 File "..\..\radius\dictionary.mikrotik"
452 File "..\..\radius\dictionary.navini"
453 File "..\..\radius\dictionary.netscreen"
454 File "..\..\radius\dictionary.nokia"
455 File "..\..\radius\dictionary.nomadix"
456 File "..\..\radius\dictionary.propel"
457 File "..\..\radius\dictionary.quintum"
458 File "..\..\radius\dictionary.redback"
459 File "..\..\radius\dictionary.redcreek"
460 File "..\..\radius\dictionary.shasta"
461 File "..\..\radius\dictionary.shiva"
462 File "..\..\radius\dictionary.sonicwall"
463 File "..\..\radius\dictionary.springtide"
464 File "..\..\radius\dictionary.t_systems_nova"
465 File "..\..\radius\dictionary.telebit"
466 File "..\..\radius\dictionary.trapeze"
467 File "..\..\radius\dictionary.tunnel"
468 File "..\..\radius\dictionary.unisphere"
469 File "..\..\radius\dictionary.unix"
470 File "..\..\radius\dictionary.usr"
471 File "..\..\radius\dictionary.valemount"
472 File "..\..\radius\dictionary.versanet"
473 File "..\..\radius\dictionary.wispr"
474 File "..\..\radius\dictionary.xedia"
475 SetOutPath $INSTDIR
476
477 ;
478 ; install the dtds in the dtds subdirectory
479 ;
480 SetOutPath $INSTDIR\dtds
481 File "..\..\dtds\dc.dtd"
482 File "..\..\dtds\itunes.dtd"
483 File "..\..\dtds\mscml.dtd"
484 File "..\..\dtds\pocsettings.dtd"
485 File "..\..\dtds\presence.dtd"
486 File "..\..\dtds\reginfo.dtd"
487 File "..\..\dtds\rlmi.dtd"
488 File "..\..\dtds\rss.dtd"
489 File "..\..\dtds\smil.dtd"
490 File "..\..\dtds\xcap-caps.dtd"
491 File "..\..\dtds\xcap-error.dtd"
492 File "..\..\dtds\watcherinfo.dtd"
493 SetOutPath $INSTDIR
494
495
496 ;
497 ; install the wimaxasncp TLV definitions in the wimaxasncp subdirectory
498 ;
499 SetOutPath $INSTDIR\wimaxasncp
500 File "..\..\plugins\wimaxasncp\dictionary.xml"
501 File "..\..\plugins\wimaxasncp\dictionary.dtd"
502 SetOutPath $INSTDIR
503
504 SetOutPath $INSTDIR\help
505 File "..\..\help\toc"
506 File "..\..\help\overview.txt"
507 File "..\..\help\getting_started.txt"
508 File "..\..\help\capturing.txt"
509 File "..\..\help\capture_filters.txt"
510 File "..\..\help\display_filters.txt"
511 File "..\..\help\faq.txt"
512
513 ; Write the uninstall keys for Windows
514 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "DisplayVersion" "${VERSION}"
515 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "DisplayName" "Wireshark ${VERSION}"
516 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString" '"$INSTDIR\uninstall.exe"'
517 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "Publisher" "The Wireshark developer community, http://www.wireshark.org"
518 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "HelpLink" "mailto:wireshark-users@wireshark.org"
519 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "URLInfoAbout" "http://www.wireshark.org"
520 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "URLUpdateInfo" "http://www.wireshark.org/download/win32/"
521 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "NoModify" 1
522 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "NoRepair" 1
523 WriteUninstaller "uninstall.exe"
524
525 ; Write an entry for ShellExecute
526 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe" "" '$INSTDIR\wireshark.exe'
527 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe" "Path" '$INSTDIR'
528
529 ; Create start menu entries (depending on additional tasks page)
530 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State"
531 StrCmp $0 "0" SecRequired_skip_StartMenu
532 SetOutPath $PROFILE
533 CreateDirectory "$SMPROGRAMS\Wireshark"
534 ; To qoute "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch11d.asp":
535 ; "Do not include Readme, Help, or Uninstall entries on the Programs menu."
536 Delete "$SMPROGRAMS\Wireshark\Wireshark Web Site.lnk"
537 ;WriteINIStr "$SMPROGRAMS\Wireshark\Wireshark Web Site.url" "InternetShortcut" "URL" "http://www.wireshark.org/"
538 CreateShortCut "$SMPROGRAMS\Wireshark\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
539 ;CreateShortCut "$SMPROGRAMS\Wireshark\Wireshark Manual.lnk" "$INSTDIR\wireshark.html"
540 ;CreateShortCut "$SMPROGRAMS\Wireshark\Display Filters Manual.lnk" "$INSTDIR\wireshark-filter.html"
541 CreateShortCut "$SMPROGRAMS\Wireshark\Wireshark Program Directory.lnk" \
542           "$INSTDIR"
543 ;CreateShortCut "$SMPROGRAMS\Wireshark\Uninstall Wireshark.lnk" "$INSTDIR\uninstall.exe"
544 SecRequired_skip_StartMenu:
545
546 ; is command line option "/desktopicon" set?
547 ${GetParameters} $R0
548 ${GetOptions} $R0 "/desktopicon=" $R1
549 StrCmp $R1 "no" SecRequired_skip_DesktopIcon
550 StrCmp $R1 "yes" SecRequired_install_DesktopIcon
551
552 ; Create desktop icon (depending on additional tasks page and command line option)
553 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State"
554 StrCmp $0 "0" SecRequired_skip_DesktopIcon
555 SecRequired_install_DesktopIcon:
556 CreateShortCut "$DESKTOP\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
557 SecRequired_skip_DesktopIcon:
558
559 ; is command line option "/quicklaunchicon" set?
560 ${GetParameters} $R0
561 ${GetOptions} $R0 "/quicklaunchicon=" $R1
562 StrCmp $R1 "no" SecRequired_skip_QuickLaunchIcon
563 StrCmp $R1 "yes" SecRequired_install_QuickLaunchIcon
564
565 ; Create quick launch icon (depending on additional tasks page and command line option)
566 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State"
567 StrCmp $0 "0" SecRequired_skip_QuickLaunchIcon
568 SecRequired_install_QuickLaunchIcon:
569 CreateShortCut "$QUICKLAUNCH\Wireshark.lnk" "$INSTDIR\wireshark.exe" "" "$INSTDIR\wireshark.exe" 0 "" "" "The Wireshark Network Protocol Analyzer"
570 SecRequired_skip_QuickLaunchIcon:
571
572 ; Create File Extensions (depending on additional tasks page)
573 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "State"
574 StrCmp $0 "0" SecRequired_skip_FileExtensions
575 WriteRegStr HKCR ${WIRESHARK_ASSOC} "" "Wireshark file"
576 WriteRegStr HKCR "${WIRESHARK_ASSOC}\Shell\open\command" "" '"$INSTDIR\wireshark.exe" "%1"'
577 WriteRegStr HKCR "${WIRESHARK_ASSOC}\DefaultIcon" "" '"$INSTDIR\wireshark.exe",1'
578 push $R0
579         StrCpy $R0 ".5vw"
580         Call Associate
581         StrCpy $R0 ".acp"
582         Call Associate
583         StrCpy $R0 ".apc"
584         Call Associate
585         StrCpy $R0 ".atc"
586         Call Associate
587         StrCpy $R0 ".bfr"
588         Call Associate
589         StrCpy $R0 ".cap"
590         Call Associate
591         StrCpy $R0 ".enc"
592         Call Associate
593         StrCpy $R0 ".erf"
594         Call Associate
595         StrCpy $R0 ".fdc"
596         Call Associate
597         StrCpy $R0 ".pcap"
598         Call Associate
599         StrCpy $R0 ".pkt"
600         Call Associate
601         StrCpy $R0 ".snoop"
602         Call Associate
603         StrCpy $R0 ".syc"
604         Call Associate
605         StrCpy $R0 ".tpc"
606         Call Associate
607         StrCpy $R0 ".tr1"
608         Call Associate
609         StrCpy $R0 ".trace"
610         Call Associate
611         StrCpy $R0 ".trc"
612         Call Associate
613         StrCpy $R0 ".wpc"
614         Call Associate
615         StrCpy $R0 ".wpz"
616         Call Associate
617 ; if somethings added here, add it also to the uninstall section and the AdditionalTask page
618 pop $R0
619 !insertmacro UpdateIcons
620 SecRequired_skip_FileExtensions:
621
622 ; if running as a silent installer, don't try to install winpcap
623 IfSilent SecRequired_skip_Winpcap
624
625 ; Install WinPcap (depending on winpcap page setting)
626 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State"
627 StrCmp $0 "0" SecRequired_skip_Winpcap
628 ; Uinstall old WinPcap first
629 ReadRegStr $WINPCAP_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
630 IfErrors lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
631 ; from released version 3.1, WinPcap will uninstall an old version by itself
632 ;ExecWait '$WINPCAP_UNINSTALL' $0
633 ;DetailPrint "WinPcap uninstaller returned $0"
634 lbl_winpcap_notinstalled:
635 SetOutPath $INSTDIR
636 File "WinPcap_4_0_1.exe"
637 ExecWait '"$INSTDIR\WinPcap_4_0_1.exe"' $0
638 DetailPrint "WinPcap installer returned $0"
639 SecRequired_skip_Winpcap:
640
641 ; Load Winpcap NPF service at startup (depending on winpcap page)
642 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State"
643 StrCmp $0 "0" SecRequired_no_WinpcapService
644 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 2 ;set NPF to (SERVICE_AUTO_START)
645 !insertmacro SERVICE "start" "NPF" ""
646 Goto SecRequired_done_WinpcapService
647 SecRequired_no_WinpcapService:
648 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 3 ;set NPF to (SERVICE_DEMAND_START)
649 !insertmacro SERVICE "stop" "NPF" ""
650 SecRequired_done_WinpcapService:
651
652 ; If no user profile exists for Wireshark but for Ethereal, copy it over
653 SetShellVarContext current
654 IfFileExists $APPDATA\Wireshark profile_done
655 IfFileExists $APPDATA\Ethereal 0 profile_done
656 ;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
657 CreateDirectory $APPDATA\Wireshark
658 CopyFiles $APPDATA\Ethereal\*.* $APPDATA\Wireshark
659 profile_done:
660 SetShellVarContext all
661
662 SectionEnd ; "Required"
663
664
665 SectionGroup "!Wireshark" SecWiresharkGroup
666
667 !ifdef GTK1_DIR
668 Section "Wireshark GTK1" SecWiresharkGTK1
669 ;-------------------------------------------
670 !ifdef GTK1_DIR & GTK2_DIR
671 SectionIn 2 RO
672 !endif
673 SetOutPath $INSTDIR
674 File "..\..\wireshark.exe"
675 File "${GTK1_DIR}\lib\libgtk-0.dll"
676 File "${GTK1_DIR}\lib\libgdk-0.dll"
677 SectionEnd
678 !endif
679
680 !ifdef GTK2_DIR
681 Section "Wireshark GTK2" SecWiresharkGTK2
682 ;-------------------------------------------
683 !ifdef GTK1_DIR & GTK2_DIR
684 SectionIn 1 RO
685 !endif
686 SetOutPath $INSTDIR
687 File /oname=wireshark.exe "..\..\wireshark-gtk2.exe"
688 IfFileExists $INSTDIR\wireshark-gtk2.exe.manifest 0 +2
689 Rename $INSTDIR\wireshark-gtk2.exe.manifest $INSTDIR\wireshark.exe.manifest
690 File "${GTK2_DIR}\bin\libgdk-win32-2.0-0.dll"
691 File "${GTK2_DIR}\bin\libgdk_pixbuf-2.0-0.dll"
692 File "${GTK2_DIR}\bin\libgtk-win32-2.0-0.dll"
693 File "${GTK2_DIR}\bin\libatk-1.0-0.dll"
694 File "${GTK2_DIR}\bin\libpango-1.0-0.dll"
695 File "${GTK2_DIR}\bin\libpangowin32-1.0-0.dll"
696 !ifdef NEED_CAIRO_DLL
697 File "${GTK2_DIR}\bin\libcairo-2.dll"
698 File "${GTK2_DIR}\bin\libpangocairo-1.0-0.dll"
699 !endif
700 !ifdef NEED_LIBPNG_DLL
701 File "${GTK2_DIR}\bin\libpng13.dll"
702 !endif
703 !ifdef NEED_LIBTIFF_DLL
704 File "${GTK2_DIR}\bin\libtiff3.dll"
705 !endif
706 !ifdef NEED_LIBJPEG_DLL
707 File "${GTK2_DIR}\bin\jpeg62.dll"
708 !endif
709 SetOutPath $INSTDIR\etc\gtk-2.0
710 File "${GTK2_DIR}\etc\gtk-2.0\*.*"
711 SetOutPath $INSTDIR\etc\pango
712 File "${GTK2_DIR}\etc\pango\pango.*"
713 #SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_LIB_DIR}\loaders
714 #File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_LIB_DIR}\loaders\libpixbufloader-*.dll"
715 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_LIB_DIR}\immodules
716 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_LIB_DIR}\immodules\im-*.dll"
717 # Not needed with pango 1.14.5
718 #SetOutPath $INSTDIR\lib\pango\${PANGO_LIB_DIR}\modules
719 #File "${GTK2_DIR}\lib\pango\${PANGO_LIB_DIR}\modules\pango-*.dll"
720
721 SectionEnd
722
723 !ifdef GTK_WIMP_DIR
724 Section "GTK MS Windows Engine" SecGTKWimp
725 ;-------------------------------------------
726 SectionIn 1
727 SetOutPath $INSTDIR\${GTK_WIMP_DLLDST_DIR}
728 File "${GTK_WIMP_DLLSRC_DIR}\libwimp.dll"
729 SetOutPath $INSTDIR\${GTK_WIMP_RCDST_DIR}
730 File "${GTK_WIMP_RCSRC_DIR}\gtkrc"
731 SectionEnd
732 !endif
733 !endif
734
735 SectionGroupEnd ; "Wireshark"
736
737
738 Section "TShark" SecTShark
739 ;-------------------------------------------
740 !ifdef GTK1_DIR & GTK2_DIR
741 SectionIn 1 2
742 !endif
743 SetOutPath $INSTDIR
744 File "..\..\tshark.exe"
745 File "..\..\doc\tshark.html"
746 SectionEnd
747
748 SectionGroup "Plugins / Extensions" SecPluginsGroup
749
750 Section "Dissector Plugins" SecPlugins
751 ;-------------------------------------------
752 !ifdef GTK1_DIR & GTK2_DIR
753 SectionIn 1 2
754 !endif
755 SetOutPath $INSTDIR\plugins\${VERSION}
756 File "..\..\plugins\agentx\agentx.dll"
757 File "..\..\plugins\artnet\artnet.dll"
758 File "..\..\plugins\asn1\asn1.dll"
759 File "..\..\plugins\ciscosm\ciscosm.dll"
760 File "..\..\plugins\docsis\docsis.dll"
761 File "..\..\plugins\enttec\enttec.dll"
762 File "..\..\plugins\ethercat\ethercat.dll"
763 File "..\..\plugins\giop\coseventcomm.dll"
764 File "..\..\plugins\giop\cosnaming.dll"
765 File "..\..\plugins\giop\parlay.dll"
766 File "..\..\plugins\giop\tango.dll"
767 File "..\..\plugins\gryphon\gryphon.dll"
768 File "..\..\plugins\irda\irda.dll"
769 File "..\..\plugins\lwres\lwres.dll"
770 File "..\..\plugins\m2m\m2m.dll"
771 File "..\..\plugins\mgcp\mgcp.dll"
772 File "..\..\plugins\opsi\opsi.dll"
773 File "..\..\plugins\pcli\pcli.dll"
774 File "..\..\plugins\profinet\profinet.dll"
775 File "..\..\plugins\rlm\rlm.dll"
776 File "..\..\plugins\rtnet\rtnet.dll"
777 File "..\..\plugins\rudp\rudp.dll"
778 File "..\..\plugins\sbus\sbus.dll"
779 File "..\..\plugins\unistim\unistim.dll"
780 File "..\..\plugins\v5ua\v5ua.dll"
781 File "..\..\plugins\wimax\wimax.dll"
782 File "..\..\plugins\wimaxasncp\wimaxasncp.dll"
783 SectionEnd
784
785 Section "Tree Statistics Plugin" SecStatsTree
786 ;-------------------------------------------
787 !ifdef GTK1_DIR & GTK2_DIR
788 SectionIn 1 2
789 !endif
790 SetOutPath $INSTDIR\plugins\${VERSION}
791 File "..\..\plugins\stats_tree\stats_tree.dll"
792 SectionEnd
793
794 Section "Mate - Meta Analysis and Tracing Engine" SecMate
795 ;-------------------------------------------
796 SetOutPath $INSTDIR\plugins\${VERSION}
797 File "..\..\plugins\mate\mate.dll"
798 SectionEnd
799
800
801 !ifdef NET_SNMP_DIR
802 Section "SNMP MIBs" SecMIBs
803 ;-------------------------------------------
804 !ifdef GTK1_DIR & GTK2_DIR
805 SectionIn 1 2
806 !endif
807 SetOutPath $INSTDIR\snmp\mibs
808 File "${NET_SNMP_DIR}\mibs\*.txt"
809 SectionEnd
810 !endif
811
812 !ifdef SMI_DIR
813 Section "SNMP MIBs" SecMIBs
814 ;-------------------------------------------
815 !ifdef GTK1_DIR & GTK2_DIR
816 SectionIn 1 2
817 !endif
818 SetOutPath $INSTDIR\snmp\mibs
819 File "${SMI_DIR}\mibs\*"
820 SectionEnd
821 !endif
822
823 SectionGroupEnd ; "Plugins / Extensions"
824
825
826 SectionGroup "Tools" SecToolsGroup
827
828 Section "Editcap" SecEditcap
829 ;-------------------------------------------
830 !ifdef GTK1_DIR & GTK2_DIR
831 SectionIn 1 2
832 !endif
833 SetOutPath $INSTDIR
834 File "..\..\editcap.exe"
835 File "..\..\doc\editcap.html"
836 SectionEnd
837
838 Section "Text2Pcap" SecText2Pcap
839 ;-------------------------------------------
840 !ifdef GTK1_DIR & GTK2_DIR
841 SectionIn 1 2
842 !endif
843 SetOutPath $INSTDIR
844 File "..\..\text2pcap.exe"
845 File "..\..\doc\text2pcap.html"
846 SectionEnd
847
848 Section "Mergecap" SecMergecap
849 ;-------------------------------------------
850 !ifdef GTK1_DIR & GTK2_DIR
851 SectionIn 1 2
852 !endif
853 SetOutPath $INSTDIR
854 File "..\..\mergecap.exe"
855 File "..\..\doc\mergecap.html"
856 SectionEnd
857
858 Section "Capinfos" SecCapinfos
859 ;-------------------------------------------
860 !ifdef GTK1_DIR & GTK2_DIR
861 SectionIn 1 2
862 !endif
863 SetOutPath $INSTDIR
864 File "..\..\capinfos.exe"
865 File "..\..\doc\capinfos.html"
866 SectionEnd
867
868 SectionGroupEnd ; "Tools"
869
870 !ifdef HHC_DIR
871 Section "User's Guide" SecUsersGuide
872 ;-------------------------------------------
873 !ifdef GTK1_DIR & GTK2_DIR
874 SectionIn 1 2
875 !endif
876 SetOutPath $INSTDIR
877 File "user-guide.chm"
878 SectionEnd
879 !endif
880
881 Section "Uninstall" un.SecUinstall
882 ;-------------------------------------------
883
884 ;
885 ; UnInstall for every user
886 ;
887 SectionIn 1 2
888 SetShellVarContext all
889
890 Delete "$INSTDIR\tshark.exe"
891 IfErrors 0 NoTSharkErrorMsg
892         MessageBox MB_OK "Please note: tshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tshark.exe removed
893         Abort "Please note: tshark.exe could not be removed, it's probably in use! Abort uninstall process!"
894 NoTSharkErrorMsg:
895
896 Delete "$INSTDIR\wireshark.exe"
897 IfErrors 0 NoWiresharkErrorMsg
898         MessageBox MB_OK "Please note: wireshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if wireshark.exe removed
899         Abort "Please note: wireshark.exe could not be removed, it's probably in use! Abort uninstall process!"
900 NoWiresharkErrorMsg:
901
902 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark"
903 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Wireshark"
904 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe"
905
906 push $R0
907         StrCpy $R0 ".5vw"
908         Call un.unlink
909         StrCpy $R0 ".acp"
910         Call un.unlink
911         StrCpy $R0 ".apc"
912         Call un.unlink
913         StrCpy $R0 ".atc"
914         Call un.unlink
915         StrCpy $R0 ".bfr"
916         Call un.unlink
917         StrCpy $R0 ".cap"
918         Call un.unlink
919         StrCpy $R0 ".enc"
920         Call un.unlink
921         StrCpy $R0 ".erf"
922         Call un.unlink
923         StrCpy $R0 ".fdc"
924         Call un.unlink
925         StrCpy $R0 ".pcap"
926         Call un.unlink
927         StrCpy $R0 ".pkt"
928         Call un.unlink
929         StrCpy $R0 ".snoop"
930         Call un.unlink
931         StrCpy $R0 ".syc"
932         Call un.unlink
933         StrCpy $R0 ".tpc"
934         Call un.unlink
935         StrCpy $R0 ".tr1"
936         Call un.unlink
937         StrCpy $R0 ".trace"
938         Call un.unlink
939         StrCpy $R0 ".trc"
940         Call un.unlink
941         StrCpy $R0 ".wpc"
942         Call un.unlink
943         StrCpy $R0 ".wpz"
944         Call un.unlink
945 pop $R0
946
947 DeleteRegKey HKCR ${WIRESHARK_ASSOC}
948 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command"
949 DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon"
950 !insertmacro UpdateIcons
951
952 ; regardless if we currently installed GTK1 or 2, try to uninstall GTK2 files too
953 Delete "$INSTDIR\etc\gtk-2.0\*.*"
954 Delete "$INSTDIR\etc\pango\*.*"
955 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
956 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
957 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
958 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
959 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
960 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
961 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.*"
962 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\loaders\*.*"
963 Delete "$INSTDIR\lib\gtk-2.0\2.10.0\immodules\*.*"
964 Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
965 Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
966 Delete "$INSTDIR\lib\pango\1.5.0\modules\*.*"
967 Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
968 Delete "$INSTDIR\help\*.*"
969 Delete "$INSTDIR\diameter\*.*"
970 Delete "$INSTDIR\snmp\mibs\*.*"
971 Delete "$INSTDIR\snmp\*.*"
972 Delete "$INSTDIR\*.exe"
973 Delete "$INSTDIR\*.dll"
974 Delete "$INSTDIR\*.html"
975 Delete "$INSTDIR\COPYING"
976 Delete "$INSTDIR\AUTHORS-SHORT"
977 Delete "$INSTDIR\*.manifest"
978 ; previous versions installed this file
979 Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
980 Delete "$INSTDIR\README*"
981 Delete "$INSTDIR\FAQ"
982 Delete "$INSTDIR\NEWS.txt"
983 Delete "$INSTDIR\manuf"
984 Delete "$INSTDIR\services"
985 Delete "$INSTDIR\pcrepattern.3.txt"
986 Delete "$INSTDIR\user-guide.chm"
987 Delete "$INSTDIR\example_snmp_users_file"
988 Delete "$INSTDIR\radius\*.*"
989 Delete "$INSTDIR\dtds\*.*"
990 Delete "$SMPROGRAMS\Wireshark\*.*"
991 Delete "$DESKTOP\Wireshark.lnk"
992 Delete "$QUICKLAUNCH\Wireshark.lnk"
993
994 RMDir "$INSTDIR\etc\gtk-2.0"
995 RMDir "$INSTDIR\etc\pango"
996 RMDir "$INSTDIR\etc"
997 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
998 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
999 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
1000 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
1001 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
1002 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
1003 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
1004 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
1005 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\engines"
1006 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\loaders"
1007 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\immodules"
1008 RMDir "$INSTDIR\lib\gtk-2.0\2.10.0"
1009 RMDir "$INSTDIR\lib\gtk-2.0"
1010 RMDir "$INSTDIR\lib\pango\1.2.0\modules"
1011 RMDir "$INSTDIR\lib\pango\1.2.0"
1012 RMDir "$INSTDIR\lib\pango\1.4.0\modules"
1013 RMDir "$INSTDIR\lib\pango\1.4.0"
1014 RMDir "$INSTDIR\lib\pango\1.5.0\modules"
1015 RMDir "$INSTDIR\lib\pango\1.5.0"
1016 RMDir "$INSTDIR\lib\pango"
1017 RMDir "$INSTDIR\lib"
1018 RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
1019 RMDir "$INSTDIR\share\themes\Default"
1020 RMDir "$INSTDIR\share\themes"
1021 RMDir "$INSTDIR\share"
1022 RMDir "$SMPROGRAMS\Wireshark"
1023 RMDir "$INSTDIR\help"
1024 RMDir "$INSTDIR\diameter"
1025 RMDir "$INSTDIR\snmp\mibs"
1026 RMDir "$INSTDIR\snmp"
1027 RMDir "$INSTDIR\radius"
1028 RMDir "$INSTDIR\dtds"
1029 RMDir "$INSTDIR"
1030
1031 SectionEnd ; "Uinstall"
1032
1033 Section "Un.Plugins" un.SecPlugins
1034 ;-------------------------------------------
1035 SectionIn 1 2
1036 ;Delete "$INSTDIR\plugins\${VERSION}\*.*"
1037 ;Delete "$INSTDIR\plugins\*.*"
1038 ;RMDir "$INSTDIR\plugins\${VERSION}"
1039 ;RMDir "$INSTDIR\plugins"
1040 RMDir /r "$INSTDIR\plugins"
1041 SectionEnd
1042
1043 Section "Un.Global Settings" un.SecGlobalSettings
1044 ;-------------------------------------------
1045 SectionIn 1 2
1046 Delete "$INSTDIR\cfilters"
1047 Delete "$INSTDIR\colorfilters"
1048 Delete "$INSTDIR\dfilters"
1049 Delete "$INSTDIR\init.lua"
1050 Delete "$INSTDIR\console.lua"
1051 Delete "$INSTDIR\dtd_gen.lua"
1052 Delete "$INSTDIR\smi_modules"
1053 RMDir "$INSTDIR"
1054 SectionEnd
1055
1056 Section /o "Un.Personal Settings" un.SecPersonalSettings
1057 ;-------------------------------------------
1058 SectionIn 2
1059 SetShellVarContext current
1060 Delete "$APPDATA\Wireshark\*.*"
1061 RMDir "$APPDATA\Wireshark"
1062 SectionEnd
1063
1064 ;VAR un.WINPCAP_UNINSTALL
1065
1066 Section /o "Un.WinPcap" un.SecWinPcap
1067 ;-------------------------------------------
1068 SectionIn 2
1069 ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
1070 ;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
1071 ;MessageBox MB_OK "WinPcap $1"
1072 ExecWait '$1' $0
1073 DetailPrint "WinPcap uninstaller returned $0"
1074 ;SetRebootFlag true
1075 ;un.lbl_winpcap_notinstalled:
1076 SectionEnd
1077
1078 Section "-Un.Finally"
1079 ;-------------------------------------------
1080 SectionIn 1 2
1081 ; this test must be done after all other things uninstalled (e.g. Global Settings)
1082 IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
1083     MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if dir doesn't exist
1084 NoFinalErrorMsg:
1085 SectionEnd
1086
1087
1088 ; ============================================================================
1089 ; PLEASE MAKE SURE, THAT THE DESCRIPTIVE TEXT FITS INTO THE DESCRIPTION FIELD!
1090 ; ============================================================================
1091 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1092   !insertmacro MUI_DESCRIPTION_TEXT ${SecWiresharkGroup} "${PROGRAM_NAME} is a GUI network protocol analyzer."
1093 !ifdef GTK1_DIR
1094   !insertmacro MUI_DESCRIPTION_TEXT ${SecWiresharkGTK1} "${PROGRAM_NAME} using the classical GTK1 user interface."
1095 !endif
1096 !ifdef GTK2_DIR
1097   !insertmacro MUI_DESCRIPTION_TEXT ${SecWiresharkGTK2} "${PROGRAM_NAME} using the modern GTK2 user interface."
1098 !ifdef GTK_WIMP_DIR
1099   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTKWimp} "GTK MS Windows Engine - native Win32 look and feel, for Win2000 and up."
1100 !endif
1101 !endif
1102   !insertmacro MUI_DESCRIPTION_TEXT ${SecTShark} "TShark is a text based network protocol analyzer."
1103   !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} "Some plugins and extensions for both Wireshark and TShark."
1104   !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections."
1105   !insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Plugin for some extended statistics."
1106   !insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)."
1107 !ifdef NET_SNMP_DIR
1108   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
1109 !endif
1110 !ifdef SMI_DIR
1111   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
1112 !endif
1113   !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools."
1114   !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."
1115   !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."
1116   !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Mergecap is a program that combines multiple saved capture files into a single output file"
1117   !insertmacro MUI_DESCRIPTION_TEXT ${SecCapinfos} "Capinfos is a program that provides information on capture files."
1118 !ifdef HHC_DIR
1119   !insertmacro MUI_DESCRIPTION_TEXT ${SecUsersGuide} "Install the user's guide, so an internet connection is not required to read the help pages."
1120 !endif
1121 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1122
1123 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1124   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all Wireshark components."
1125   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous Wireshark versions)."
1126   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
1127   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
1128   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
1129 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1130
1131 ; ============================================================================
1132 ; Callback functions
1133 ; ============================================================================
1134 !ifdef GTK1_DIR & GTK2_DIR
1135 ;Disable GTK-Wimp for GTK1
1136
1137 Function .onSelChange
1138         Push $0
1139         SectionGetFlags ${SecWiresharkGTK1} $0
1140         IntOp  $0 $0 & 1
1141         IntCmp $0 1 onSelChange.disableGTK2Sections
1142         ;enable GTK2Sections
1143         !insertmacro EnableSection ${SecGTKWimp}
1144         Goto onSelChange.end
1145 onSelChange.disableGTK2Sections:
1146         !insertmacro DisableSection ${SecGTKWimp}
1147         Goto onSelChange.end
1148 onSelChange.end:
1149         Pop $0
1150 FunctionEnd
1151
1152 !else
1153 !ifdef GTK1_DIR | GTK2_DIR
1154 ; Disable FileExtension if Wireshark isn't selected
1155 Function .onSelChange
1156         Push $0
1157 !ifdef GTK1_DIR
1158         SectionGetFlags ${SecWiresharkGTK1} $0
1159         IntOp  $0 $0 & 1
1160         IntCmp $0 0 onSelChange.unselect
1161         SectionGetFlags ${SecFileExtensions} $0
1162         IntOp  $0 $0 & 16
1163         IntCmp $0 16 onSelChange.unreadonly
1164         Goto onSelChange.end
1165 !else
1166         SectionGetFlags ${SecWiresharkGTK2} $0
1167         IntOp  $0 $0 & 1
1168         IntCmp $0 0 onSelChange.unselect
1169         SectionGetFlags ${SecFileExtensions} $0
1170         IntOp  $0 $0 & 16
1171         IntCmp $0 16 onSelChange.unreadonly
1172         Goto onSelChange.end
1173 !endif
1174 onSelChange.unselect:
1175         SectionGetFlags ${SecFileExtensions} $0
1176         IntOp $0 $0 & 0xFFFFFFFE
1177         IntOp $0 $0 | 0x10
1178         SectionSetFlags ${SecFileExtensions} $0
1179         Goto onSelChange.end
1180 onSelChange.unreadonly:
1181         SectionGetFlags ${SecFileExtensions} $0
1182         IntOp $0 $0 & 0xFFFFFFEF
1183         SectionSetFlags ${SecFileExtensions} $0
1184         Goto onSelChange.end
1185 onSelChange.end:
1186         Pop $0
1187 FunctionEnd
1188 !endif
1189 !endif
1190
1191
1192 !include "GetWindowsVersion.nsh"
1193 !include WinMessages.nsh
1194
1195 Var NPF_START ;declare variable for holding the value of a registry key
1196 Var WINPCAP_VERSION ;declare variable for holding the value of a registry key
1197
1198 Function myShowCallback
1199
1200 ; Uinstall old Wireshark first
1201 ; XXX - doesn't work, but kept here for further experiments
1202 ;ReadRegStr $WIRESHARK_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString"
1203 ;IfErrors lbl_wireshark_notinstalled ;if RegKey is unavailable, WinPcap is not installed
1204 ;MessageBox MB_YESNO|MB_ICONQUESTION "Uninstall the old Wireshark version first (recommended)?"
1205 ; Hide the installer while uninstalling
1206 ;GetDlgItem $0 $HWNDPARENT 1
1207 ;FindWindow $0 "#32770" "" $HWNDPARENT
1208 ;MessageBox MB_OK "Window $0"
1209 ;ShowWindow $0 ${SW_HIDE}
1210 ;HideWindow
1211 ;ExecWait '$WIRESHARK_UNINSTALL' $0
1212 ;DetailPrint "WinPcap uninstaller returned $0"
1213 ;GetDlgItem $0 $HWNDPARENT 1
1214 ;ShowWindow $0 ${SW_SHOW}
1215 ;MessageBox MB_OK "Uninstalled"
1216 ;lbl_wireshark_notinstalled:
1217
1218
1219         ; Get the Windows version
1220         Call GetWindowsVersion
1221         Pop $R0 ; Windows Version
1222
1223         ; Check if we're able to run with this version
1224         StrCmp $R0 '95' lbl_winversion_unsupported
1225         StrCmp $R0 '98' lbl_winversion_unsupported
1226         StrCmp $R0 'ME' lbl_winversion_unsupported
1227         StrCmp $R0 'NT 4.0' lbl_winversion_unsupported_nt4
1228         Goto lbl_winversion_supported
1229 lbl_winversion_unsupported:
1230         MessageBox MB_OK "Windows $R0 is no longer supported. The last known version working with 98/ME was Ethereal 0.99.0!"
1231         Quit
1232
1233 lbl_winversion_unsupported_nt4:
1234         MessageBox MB_OK "Windows $R0 is no longer supported. The last known version working with NT 4.0 was Wireshark 0.99.4!"
1235         Quit
1236
1237 lbl_winversion_supported:
1238 !ifdef GTK2_DIR
1239         ; Enable GTK-Wimp only for Windows 2000/XP/2003
1240         ; ...as Win9x/ME/NT known to have problems with it!
1241
1242         ;DetailPrint 'Windows Version: $R0'
1243         StrCmp $R0 '2000' lbl_select_wimp
1244         StrCmp $R0 'XP' lbl_select_wimp
1245         StrCmp $R0 '2003' lbl_select_wimp
1246         DetailPrint "Windows $R0 doesn't support the GTK MS Windows Engine!"
1247
1248         Goto lbl_ignore_wimp
1249 lbl_select_wimp:
1250         !insertmacro SelectSection ${SecGTKWimp}
1251
1252 lbl_ignore_wimp:
1253 !endif
1254
1255
1256         ; detect if WinPcap should be installed
1257         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Text" "Install WinPcap 4.0.1"
1258         ReadRegStr $WINPCAP_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName"
1259         IfErrors 0 lbl_winpcap_installed ;if RegKey is available, WinPcap is already installed
1260         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "WinPcap is currently not installed"
1261         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Flags" "DISABLED"
1262         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)"
1263         Goto lbl_winpcap_done
1264
1265 lbl_winpcap_installed:
1266         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$WINPCAP_VERSION"
1267         ; WinPcap 2.x (including betas): the version string starts with "WinPcap 2."
1268         StrCpy $1 "$WINPCAP_VERSION" 10
1269         StrCmp $1 "WinPcap 2." lbl_winpcap_do_install
1270         ; WinPcap 3.0 (including betas): the version string starts with "WinPcap 3.0"
1271         ; WinPcap 3.x (all versions): the version string starts with "WinPcap 3."
1272         StrCpy $1 "$WINPCAP_VERSION" 10
1273         StrCmp $1 "WinPcap 3." lbl_winpcap_do_install
1274         ; WinPcap 4.0 alphas and betas: the version string starts with "WinPcap 4.0 {alpha|beta}"
1275         StrCpy $1 "$WINPCAP_VERSION" 16
1276         StrCmp $1 "WinPcap 4.0 alph" lbl_winpcap_do_install
1277         StrCmp $1 "WinPcap 4.0 beta" lbl_winpcap_do_install
1278         ; Look further at version string
1279         ReadRegStr $WINPCAP_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayVersion"
1280         ; WinPcap 4.0: the version string start with "4.0.0"
1281         StrCpy $1 "$WINPCAP_VERSION" 5
1282         StrCmp $1 "4.0.0" lbl_winpcap_do_install
1283
1284 ;lbl_winpcap_dont_install:
1285         ; seems to be the current version, so don't install
1286         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0"
1287         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If selected, the currently installed $WINPCAP_VERSION will be uninstalled first."
1288         Goto lbl_winpcap_done
1289
1290 ;lbl_winpcap_dont_upgrade:
1291         ; force the user to upgrade by hand
1292         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0"
1293         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Flags" "DISABLED"
1294         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If you wish to install WinPcap 4.0.1, please uninstall $WINPCAP_VERSION manually first."
1295         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Flags" "DISABLED"
1296         Goto lbl_winpcap_done
1297
1298 lbl_winpcap_do_install:
1299         ; seems to be an old version, install newer one
1300         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "1"
1301         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_VERSION will be uninstalled first."
1302
1303 lbl_winpcap_done:
1304
1305         ; Disable NPF service setting for Win OT
1306         StrCmp $R0 '95' lbl_npf_disable
1307         StrCmp $R0 '98' lbl_npf_disable
1308         StrCmp $R0 'ME' lbl_npf_disable
1309         ; Enable NPF by default under Vista.
1310         StrCmp $R0 'Vista' lbl_npf_enable
1311         ReadRegDWORD $NPF_START HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start"
1312         ; (Winpcap may not be installed already, so no regKey is no error here)
1313         IfErrors lbl_npf_done ;RegKey not available, so do not set it
1314         IntCmp $NPF_START 2 0 lbl_npf_done lbl_npf_done
1315 lbl_npf_enable:
1316         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "1"
1317         Goto lbl_npf_done
1318         ;disable
1319 lbl_npf_disable:
1320         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "0"
1321         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "Flags" "DISABLED"
1322         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 9" "Flags" "DISABLED"
1323 lbl_npf_done:
1324
1325
1326         ; if Wireshark was previously installed, unselect previously not installed icons etc.
1327         ; detect if Wireshark is already installed ->
1328         ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark" "UninstallString"
1329         IfErrors lbl_wireshark_notinstalled ;if RegKey is unavailable, Wireshark is not installed
1330
1331         ; only select Start Menu Group, if previously installed
1332         ; (we use the "all users" start menu, so select it first)
1333         SetShellVarContext all
1334         IfFileExists "$SMPROGRAMS\Wireshark\Wireshark.lnk" lbl_have_startmenu
1335         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State" "0"
1336 lbl_have_startmenu:
1337
1338         ; only select Desktop Icon, if previously installed
1339         IfFileExists "$DESKTOP\Wireshark.lnk" lbl_have_desktopicon
1340         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State" "0"
1341 lbl_have_desktopicon:
1342
1343         ; only select Quick Launch Icon, if previously installed
1344         IfFileExists "$QUICKLAUNCH\Wireshark.lnk" lbl_have_quicklaunchicon
1345         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State" "0"
1346 lbl_have_quicklaunchicon:
1347
1348 lbl_wireshark_notinstalled:
1349
1350
1351 FunctionEnd