From Graeme Hewson: make AUTHORS-SHORT not include formatting codes,
[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 SetCompressor lzma
10 !endif
11
12 !ifdef GTK1_DIR & GTK2_DIR
13 InstType "Ethereal (GTK2 user interface)"
14 InstType "Ethereal (legacy GTK1 user interface)"
15 !endif
16
17 ; Used to refresh the display of file association
18 !define SHCNE_ASSOCCHANGED 0x08000000
19 !define SHCNF_IDLIST 0
20
21 ; Used to add associations between file extensions and Ethereal
22 !define ETHEREAL_ASSOC "ethereal-file"
23
24
25 ; ============================================================================
26 ; Header configuration
27 ; ============================================================================
28 ; The name of the installer
29 !define PROGRAM_NAME "Ethereal"
30
31 Name "${PROGRAM_NAME} ${VERSION}"
32
33 ; The file to write
34 OutFile "${DEST}-setup-${VERSION}.exe"
35
36 ; Icon of installer and uninstaller
37 Icon "..\..\image\ethereal.ico"
38 UninstallIcon "..\..\image\ethereal.ico"
39
40 ; Uninstall stuff (this text isn't used with the MODERN_UI!)
41 UninstallText "This will uninstall Ethereal.\r\nBefore starting the uninstallation, make sure Ethereal is not running.\r\nClick 'Next' to continue."
42
43 XPStyle on
44
45
46 !ifdef MAKENSIS_MODERN_UI
47
48 ; ============================================================================
49 ; Modern UI
50 ; ============================================================================
51 ; The modern user interface will look much better than the common one.
52 ; However, as the development of the modern UI is still going on, and the script
53 ; syntax changes, you will need exactly that NSIS version, which this script is
54 ; made for. This is the current (December 2003) latest version: V2.0b4
55 ; If you are using a different version, it's not predictable what will happen.
56
57 !include "MUI.nsh"
58
59 !define MUI_ICON "..\..\image\ethereal.ico"
60 !define MUI_UNICON "..\..\image\ethereal.ico"
61
62 !define MUI_COMPONENTSPAGE_SMALLDESC
63 !define MUI_FINISHPAGE_NOAUTOCLOSE
64 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
65 !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."
66 !define MUI_FINISHPAGE_LINK "Install WinPcap to be able to capture packets from a network!"
67 !define MUI_FINISHPAGE_LINK_LOCATION "http://winpcap.polito.it"
68
69 ; NSIS shows Readme files by opening the Readme file with the default application for
70 ; the file's extension. "README.win32" won't work in most cases, because extension "win32" 
71 ; is usually not associated with an appropriate text editor. We should use extension "txt" 
72 ; for a text file or "html" for an html README file.  
73 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NEWS.txt"
74 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show News"
75 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
76
77 ; ============================================================================
78 ; MUI Pages
79 ; ============================================================================
80
81 !insertmacro MUI_PAGE_WELCOME
82 !insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
83 !insertmacro MUI_PAGE_COMPONENTS
84 !insertmacro MUI_PAGE_DIRECTORY
85 !insertmacro MUI_PAGE_INSTFILES
86 !insertmacro MUI_PAGE_FINISH
87  
88 !insertmacro MUI_UNPAGE_WELCOME
89 !insertmacro MUI_UNPAGE_CONFIRM
90 !insertmacro MUI_UNPAGE_INSTFILES
91 !insertmacro MUI_UNPAGE_FINISH
92
93 ; ============================================================================
94 ; MUI Languages
95 ; ============================================================================
96  
97 !insertmacro MUI_LANGUAGE "English"
98
99 !endif ; MAKENSIS_MODERN_UI
100
101 ; ============================================================================
102 ; Section macros
103 ; ============================================================================
104 !include "Sections.nsh"
105
106 ; ========= Macro to unselect and disable a section =========
107
108 !macro DisableSection SECTION
109
110   Push $0
111     SectionGetFlags "${SECTION}" $0
112     IntOp $0 $0 & ${SECTION_OFF}
113     IntOp $0 $0 | ${SF_RO}
114     SectionSetFlags "${SECTION}" $0
115   Pop $0
116
117 !macroend
118
119 ; ========= Macro to enable (unreadonly) a section =========
120 !define SECTION_ENABLE   0xFFFFFFEF
121 !macro EnableSection SECTION
122
123   Push $0
124     SectionGetFlags "${SECTION}" $0
125     IntOp $0 $0 & ${SECTION_ENABLE}
126     SectionSetFlags "${SECTION}" $0
127   Pop $0
128
129 !macroend
130
131 ; ============================================================================
132 ; License page configuration
133 ; ============================================================================
134 LicenseText "Ethereal is distributed under the GNU General Public License."
135 LicenseData "..\..\COPYING"
136
137 ; ============================================================================
138 ; Component page configuration
139 ; ============================================================================
140 ComponentText "The following components are available for installation."
141
142 ; Component check boxes
143 ; Commented out for NSIS v 2.0
144 ; EnabledBitmap "..\..\image\nsis-checked.bmp"
145 ; DisabledBitmap "..\..\image\nsis-unchecked.bmp"
146
147 ; ============================================================================
148 ; Directory selection page configuration
149 ; ============================================================================
150 ; The text to prompt the user to enter a directory
151 DirText "Choose a directory in which to install Ethereal."
152
153 ; The default installation directory
154 InstallDir $PROGRAMFILES\Ethereal\
155
156 ; See if this is an upgrade; if so, use the old InstallDir as default
157 InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal "InstallDir"
158
159
160 ; ============================================================================
161 ; Install page configuration
162 ; ============================================================================
163 ShowInstDetails show
164
165 ; ============================================================================
166 ; Functions and macros
167 ; ============================================================================
168 !macro UpdateIcons
169         Push $R0
170         Push $R1
171         Push $R2
172
173         !define UPDATEICONS_UNIQUE ${__LINE__}
174
175         IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.next1_${UPDATEICONS_UNIQUE} UpdateIcons.error1_${UPDATEICONS_UNIQUE} 
176 UpdateIcons.next1_${UPDATEICONS_UNIQUE}:        
177         GetDllVersion "$SYSDIR\shell32.dll" $R0 $R1
178         IntOp $R2 $R0 / 0x00010000
179         IntCmp $R2 4 UpdateIcons.next2_${UPDATEICONS_UNIQUE} UpdateIcons.error2_${UPDATEICONS_UNIQUE}
180 UpdateIcons.next2_${UPDATEICONS_UNIQUE}:        
181         System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' 
182         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}     
183         
184 UpdateIcons.error1_${UPDATEICONS_UNIQUE}: 
185         MessageBox MB_OK|MB_ICONSTOP  "Can't find 'shell32.dll' library. Impossible to update icons" 
186         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
187 UpdateIcons.error2_${UPDATEICONS_UNIQUE}:       
188         MessageBox MB_OK|MB_ICONINFORMATION "You should install the free 'Microsoft Layer for Unicode' to update Ethereal capture file icons" 
189         Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
190 UpdateIcons.quit_${UPDATEICONS_UNIQUE}: 
191         !undef UPDATEICONS_UNIQUE
192         Pop $R2
193         Pop $R1
194         Pop $R0
195
196 !macroend
197
198 Function Associate
199         ; $R0 should contain the prefix to associate to Ethereal
200         Push $R1
201         
202         ReadRegStr $R1 HKCR $R0 ""
203         StrCmp $R1 "" Associate.doRegister
204         Goto Associate.end
205 Associate.doRegister:
206         ;The extension is not associated to any program, we can do the link
207         WriteRegStr HKCR $R0 "" ${ETHEREAL_ASSOC}
208 Associate.end:
209         pop $R1
210 FunctionEnd
211
212 Function un.unlink
213         ; $R0 should contain the prefix to unlink
214         Push $R1
215         
216         ReadRegStr $R1 HKCR $R0 ""
217         StrCmp $R1 ${ETHEREAL_ASSOC} un.unlink.doUnlink
218         Goto un.unlink.end
219 un.unlink.doUnlink:
220         ; The extension is associated with Ethereal so, we must destroy this!
221         DeleteRegKey HKCR $R0   
222 un.unlink.end:  
223         pop $R1
224 FunctionEnd
225
226 ; ============================================================================
227 ; Installation execution commands
228 ; ============================================================================
229
230 Section "-Required"
231 ;-------------------------------------------
232
233 ;
234 ; Install for every user
235 ;
236 !ifdef GTK1_DIR & GTK2_DIR
237 SectionIn 1 2 RO
238 !endif
239 SetShellVarContext all
240
241 SetOutPath $INSTDIR
242 File "..\..\wiretap\wiretap-${WTAP_VERSION}.dll"
243 !ifdef ENABLE_LIBETHEREAL
244 File "..\..\epan\libethereal.dll"
245 !endif
246 File "${GLIB_DIR}\bin\libglib-2.0-0.dll"
247 File "${GLIB_DIR}\bin\libgmodule-2.0-0.dll"
248 File "${GLIB_DIR}\bin\libgobject-2.0-0.dll"
249 File "${ICONV_DIR}\bin\iconv.dll"
250 File "${GETTEXT_DIR}\bin\intl.dll"
251 !ifdef ZLIB_DIR
252 File "${ZLIB_DIR}\zlib1.dll"
253 !endif
254 !ifdef ADNS_DIR
255 File "${ADNS_DIR}\adns_win32\LIB\adns_dll.dll"
256 !endif
257 !ifdef PCRE_DIR
258 File "${PCRE_DIR}\bin\pcre.dll"
259 File "${PCRE_DIR}\man\cat3\pcrepattern.3.txt"
260 !endif
261 File "..\..\FAQ"
262 File "..\..\README"
263 File "..\..\README.win32"
264 File "..\..\AUTHORS-SHORT"
265 File "..\..\AUTHORS-SHORT-FORMAT"
266 File "..\..\COPYING"
267 File "NEWS.txt"
268 File "..\..\manuf"
269 File "..\..\doc\ethereal.html"
270 File "..\..\doc\ethereal-filter.html"
271
272 ;
273 ; Install the Diameter DTD and XML files in the "diameter" subdirectory
274 ; of the installation directory.
275
276 SetOutPath $INSTDIR\diameter
277 File "..\..\dictionary.dtd"
278 File "..\..\dictionary.xml"
279 File "..\..\imscxdx.xml"
280 File "..\..\mobileipv4.xml"
281 File "..\..\nasreq.xml"
282 File "..\..\sunping.xml"
283 SetOutPath $INSTDIR
284
285 SetOutPath $INSTDIR\help
286 File "..\..\help\toc"
287 File "..\..\help\overview.txt"
288 File "..\..\help\getting_started.txt"
289 File "..\..\help\capturing.txt"
290 File "..\..\help\capture_filters.txt"
291 File "..\..\help\display_filters.txt"
292 File "..\..\help\faq.txt"
293
294 ; Write the uninstall keys for Windows
295 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "DisplayVersion" "${VERSION}"
296 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "DisplayName" "Ethereal ${VERSION}"
297 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "UninstallString" '"$INSTDIR\uninstall.exe"'
298 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "Publisher" "The Ethereal developer community, http://www.ethereal.com"
299 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "HelpLink" "mailto:ethereal-users@ethereal.com"
300 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "URLInfoAbout" "http://www.ethereal.com"
301 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "URLUpdateInfo" "http://www.ethereal.com/distribution/win32/"
302 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "NoModify" 1
303 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" "NoRepair" 1
304 WriteUninstaller "uninstall.exe"
305 SectionEnd
306
307 !ifdef GTK1_DIR
308 Section "Ethereal GTK1" SecEtherealGTK1
309 ;-------------------------------------------
310 !ifdef GTK1_DIR & GTK2_DIR
311 SectionIn 2 RO
312 !endif
313 SetOutPath $INSTDIR
314 File "..\..\ethereal.exe"
315 File "${GTK1_DIR}\lib\libgtk-0.dll"
316 File "${GTK1_DIR}\lib\libgdk-0.dll"
317 SectionEnd
318 !endif
319
320 !ifdef GTK2_DIR
321 Section "Ethereal GTK2" SecEtherealGTK2
322 ;-------------------------------------------
323 !ifdef GTK1_DIR & GTK2_DIR
324 SectionIn 1 RO
325 !endif
326 SetOutPath $INSTDIR
327 File /oname=ethereal.exe "..\..\ethereal-gtk2.exe"
328 File "${GTK2_DIR}\bin\libgdk-win32-2.0-0.dll"
329 File "${GTK2_DIR}\bin\libgdk_pixbuf-2.0-0.dll"
330 File "${GTK2_DIR}\bin\libgtk-win32-2.0-0.dll"
331 File "${GTK2_DIR}\bin\libatk-1.0-0.dll"
332 File "${GTK2_DIR}\bin\libpango-1.0-0.dll"
333 File "${GTK2_DIR}\bin\libpangowin32-1.0-0.dll"
334 SetOutPath $INSTDIR\etc\gtk-2.0
335 File "${GTK2_DIR}\etc\gtk-2.0\*.*"
336 SetOutPath $INSTDIR\etc\pango
337 File "${GTK2_DIR}\etc\pango\pango.*"
338 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_INST_VERSION}.0\loaders
339 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_INST_VERSION}.0\loaders\libpixbufloader-*.dll"
340 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_INST_VERSION}.0\immodules
341 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_INST_VERSION}.0\immodules\im-*.dll"
342 SetOutPath $INSTDIR\lib\pango\${PANGO_INST_VERSION}.0\modules
343 File "${GTK2_DIR}\lib\pango\${PANGO_INST_VERSION}.0\modules\pango-*.dll"
344 SectionEnd
345  
346 !ifdef GTK_WIMP_DIR
347 Section "GTK-Wimp" SecGTKWimp
348 ;-------------------------------------------
349 SetOutPath $INSTDIR\lib\gtk-2.0\${GTK2_INST_VERSION}.0\engines
350 File "${GTK_WIMP_DIR}\libwimp.dll"
351 SetOutPath $INSTDIR\share\themes\Default\gtk-2.0
352 File "${GTK_WIMP_DIR}\Theme\gtk-2.0\gtkrc"
353 SectionEnd
354 !endif
355 !endif
356
357 Section "Tethereal" SecTethereal
358 ;-------------------------------------------
359 !ifdef GTK1_DIR & GTK2_DIR
360 SectionIn 1 2
361 !endif
362 SetOutPath $INSTDIR
363 File "..\..\tethereal.exe"
364 File "..\..\doc\tethereal.html"
365 SectionEnd
366
367 Section "Editcap" SecEditcap
368 ;-------------------------------------------
369 !ifdef GTK1_DIR & GTK2_DIR
370 SectionIn 1 2
371 !endif
372 SetOutPath $INSTDIR
373 File "..\..\editcap.exe"
374 File "..\..\doc\editcap.html"
375 SectionEnd
376
377 Section "Text2Pcap" SecText2Pcap
378 ;-------------------------------------------
379 !ifdef GTK1_DIR & GTK2_DIR
380 SectionIn 1 2
381 !endif
382 SetOutPath $INSTDIR
383 File "..\..\text2pcap.exe"
384 File "..\..\doc\text2pcap.html"
385 SectionEnd
386
387 Section "Mergecap" SecMergecap
388 ;-------------------------------------------
389 !ifdef GTK1_DIR & GTK2_DIR
390 SectionIn 1 2
391 !endif
392 SetOutPath $INSTDIR
393 File "..\..\mergecap.exe"
394 File "..\..\doc\mergecap.html"
395 SectionEnd
396
397 Section "Capinfo" SecCapinfo
398 ;-------------------------------------------
399 !ifdef GTK1_DIR & GTK2_DIR
400 SectionIn 1 2
401 !endif
402 SetOutPath $INSTDIR
403 File "..\..\capinfo.exe"
404 File "..\..\doc\capinfo.html"
405 SectionEnd
406
407
408 Section "Plugins" SecPlugins
409 ;-------------------------------------------
410 !ifdef GTK1_DIR & GTK2_DIR
411 SectionIn 1 2
412 !endif
413 SetOutPath $INSTDIR\plugins\${VERSION}
414 File "..\..\plugins\acn\acn.dll"
415 File "..\..\plugins\artnet\artnet.dll"
416 File "..\..\plugins\asn1\asn1.dll"
417 File "..\..\plugins\ciscosm\ciscosm.dll"
418 File "..\..\plugins\docsis\docsis.dll"
419 File "..\..\plugins\enttec\enttec.dll"
420 File "..\..\plugins\giop\coseventcomm.dll"
421 File "..\..\plugins\giop\cosnaming.dll"
422 File "..\..\plugins\gryphon\gryphon.dll"
423 File "..\..\plugins\irda\irda.dll"
424 File "..\..\plugins\lwres\lwres.dll"
425 File "..\..\plugins\megaco\megaco.dll"
426 File "..\..\plugins\mgcp\mgcp.dll"
427 File "..\..\plugins\opsi\opsi.dll"
428 File "..\..\plugins\pcli\pcli.dll"
429 File "..\..\plugins\rdm\rdm.dll"
430 File "..\..\plugins\rlm\rlm.dll"
431 File "..\..\plugins\rtnet\rtnet.dll"
432 File "..\..\plugins\rudp\rudp.dll"
433 File "..\..\plugins\v5ua\v5ua.dll"
434 SectionEnd
435
436 Section "SNMP MIBs" SecMIBs
437 ;-------------------------------------------
438 !ifdef GTK1_DIR & GTK2_DIR
439 SectionIn 1 2
440 !endif
441 SetOutPath $INSTDIR\snmp\mibs
442 File "${NET_SNMP_DIR}\mibs\*.txt"
443 SectionEnd
444
445 ; SectionDivider
446 ;-------------------------------------------
447
448 Section "Start Menu Shortcuts" SecShortcuts
449 ;-------------------------------------------
450 !ifdef GTK1_DIR & GTK2_DIR
451 SectionIn 1 2
452 !endif
453 SetOutPath $PROFILE
454 CreateDirectory "$SMPROGRAMS\Ethereal"
455
456 Delete "$SMPROGRAMS\Ethereal\Ethereal Web Site.lnk"
457 WriteINIStr "$SMPROGRAMS\Ethereal\Ethereal Web Site.url" \
458           "InternetShortcut" "URL" "http://www.ethereal.com/"
459 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal.lnk" "$INSTDIR\ethereal.exe"
460 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal Manual.lnk" "$INSTDIR\ethereal.html"
461 CreateShortCut "$SMPROGRAMS\Ethereal\Display Filters Manual.lnk" "$INSTDIR\ethereal-filter.html"
462 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal Program Directory.lnk" \
463           "$INSTDIR"
464 CreateShortCut "$SMPROGRAMS\Ethereal\Uninstall Ethereal.lnk" "$INSTDIR\uninstall.exe"
465 SectionEnd
466
467 Section "Desktop Icon" SecDesktopIcon
468 ;-------------------------------------------
469 !ifdef GTK1_DIR & GTK2_DIR
470 SectionIn 1 2
471 !endif
472 CreateShortCut "$DESKTOP\Ethereal.lnk" "$INSTDIR\ethereal.exe"
473 SectionEnd
474
475 Section "Associate file extensions to Ethereal" SecFileExtensions
476 ;-------------------------------------------
477 !ifdef GTK1_DIR & GTK2_DIR
478 SectionIn 1 2
479 !endif
480 WriteRegStr HKCR ${ETHEREAL_ASSOC} "" "Ethereal file"
481 WriteRegStr HKCR "${ETHEREAL_ASSOC}\Shell\open\command" "" '"$INSTDIR\ethereal.exe" "%1"'
482 WriteRegStr HKCR "${ETHEREAL_ASSOC}\DefaultIcon" "" '"$INSTDIR\ethereal.exe",0'
483 push $R0
484         StrCpy $R0 ".5vw"
485         Call Associate
486         StrCpy $R0 ".acp"
487         Call Associate
488         StrCpy $R0 ".apc"
489         Call Associate
490         StrCpy $R0 ".atc"
491         Call Associate
492         StrCpy $R0 ".bfr"
493         Call Associate
494         StrCpy $R0 ".cap"
495         Call Associate
496         StrCpy $R0 ".enc"
497         Call Associate
498         StrCpy $R0 ".erf"
499         Call Associate
500         StrCpy $R0 ".fdc"
501         Call Associate
502         StrCpy $R0 ".pcap"
503         Call Associate
504         StrCpy $R0 ".pkt"
505         Call Associate
506         StrCpy $R0 ".snoop"
507         Call Associate
508         StrCpy $R0 ".syc"
509         Call Associate
510         StrCpy $R0 ".tpc"
511         Call Associate
512         StrCpy $R0 ".tr1"
513         Call Associate
514         StrCpy $R0 ".trace"
515         Call Associate
516         StrCpy $R0 ".trc"
517         Call Associate          
518         StrCpy $R0 ".wpc"
519         Call Associate
520         StrCpy $R0 ".wpz"
521         Call Associate
522 pop $R0
523 !insertmacro UpdateIcons
524 SectionEnd
525
526 Section "Uninstall"
527 ;-------------------------------------------
528
529 ;
530 ; UnInstall for every user
531 ;
532 SetShellVarContext all
533
534 Delete "$INSTDIR\tethereal.exe"
535 IfErrors 0 NoTetherealErrorMsg
536         MessageBox MB_OK "Please note: tethereal.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tethereal.exe removed
537         Abort "Please note: tethereal.exe could not be removed, it's probably in use! Abort uninstall process!"
538 NoTetherealErrorMsg:
539
540 Delete "$INSTDIR\ethereal.exe"
541 IfErrors 0 NoEtherealErrorMsg
542         MessageBox MB_OK "Please note: ethereal.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if ethereal.exe removed
543         Abort "Please note: ethereal.exe could not be removed, it's probably in use! Abort uninstall process!"
544 NoEtherealErrorMsg:
545
546 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal"
547 DeleteRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal
548
549 push $R0
550         StrCpy $R0 ".5vw"
551         Call un.unlink
552         StrCpy $R0 ".acp"
553         Call un.unlink
554         StrCpy $R0 ".apc"
555         Call un.unlink
556         StrCpy $R0 ".atc"
557         Call un.unlink
558         StrCpy $R0 ".bfr"
559         Call un.unlink
560         StrCpy $R0 ".cap"
561         Call un.unlink
562         StrCpy $R0 ".enc"
563         Call un.unlink
564         StrCpy $R0 ".erf"
565         Call un.unlink
566         StrCpy $R0 ".fdc"
567         Call un.unlink
568         StrCpy $R0 ".pcap"
569         Call un.unlink
570         StrCpy $R0 ".pkt"
571         Call un.unlink
572         StrCpy $R0 ".snoop"
573         Call un.unlink
574         StrCpy $R0 ".syc"
575         Call un.unlink
576         StrCpy $R0 ".tpc"
577         Call un.unlink
578         StrCpy $R0 ".tr1"
579         Call un.unlink
580         StrCpy $R0 ".trace"
581         Call un.unlink
582         StrCpy $R0 ".trc"
583         Call un.unlink          
584         StrCpy $R0 ".wpc"
585         Call un.unlink
586         StrCpy $R0 ".wpz"
587         Call un.unlink
588 pop $R0
589
590 DeleteRegKey HKCR ${ETHEREAL_ASSOC} 
591 DeleteRegKey HKCR "${ETHEREAL_ASSOC}\Shell\open\command"
592 DeleteRegKey HKCR "${ETHEREAL_ASSOC}\DefaultIcon"
593 !insertmacro UpdateIcons
594
595 ; regardless if we currently installed GTK1 or 2, try to uninstall GTK2 files too
596 Delete "$INSTDIR\etc\gtk-2.0\*.*"
597 Delete "$INSTDIR\etc\pango\*.*"
598 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
599 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
600 Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
601 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
602 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
603 Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
604 Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
605 Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
606 Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
607 Delete "$INSTDIR\help\*.*"
608 Delete "$INSTDIR\plugins\${VERSION}\*.*"
609 Delete "$INSTDIR\plugins\*.*"
610 Delete "$INSTDIR\diameter\*.*"
611 Delete "$INSTDIR\snmp\mibs\*.*"
612 Delete "$INSTDIR\snmp\*.*"
613 Delete "$INSTDIR\*.exe"
614 Delete "$INSTDIR\*.dll"
615 Delete "$INSTDIR\*.html"
616 Delete "$INSTDIR\COPYING"
617 Delete "$INSTDIR\AUTHORS-SHORT"
618 Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
619 Delete "$INSTDIR\README*"
620 Delete "$INSTDIR\FAQ"
621 Delete "$INSTDIR\NEWS.txt"
622 Delete "$INSTDIR\manuf"
623 Delete "$INSTDIR\pcrepattern.3.txt"
624 Delete "$SMPROGRAMS\Ethereal\*.*"
625 Delete "$DESKTOP\Ethereal.lnk"
626
627 RMDir "$INSTDIR\etc\gtk-2.0"
628 RMDir "$INSTDIR\etc\pango"
629 RMDir "$INSTDIR\etc"
630 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
631 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
632 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
633 RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
634 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
635 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
636 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
637 RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
638 RMDir "$INSTDIR\lib\gtk-2.0"
639 RMDir "$INSTDIR\lib\pango\1.2.0\modules"
640 RMDir "$INSTDIR\lib\pango\1.2.0"
641 RMDir "$INSTDIR\lib\pango\1.4.0\modules"
642 RMDir "$INSTDIR\lib\pango\1.4.0"
643 RMDir "$INSTDIR\lib\pango"
644 RMDir "$INSTDIR\lib"
645 RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
646 RMDir "$INSTDIR\share\themes\Default"
647 RMDir "$INSTDIR\share\themes"
648 RMDir "$INSTDIR\share"
649 RMDir "$SMPROGRAMS\Ethereal"
650 RMDir "$INSTDIR\help"
651 RMDir "$INSTDIR\plugins\${VERSION}"
652 RMDir "$INSTDIR\plugins"
653 RMDir "$INSTDIR\diameter"
654 RMDir "$INSTDIR\snmp\mibs"
655 RMDir "$INSTDIR\snmp"
656 RMDir "$INSTDIR"
657
658 IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
659     MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
660 NoFinalErrorMsg: 
661
662 SectionEnd
663
664 !ifdef MAKENSIS_MODERN_UI
665 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
666 !ifdef GTK1_DIR
667   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK1} "${PROGRAM_NAME} is a GUI network protocol analyzer."
668 !endif  
669 !ifdef GTK2_DIR  
670   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK2} "${PROGRAM_NAME} is a GUI network protocol analyzer (using the modern GTK2 GUI toolkit)."
671 !ifdef GTK_WIMP_DIR
672   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTKWimp} "GTKWimp is the GTK2 windows impersonator (native Win32 look and feel)."
673 !endif  
674 !endif
675   !insertmacro MUI_DESCRIPTION_TEXT ${SecTethereal} "Tethereal is a network protocol analyzer."
676   !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."
677   !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."
678   !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Mergecap is a program that combines multiple saved capture files into a single output file."
679   !insertmacro MUI_DESCRIPTION_TEXT ${SecCapinfo} "Capinfo is a program that provides information on capture files."
680   !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections."
681   !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
682   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Start menu shortcuts."
683   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} "Ethereal desktop icon."
684   !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExtensions} "Associate standard network trace files to ${PROGRAM_NAME}"  
685 !insertmacro MUI_FUNCTION_DESCRIPTION_END
686 !endif ; MAKENSIS_MODERN_UI
687
688 ; ============================================================================
689 ; Callback functions
690 ; ============================================================================
691 !ifdef GTK1_DIR & GTK2_DIR
692 ;Disable GTK-Wimp for GTK1
693 Function .onSelChange
694         Push $0
695         SectionGetFlags ${SecEtherealGTK1} $0
696         IntOp  $0 $0 & 1
697         IntCmp $0 1 onSelChange.disableGTK2Sections
698         ;enable GTK2Sections
699         !insertmacro EnableSection ${SecGTKWimp}
700         Goto onSelChange.end
701 onSelChange.disableGTK2Sections:
702         !insertmacro DisableSection ${SecGTKWimp}
703         Goto onSelChange.end
704 onSelChange.end:
705         Pop $0
706 FunctionEnd     
707
708 !else
709 !ifdef GTK1_DIR | GTK2_DIR
710 ; Disable FileExtension if Ethereal isn't selected
711 Function .onSelChange
712         Push $0
713 !ifdef GTK1_DIR
714         SectionGetFlags ${SecEtherealGTK1} $0
715         IntOp  $0 $0 & 1
716         IntCmp $0 0 onSelChange.unselect
717         SectionGetFlags ${SecFileExtensions} $0
718         IntOp  $0 $0 & 16
719         IntCmp $0 16 onSelChange.unreadonly
720         Goto onSelChange.end
721 !else
722         SectionGetFlags ${SecEtherealGTK2} $0
723         IntOp  $0 $0 & 1
724         IntCmp $0 0 onSelChange.unselect
725         SectionGetFlags ${SecFileExtensions} $0
726         IntOp  $0 $0 & 16
727         IntCmp $0 16 onSelChange.unreadonly
728         Goto onSelChange.end    
729 !endif
730 onSelChange.unselect:   
731         SectionGetFlags ${SecFileExtensions} $0
732         IntOp $0 $0 & 0xFFFFFFFE
733         IntOp $0 $0 | 0x10
734         SectionSetFlags ${SecFileExtensions} $0
735         Goto onSelChange.end
736 onSelChange.unreadonly:
737         SectionGetFlags ${SecFileExtensions} $0
738         IntOp $0 $0 & 0xFFFFFFEF
739         SectionSetFlags ${SecFileExtensions} $0
740         Goto onSelChange.end
741 onSelChange.end:
742         Pop $0
743 FunctionEnd
744 !endif
745 !endif