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