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