17657ba99b512c00dd71df848c5ac2387e310ebd
[obnox/wireshark/wip.git] / packaging / nsis / ethereal.nsi
1 ;
2 ; ethereal.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 "Ethereal (GTK2 user interface)"
18 InstType "Ethereal (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 Ethereal
29 !define ETHEREAL_ASSOC "ethereal-file"
30
31 ; ============================================================================
32 ; Header configuration
33 ; ============================================================================
34 ; The name of the installer
35 !define PROGRAM_NAME "Ethereal"
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\ethereal.ico"
44 UninstallIcon "..\..\image\ethereal.ico"
45
46 ; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
47 !define MUI_UNCONFIRMPAGE_TEXT_TOP "The following Ethereal 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 Ethereal.\r\nBefore starting the uninstallation, make sure Ethereal 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\ethereal.ico"
69 !define MUI_UNICON "..\..\image\ethereal.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 Ethereal.\r\n\r\nBefore starting the installation, make sure Ethereal 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\ethereal.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 "Ethereal 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 Ethereal."
194
195 ; The default installation directory
196 InstallDir $PROGRAMFILES\Ethereal\
197
198 ; See if this is an upgrade; if so, use the old InstallDir as default
199 InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal "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 Ethereal 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 Ethereal
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 "" ${ETHEREAL_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 ${ETHEREAL_ASSOC} un.unlink.doUnlink
261         Goto un.unlink.end
262 un.unlink.doUnlink:
263         ; The extension is associated with Ethereal 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 ETHEREAL_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_LIBETHEREAL
308 File "..\..\epan\libethereal.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\ethereal.html"
334 File "..\..\doc\ethereal-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\rss.dtd"
443 File "..\..\dtds\smil.dtd"
444 SetOutPath $INSTDIR
445
446 SetOutPath $INSTDIR\help
447 File "..\..\help\toc"
448 File "..\..\help\overview.txt"
449 File "..\..\help\getting_started.txt"
450 File "..\..\help\capturing.txt"
451 File "..\..\help\capture_filters.txt"
452 File "..\..\help\display_filters.txt"
453 File "..\..\help\faq.txt"
454
455 ; Write the uninstall keys for Windows
456 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "DisplayVersion" "${VERSION}"
457 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "DisplayName" "Ethereal ${VERSION}"
458 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "UninstallString" '"$INSTDIR\uninstall.exe"'
459 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "Publisher" "The Ethereal developer community, http://www.ethereal.com"
460 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "HelpLink" "mailto:ethereal-users@ethereal.com"
461 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "URLInfoAbout" "http://www.ethereal.com"
462 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "URLUpdateInfo" "http://www.ethereal.com/distribution/win32/"
463 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "NoModify" 1
464 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "NoRepair" 1
465 WriteUninstaller "uninstall.exe"
466
467 ; Write an entry for ShellExecute
468 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\ethereal.exe" "" '$INSTDIR\ethereal.exe'
469 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\ethereal.exe" "Path" '$INSTDIR'
470
471 ; Create start menu entries (depending on additional tasks page)
472 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State"
473 StrCmp $0 "0" SecRequired_skip_StartMenu
474 SetOutPath $PROFILE
475 CreateDirectory "$SMPROGRAMS\Ethereal"
476 ; To qoute "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch11d.asp":
477 ; "Do not include Readme, Help, or Uninstall entries on the Programs menu."
478 Delete "$SMPROGRAMS\Ethereal\Ethereal Web Site.lnk"
479 ;WriteINIStr "$SMPROGRAMS\Ethereal\Ethereal Web Site.url" "InternetShortcut" "URL" "http://www.ethereal.com/"
480 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal.lnk" "$INSTDIR\ethereal.exe" "" "$INSTDIR\ethereal.exe" 0 "" "" "The Ethereal Network Protocol Analyzer"
481 ;CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal Manual.lnk" "$INSTDIR\ethereal.html"
482 ;CreateShortCut "$SMPROGRAMS\Ethereal\Display Filters Manual.lnk" "$INSTDIR\ethereal-filter.html"
483 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal Program Directory.lnk" \
484           "$INSTDIR"
485 ;CreateShortCut "$SMPROGRAMS\Ethereal\Uninstall Ethereal.lnk" "$INSTDIR\uninstall.exe"
486 SecRequired_skip_StartMenu:
487
488 ; is command line option "/desktopicon" set?
489 ${GetParameters} $R0
490 ${GetOptions} $R0 "/desktopicon=" $R1
491 StrCmp $R1 "no" SecRequired_skip_DesktopIcon
492 StrCmp $R1 "yes" SecRequired_install_DesktopIcon
493
494 ; Create desktop icon (depending on additional tasks page and command line option)
495 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State"
496 StrCmp $0 "0" SecRequired_skip_DesktopIcon
497 SecRequired_install_DesktopIcon:
498 CreateShortCut "$DESKTOP\Ethereal.lnk" "$INSTDIR\ethereal.exe" "" "$INSTDIR\ethereal.exe" 0 "" "" "The Ethereal Network Protocol Analyzer"
499 SecRequired_skip_DesktopIcon:
500
501 ; is command line option "/quicklaunchicon" set?
502 ${GetParameters} $R0
503 ${GetOptions} $R0 "/quicklaunchicon=" $R1
504 StrCmp $R1 "no" SecRequired_skip_QuickLaunchIcon
505 StrCmp $R1 "yes" SecRequired_install_QuickLaunchIcon
506
507 ; Create quick launch icon (depending on additional tasks page and command line option)
508 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State"
509 StrCmp $0 "0" SecRequired_skip_QuickLaunchIcon
510 SecRequired_install_QuickLaunchIcon:
511 CreateShortCut "$QUICKLAUNCH\Ethereal.lnk" "$INSTDIR\ethereal.exe" "" "$INSTDIR\ethereal.exe" 0 "" "" "The Ethereal Network Protocol Analyzer"
512 SecRequired_skip_QuickLaunchIcon:
513
514 ; Create File Extensions (depending on additional tasks page)
515 ReadINIStr $0 "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 6" "State"
516 StrCmp $0 "0" SecRequired_skip_FileExtensions
517 WriteRegStr HKCR ${ETHEREAL_ASSOC} "" "Ethereal file"
518 WriteRegStr HKCR "${ETHEREAL_ASSOC}\Shell\open\command" "" '"$INSTDIR\ethereal.exe" "%1"'
519 WriteRegStr HKCR "${ETHEREAL_ASSOC}\DefaultIcon" "" '"$INSTDIR\ethereal.exe",0'
520 push $R0
521         StrCpy $R0 ".5vw"
522         Call Associate
523         StrCpy $R0 ".acp"
524         Call Associate
525         StrCpy $R0 ".apc"
526         Call Associate
527         StrCpy $R0 ".atc"
528         Call Associate
529         StrCpy $R0 ".bfr"
530         Call Associate
531         StrCpy $R0 ".cap"
532         Call Associate
533         StrCpy $R0 ".enc"
534         Call Associate
535         StrCpy $R0 ".erf"
536         Call Associate
537         StrCpy $R0 ".fdc"
538         Call Associate
539         StrCpy $R0 ".pcap"
540         Call Associate
541         StrCpy $R0 ".pkt"
542         Call Associate
543         StrCpy $R0 ".snoop"
544         Call Associate
545         StrCpy $R0 ".syc"
546         Call Associate
547         StrCpy $R0 ".tpc"
548         Call Associate
549         StrCpy $R0 ".tr1"
550         Call Associate
551         StrCpy $R0 ".trace"
552         Call Associate
553         StrCpy $R0 ".trc"
554         Call Associate          
555         StrCpy $R0 ".wpc"
556         Call Associate
557         StrCpy $R0 ".wpz"
558         Call Associate
559 ; if somethings added here, add it also to the uninstall section and the AdditionalTask page
560 pop $R0
561 !insertmacro UpdateIcons
562 SecRequired_skip_FileExtensions:
563
564 ; if running as a silent installer, don't try to install winpcap
565 IfSilent SecRequired_skip_Winpcap
566
567 ; Install WinPcap (depending on winpcap page setting)
568 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State"
569 StrCmp $0 "0" SecRequired_skip_Winpcap
570 ; Uinstall old WinPcap first
571 ReadRegStr $WINPCAP_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
572 IfErrors lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
573 ; from released version 3.1, WinPcap will uninstall an old version by itself
574 ;ExecWait '$WINPCAP_UNINSTALL' $0
575 ;DetailPrint "WinPcap uninstaller returned $0"
576 lbl_winpcap_notinstalled:
577 SetOutPath $INSTDIR
578 File "WinPcap_3_1.exe"
579 ExecWait '"$INSTDIR\WinPcap_3_1.exe"' $0
580 DetailPrint "WinPcap installer returned $0"
581 SecRequired_skip_Winpcap:
582
583 ; Load Winpcap NPF service at startup (depending on winpcap page)
584 ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State"
585 StrCmp $0 "0" SecRequired_no_WinpcapService
586 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 2 ;set NPF to (SERVICE_AUTO_START)
587 !insertmacro SERVICE "start" "NPF" ""
588 Goto SecRequired_done_WinpcapService
589 SecRequired_no_WinpcapService:
590 WriteRegDWORD HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start" 3 ;set NPF to (SERVICE_DEMAND_START)
591 !insertmacro SERVICE "stop" "NPF" ""
592 SecRequired_done_WinpcapService:
593
594 SectionEnd ; "Required"
595
596
597 SectionGroup "!Ethereal" SecEtherealGroup
598
599 !ifdef GTK1_DIR
600 Section "Ethereal GTK1" SecEtherealGTK1
601 ;-------------------------------------------
602 !ifdef GTK1_DIR & GTK2_DIR
603 SectionIn 2 RO
604 !endif
605 SetOutPath $INSTDIR
606 File "..\..\ethereal.exe"
607 File "${GTK1_DIR}\lib\libgtk-0.dll"
608 File "${GTK1_DIR}\lib\libgdk-0.dll"
609 SectionEnd
610 !endif
611
612 !ifdef GTK2_DIR
613 Section "Ethereal GTK2" SecEtherealGTK2
614 ;-------------------------------------------
615 !ifdef GTK1_DIR & GTK2_DIR
616 SectionIn 1 RO
617 !endif
618 SetOutPath $INSTDIR
619 File /oname=ethereal.exe "..\..\ethereal-gtk2.exe"
620 File "${GTK2_DIR}\bin\libgdk-win32-2.0-0.dll"
621 File "${GTK2_DIR}\bin\libgdk_pixbuf-2.0-0.dll"
622 File "${GTK2_DIR}\bin\libgtk-win32-2.0-0.dll"
623 File "${GTK2_DIR}\bin\libatk-1.0-0.dll"
624 File "${GTK2_DIR}\bin\libpango-1.0-0.dll"
625 File "${GTK2_DIR}\bin\libpangowin32-1.0-0.dll"
626 !ifdef NEED_CAIRO_DLL
627 File "${GTK2_DIR}\bin\libcairo-2.dll"
628 File "${GTK2_DIR}\bin\libpangocairo-1.0-0.dll"
629 !endif
630 !ifdef NEED_LIBPNG_DLL
631 File "${GTK2_DIR}\bin\libpng13.dll"
632 !endif
633 SetOutPath $INSTDIR\etc\gtk-2.0
634 File "${GTK2_DIR}\etc\gtk-2.0\*.*"
635 SetOutPath $INSTDIR\etc\pango
636 File "${GTK2_DIR}\etc\pango\pango.*"
637 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_LIB_DIR}\loaders
638 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_LIB_DIR}\loaders\libpixbufloader-*.dll"
639 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_LIB_DIR}\immodules
640 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_LIB_DIR}\immodules\im-*.dll"
641 SetOutPath $INSTDIR\lib\pango\${PANGO_LIB_DIR}\modules
642 File "${GTK2_DIR}\lib\pango\${PANGO_LIB_DIR}\modules\pango-*.dll"
643 SectionEnd
644  
645 !ifdef GTK_WIMP_DIR
646 Section "GTK-Wimp" SecGTKWimp
647 ;-------------------------------------------
648 SectionIn 1
649 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_LIB_DIR}\engines
650 File "${GTK_WIMP_DIR}\libwimp.dll"
651 ; GTK+ 2.8 looks for themes in "etc".  We should really pick one
652 ; directory and install there.
653 SetOutPath $INSTDIR\share\themes\Default\gtk-2.0
654 File "${GTK_THEME_DIR}\gtkrc"
655 SetOutPath $INSTDIR\etc\gtk-2.0
656 File "${GTK_THEME_DIR}\gtkrc"
657 SectionEnd
658 !endif
659 !endif
660
661 SectionGroupEnd ; "Ethereal"
662
663
664 Section "Tethereal" SecTethereal
665 ;-------------------------------------------
666 !ifdef GTK1_DIR & GTK2_DIR
667 SectionIn 1 2
668 !endif
669 SetOutPath $INSTDIR
670 File "..\..\tethereal.exe"
671 File "..\..\doc\tethereal.html"
672 SectionEnd
673
674 SectionGroup "Plugins / Extensions" SecPluginsGroup
675
676 Section "Dissector Plugins" SecPlugins
677 ;-------------------------------------------
678 !ifdef GTK1_DIR & GTK2_DIR
679 SectionIn 1 2
680 !endif
681 SetOutPath $INSTDIR\plugins\${VERSION}
682 File "..\..\plugins\acn\acn.dll"
683 File "..\..\plugins\agentx\agentx.dll"
684 File "..\..\plugins\artnet\artnet.dll"
685 File "..\..\plugins\asn1\asn1.dll"
686 File "..\..\plugins\ciscosm\ciscosm.dll"
687 File "..\..\plugins\docsis\docsis.dll"
688 File "..\..\plugins\enttec\enttec.dll"
689 File "..\..\plugins\giop\coseventcomm.dll"
690 File "..\..\plugins\giop\cosnaming.dll"
691 File "..\..\plugins\giop\parlay.dll"
692 File "..\..\plugins\giop\tango.dll"
693 File "..\..\plugins\gryphon\gryphon.dll"
694 File "..\..\plugins\h223\h223.dll"
695 File "..\..\plugins\irda\irda.dll"
696 File "..\..\plugins\lwres\lwres.dll"
697 File "..\..\plugins\megaco\megaco.dll"
698 File "..\..\plugins\mgcp\mgcp.dll"
699 File "..\..\plugins\opsi\opsi.dll"
700 File "..\..\plugins\pcli\pcli.dll"
701 File "..\..\plugins\profinet\profinet.dll"
702 File "..\..\plugins\rdm\rdm.dll"
703 File "..\..\plugins\rlm\rlm.dll"
704 File "..\..\plugins\rtnet\rtnet.dll"
705 File "..\..\plugins\rudp\rudp.dll"
706 File "..\..\plugins\v5ua\v5ua.dll"
707 SectionEnd
708
709 Section "Tree Statistics Plugin" SecStatsTree
710 ;-------------------------------------------
711 !ifdef GTK1_DIR & GTK2_DIR
712 SectionIn 1 2
713 !endif
714 SetOutPath $INSTDIR\plugins\${VERSION}
715 File "..\..\plugins\stats_tree\stats_tree.dll"
716 SectionEnd
717
718 Section "Mate - Meta Analysis and Tracing Engine" SecMate
719 ;-------------------------------------------
720 SetOutPath $INSTDIR\plugins\${VERSION}
721 File "..\..\plugins\mate\mate.dll"
722 SectionEnd
723
724 !ifdef LUA_DIR
725 Section "LUA Plugin" SecLua
726 ;-------------------------------------------
727 SetOutPath $INSTDIR\plugins\${VERSION}
728 File "..\..\plugins\lua\lua.dll"
729 SectionEnd
730 !endif
731
732 Section "SNMP MIBs" SecMIBs
733 ;-------------------------------------------
734 !ifdef GTK1_DIR & GTK2_DIR
735 SectionIn 1 2
736 !endif
737 SetOutPath $INSTDIR\snmp\mibs
738 File "${NET_SNMP_DIR}\mibs\*.txt"
739 SectionEnd
740
741 SectionGroupEnd ; "Plugins / Extensions"
742
743
744 SectionGroup "Tools" SecToolsGroup
745
746 Section "Editcap" SecEditcap
747 ;-------------------------------------------
748 !ifdef GTK1_DIR & GTK2_DIR
749 SectionIn 1 2
750 !endif
751 SetOutPath $INSTDIR
752 File "..\..\editcap.exe"
753 File "..\..\doc\editcap.html"
754 SectionEnd
755
756 Section "Text2Pcap" SecText2Pcap
757 ;-------------------------------------------
758 !ifdef GTK1_DIR & GTK2_DIR
759 SectionIn 1 2
760 !endif
761 SetOutPath $INSTDIR
762 File "..\..\text2pcap.exe"
763 File "..\..\doc\text2pcap.html"
764 SectionEnd
765
766 Section "Mergecap" SecMergecap
767 ;-------------------------------------------
768 !ifdef GTK1_DIR & GTK2_DIR
769 SectionIn 1 2
770 !endif
771 SetOutPath $INSTDIR
772 File "..\..\mergecap.exe"
773 File "..\..\doc\mergecap.html"
774 SectionEnd
775
776 Section "Capinfos" SecCapinfos
777 ;-------------------------------------------
778 !ifdef GTK1_DIR & GTK2_DIR
779 SectionIn 1 2
780 !endif
781 SetOutPath $INSTDIR
782 File "..\..\capinfos.exe"
783 File "..\..\doc\capinfos.html"
784 SectionEnd
785
786 SectionGroupEnd ; "Tools"
787
788
789 Section "Uninstall" un.SecUinstall
790 ;-------------------------------------------
791
792 ;
793 ; UnInstall for every user
794 ;
795 SectionIn 1 2
796 SetShellVarContext all
797
798 Delete "$INSTDIR\tethereal.exe"
799 IfErrors 0 NoTetherealErrorMsg
800         MessageBox MB_OK "Please note: tethereal.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tethereal.exe removed
801         Abort "Please note: tethereal.exe could not be removed, it's probably in use! Abort uninstall process!"
802 NoTetherealErrorMsg:
803
804 Delete "$INSTDIR\ethereal.exe"
805 IfErrors 0 NoEtherealErrorMsg
806         MessageBox MB_OK "Please note: ethereal.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if ethereal.exe removed
807         Abort "Please note: ethereal.exe could not be removed, it's probably in use! Abort uninstall process!"
808 NoEtherealErrorMsg:
809
810 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal"
811 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Ethereal"
812 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\ethereal.exe"
813
814 push $R0
815         StrCpy $R0 ".5vw"
816         Call un.unlink
817         StrCpy $R0 ".acp"
818         Call un.unlink
819         StrCpy $R0 ".apc"
820         Call un.unlink
821         StrCpy $R0 ".atc"
822         Call un.unlink
823         StrCpy $R0 ".bfr"
824         Call un.unlink
825         StrCpy $R0 ".cap"
826         Call un.unlink
827         StrCpy $R0 ".enc"
828         Call un.unlink
829         StrCpy $R0 ".erf"
830         Call un.unlink
831         StrCpy $R0 ".fdc"
832         Call un.unlink
833         StrCpy $R0 ".pcap"
834         Call un.unlink
835         StrCpy $R0 ".pkt"
836         Call un.unlink
837         StrCpy $R0 ".snoop"
838         Call un.unlink
839         StrCpy $R0 ".syc"
840         Call un.unlink
841         StrCpy $R0 ".tpc"
842         Call un.unlink
843         StrCpy $R0 ".tr1"
844         Call un.unlink
845         StrCpy $R0 ".trace"
846         Call un.unlink
847         StrCpy $R0 ".trc"
848         Call un.unlink          
849         StrCpy $R0 ".wpc"
850         Call un.unlink
851         StrCpy $R0 ".wpz"
852         Call un.unlink
853 pop $R0
854
855 DeleteRegKey HKCR ${ETHEREAL_ASSOC} 
856 DeleteRegKey HKCR "${ETHEREAL_ASSOC}\Shell\open\command"
857 DeleteRegKey HKCR "${ETHEREAL_ASSOC}\DefaultIcon"
858 !insertmacro UpdateIcons
859
860 ; regardless if we currently installed GTK1 or 2, try to uninstall GTK2 files too
861 Delete "$INSTDIR\etc\gtk-2.0\*.*"
862 Delete "$INSTDIR\etc\pango\*.*"
863 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
864 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
865 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
866 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
867 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
868 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
869 Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
870 Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
871 Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
872 Delete "$INSTDIR\help\*.*"
873 Delete "$INSTDIR\diameter\*.*"
874 Delete "$INSTDIR\snmp\mibs\*.*"
875 Delete "$INSTDIR\snmp\*.*"
876 Delete "$INSTDIR\*.exe"
877 Delete "$INSTDIR\*.dll"
878 Delete "$INSTDIR\*.html"
879 Delete "$INSTDIR\COPYING"
880 Delete "$INSTDIR\AUTHORS-SHORT"
881 Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
882 Delete "$INSTDIR\README*"
883 Delete "$INSTDIR\FAQ"
884 Delete "$INSTDIR\NEWS.txt"
885 Delete "$INSTDIR\manuf"
886 Delete "$INSTDIR\pcrepattern.3.txt"
887 Delete "$INSTDIR\radius\*.*"
888 Delete "$INSTDIR\dtds\*.*"
889 Delete "$SMPROGRAMS\Ethereal\*.*"
890 Delete "$DESKTOP\Ethereal.lnk"
891 Delete "$QUICKLAUNCH\Ethereal.lnk"
892
893 RMDir "$INSTDIR\etc\gtk-2.0"
894 RMDir "$INSTDIR\etc\pango"
895 RMDir "$INSTDIR\etc"
896 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
897 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
898 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
899 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
900 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
901 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
902 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
903 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
904 RMDir "$INSTDIR\lib\gtk-2.0"
905 RMDir "$INSTDIR\lib\pango\1.2.0\modules"
906 RMDir "$INSTDIR\lib\pango\1.2.0"
907 RMDir "$INSTDIR\lib\pango\1.4.0\modules"
908 RMDir "$INSTDIR\lib\pango\1.4.0"
909 RMDir "$INSTDIR\lib\pango"
910 RMDir "$INSTDIR\lib"
911 RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
912 RMDir "$INSTDIR\share\themes\Default"
913 RMDir "$INSTDIR\share\themes"
914 RMDir "$INSTDIR\share"
915 RMDir "$SMPROGRAMS\Ethereal"
916 RMDir "$INSTDIR\help"
917 RMDir "$INSTDIR\diameter"
918 RMDir "$INSTDIR\snmp\mibs"
919 RMDir "$INSTDIR\snmp"
920 RMDir "$INSTDIR\radius"
921 RMDir "$INSTDIR\dtds"
922 RMDir "$INSTDIR"
923
924 SectionEnd ; "Uinstall"
925
926 Section "Un.Plugins" un.SecPlugins
927 ;-------------------------------------------
928 SectionIn 1 2
929 ;Delete "$INSTDIR\plugins\${VERSION}\*.*"
930 ;Delete "$INSTDIR\plugins\*.*"
931 ;RMDir "$INSTDIR\plugins\${VERSION}"
932 ;RMDir "$INSTDIR\plugins"
933 RMDir /r "$INSTDIR\plugins"
934 SectionEnd
935
936 Section "Un.Global Settings" un.SecGlobalSettings
937 ;-------------------------------------------
938 SectionIn 1 2
939 Delete "$INSTDIR\cfilters"
940 Delete "$INSTDIR\colorfilters"
941 Delete "$INSTDIR\dfilters"
942 RMDir "$INSTDIR"
943 SectionEnd
944
945 Section /o "Un.Personal Settings" un.SecPersonalSettings
946 ;-------------------------------------------
947 SectionIn 2
948 SetShellVarContext current
949 Delete "$APPDATA\Ethereal\*.*"
950 RMDir "$APPDATA\Ethereal"
951 SectionEnd
952
953 ;VAR un.WINPCAP_UNINSTALL
954
955 Section /o "Un.WinPcap" un.SecWinPcap
956 ;-------------------------------------------
957 SectionIn 2
958 ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
959 ;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
960 ;MessageBox MB_OK "WinPcap $1"
961 ExecWait '$1' $0
962 DetailPrint "WinPcap uninstaller returned $0"
963 ;SetRebootFlag true
964 ;un.lbl_winpcap_notinstalled:
965 SectionEnd
966
967 Section "-Un.Finally"
968 ;-------------------------------------------
969 SectionIn 1 2
970 ; this test must be done after all other things uninstalled (e.g. Global Settings)
971 IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
972     MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if dir doesn't exist
973 NoFinalErrorMsg: 
974 SectionEnd
975
976
977 ; ============================================================================
978 ; PLEASE MAKE SURE, THAT THE DESCRIPTIVE TEXT FITS INTO THE DESCRIPTION FIELD!
979 ; ============================================================================
980 !ifdef MAKENSIS_MODERN_UI
981 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
982   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGroup} "${PROGRAM_NAME} is a GUI network protocol analyzer."
983 !ifdef GTK1_DIR
984   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK1} "${PROGRAM_NAME} using the classical GTK1 user interface."
985 !endif  
986 !ifdef GTK2_DIR  
987   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK2} "${PROGRAM_NAME} using the modern GTK2 user interface."
988 !ifdef GTK_WIMP_DIR
989   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTKWimp} "GTK-Wimp is the GTK2 windows impersonator (native Win32 look and feel, for Win2000 and up)."
990 !endif  
991 !endif
992   !insertmacro MUI_DESCRIPTION_TEXT ${SecTethereal} "Tethereal is a text based network protocol analyzer."
993   !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} "Some plugins and extensions for both Ethereal and Tethereal."
994   !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections."
995   !insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Plugin for some extended statistics."
996   !insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)."
997 !ifdef LUA_DIR
998   !insertmacro MUI_DESCRIPTION_TEXT ${SecLua} "Plugin - LUA (Experimental)."
999 !endif
1000   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
1001   !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools."
1002   !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."
1003   !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."
1004   !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Mergecap is a program that combines multiple saved capture files into a single output file"
1005   !insertmacro MUI_DESCRIPTION_TEXT ${SecCapinfos} "Capinfos is a program that provides information on capture files."
1006 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1007
1008 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN 
1009   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all Ethereal components."
1010   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous Ethereal versions)."
1011   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
1012   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
1013   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
1014 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1015   
1016 !endif ; MAKENSIS_MODERN_UI
1017
1018 ; ============================================================================
1019 ; Callback functions
1020 ; ============================================================================
1021 !ifdef GTK1_DIR & GTK2_DIR
1022 ;Disable GTK-Wimp for GTK1
1023
1024 Function .onSelChange
1025         Push $0
1026         SectionGetFlags ${SecEtherealGTK1} $0
1027         IntOp  $0 $0 & 1
1028         IntCmp $0 1 onSelChange.disableGTK2Sections
1029         ;enable GTK2Sections
1030         !insertmacro EnableSection ${SecGTKWimp}
1031         Goto onSelChange.end
1032 onSelChange.disableGTK2Sections:
1033         !insertmacro DisableSection ${SecGTKWimp}
1034         Goto onSelChange.end
1035 onSelChange.end:
1036         Pop $0
1037 FunctionEnd     
1038
1039 !else
1040 !ifdef GTK1_DIR | GTK2_DIR
1041 ; Disable FileExtension if Ethereal isn't selected
1042 Function .onSelChange
1043         Push $0
1044 !ifdef GTK1_DIR
1045         SectionGetFlags ${SecEtherealGTK1} $0
1046         IntOp  $0 $0 & 1
1047         IntCmp $0 0 onSelChange.unselect
1048         SectionGetFlags ${SecFileExtensions} $0
1049         IntOp  $0 $0 & 16
1050         IntCmp $0 16 onSelChange.unreadonly
1051         Goto onSelChange.end
1052 !else
1053         SectionGetFlags ${SecEtherealGTK2} $0
1054         IntOp  $0 $0 & 1
1055         IntCmp $0 0 onSelChange.unselect
1056         SectionGetFlags ${SecFileExtensions} $0
1057         IntOp  $0 $0 & 16
1058         IntCmp $0 16 onSelChange.unreadonly
1059         Goto onSelChange.end    
1060 !endif
1061 onSelChange.unselect:   
1062         SectionGetFlags ${SecFileExtensions} $0
1063         IntOp $0 $0 & 0xFFFFFFFE
1064         IntOp $0 $0 | 0x10
1065         SectionSetFlags ${SecFileExtensions} $0
1066         Goto onSelChange.end
1067 onSelChange.unreadonly:
1068         SectionGetFlags ${SecFileExtensions} $0
1069         IntOp $0 $0 & 0xFFFFFFEF
1070         SectionSetFlags ${SecFileExtensions} $0
1071         Goto onSelChange.end
1072 onSelChange.end:
1073         Pop $0
1074 FunctionEnd
1075 !endif
1076 !endif
1077
1078
1079 !include "GetWindowsVersion.nsh"
1080 !include WinMessages.nsh
1081
1082 Var NPF_START ;declare variable for holding the value of a registry key
1083 Var WINPCAP_VERSION ;declare variable for holding the value of a registry key
1084
1085 Function myShowCallback
1086
1087 ; Uinstall old Ethereal first
1088 ; XXX - doesn't work, but kept here for further experiments
1089 ;ReadRegStr $ETHEREAL_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "UninstallString"
1090 ;IfErrors lbl_ethereal_notinstalled ;if RegKey is unavailable, WinPcap is not installed
1091 ;MessageBox MB_YESNO|MB_ICONQUESTION "Uninstall the old Ethereal version first (recommended)?" 
1092 ; Hide the installer while uninstalling
1093 ;GetDlgItem $0 $HWNDPARENT 1
1094 ;FindWindow $0 "#32770" "" $HWNDPARENT
1095 ;MessageBox MB_OK "Window $0" 
1096 ;ShowWindow $0 ${SW_HIDE}
1097 ;HideWindow
1098 ;ExecWait '$ETHEREAL_UNINSTALL' $0
1099 ;DetailPrint "WinPcap uninstaller returned $0"
1100 ;GetDlgItem $0 $HWNDPARENT 1
1101 ;ShowWindow $0 ${SW_SHOW}
1102 ;MessageBox MB_OK "Uninstalled" 
1103 ;lbl_ethereal_notinstalled:
1104
1105
1106         ; Get the Windows version
1107         Call GetWindowsVersion
1108         Pop $R0 ; Windows Version
1109 !ifdef GTK2_DIR
1110         ; Enable GTK-Wimp only for Windows 2000/XP/2003
1111         ; ...as Win9x/ME/NT known to have problems with it!
1112         
1113         ;DetailPrint 'Windows Version: $R0'
1114         StrCmp $R0 '2000' lbl_select_wimp
1115         StrCmp $R0 'XP' lbl_select_wimp
1116         StrCmp $R0 '2003' lbl_select_wimp
1117         DetailPrint "Windows $R0 doesn't support GTK-Wimp!"
1118
1119         Goto lbl_ignore_wimp
1120 lbl_select_wimp:
1121         !insertmacro SelectSection ${SecGTKWimp}
1122
1123 lbl_ignore_wimp:
1124 !endif
1125
1126
1127         ; detect if WinPcap should be installed
1128         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Text" "Install WinPcap 3.1"
1129         ReadRegStr $WINPCAP_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName"
1130         IfErrors 0 lbl_winpcap_installed ;if RegKey is available, WinPcap is already installed
1131         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "WinPcap is currently not installed"
1132         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Flags" "DISABLED"
1133         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)"
1134         Goto lbl_winpcap_done
1135
1136 lbl_winpcap_installed:
1137         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$WINPCAP_VERSION"
1138         ; WinPcap 2.x (including betas): the version string starts with "WinPcap 2."
1139         StrCpy $1 "$WINPCAP_VERSION" 10
1140         StrCmp $1 "WinPcap 2." lbl_winpcap_do_install
1141         ; WinPcap 3.0 (including betas): the version string starts with "WinPcap 3.0"
1142         StrCpy $1 "$WINPCAP_VERSION" 11
1143         StrCmp $1 "WinPcap 3.0" lbl_winpcap_do_install
1144         ; WinPcap 3.1 previous beta's; exact string match
1145         StrCmp "$WINPCAP_VERSION" "WinPcap 3.1 beta" lbl_winpcap_do_install
1146         StrCmp "$WINPCAP_VERSION" "WinPcap 3.1 beta2" lbl_winpcap_do_install
1147         StrCmp "$WINPCAP_VERSION" "WinPcap 3.1 beta3" lbl_winpcap_do_install
1148         StrCmp "$WINPCAP_VERSION" "WinPcap 3.1 beta4" lbl_winpcap_do_install
1149
1150 ;lbl_winpcap_dont_install:
1151         ; seems to be the current or even a newer version, so don't install
1152         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0"
1153         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If selected, the currently installed $WINPCAP_VERSION will be uninstalled first."
1154         Goto lbl_winpcap_done
1155
1156 lbl_winpcap_do_install:
1157         ; seems to be an old version, install newer one
1158         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "1"
1159         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_VERSION will be uninstalled first."
1160
1161 lbl_winpcap_done:
1162
1163         ; Disable NPF service setting for Win OT 
1164         StrCmp $R0 '95' lbl_npf_disable
1165         StrCmp $R0 '98' lbl_npf_disable
1166         StrCmp $R0 'ME' lbl_npf_disable
1167         ReadRegDWORD $NPF_START HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NPF" "Start"
1168         ; (Winpcap may not be installed already, so no regKey is no error here)
1169         IfErrors lbl_npf_done ;RegKey not available, so do not set it
1170         IntCmp $NPF_START 2 0 lbl_npf_done lbl_npf_done
1171         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "1"
1172         Goto lbl_npf_done
1173         ;disable
1174 lbl_npf_disable:
1175         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "State" "0"
1176         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 8" "Flags" "DISABLED"
1177         WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 9" "Flags" "DISABLED"  
1178 lbl_npf_done:
1179
1180
1181         ; if Ethereal was previously installed, unselect previously not installed icons etc.
1182         ; detect if Ethereal is already installed -> 
1183         ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "UninstallString"
1184         IfErrors lbl_ethereal_notinstalled ;if RegKey is unavailable, Ethereal is not installed
1185
1186         ; only select Start Menu Group, if previously installed
1187         ; (we use the "all users" start menu, so select it first)
1188         SetShellVarContext all
1189         IfFileExists "$SMPROGRAMS\Ethereal\Ethereal.lnk" lbl_have_startmenu
1190         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 2" "State" "0"
1191 lbl_have_startmenu:
1192
1193         ; only select Desktop Icon, if previously installed
1194         IfFileExists "$DESKTOP\Ethereal.lnk" lbl_have_desktopicon
1195         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 3" "State" "0"
1196 lbl_have_desktopicon:
1197
1198         ; only select Quick Launch Icon, if previously installed
1199         IfFileExists "$QUICKLAUNCH\Ethereal.lnk" lbl_have_quicklaunchicon
1200         WriteINIStr "$PLUGINSDIR\AdditionalTasksPage.ini" "Field 4" "State" "0"
1201 lbl_have_quicklaunchicon:
1202
1203 lbl_ethereal_notinstalled:
1204
1205
1206 FunctionEnd