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