ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: ASN1.DLL linked against GTK2 forces crash. was: Re: [Ethereal-dev] New pre-

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Lars Roland <lars.roland@xxxxxxx>
Date: Fri, 27 Aug 2004 00:00:52 +0200
Hello all,

Guy Harris wrote:
Lars Roland said:

So do we have to link the asn1 plugin with GTK?


We don't do so on UN*X, so presumably we don't need to do so on Windows.

See the other Makefile.nmake files in subdirectories of "plugins" - they
just use GLIB_CFLAGS and GLIB_LIBS.


We, Ulf and me, patched makefile.nmake of the asn.1 plugin more than one time to make it work with GTK because we assumed that the GTK dependency was still there, but indeed it was fixed in Revision 8877.
:(

Patches attached for asn1 makefile and nsis installer script and makefile:

- ASN1 Plugin not linked with GTK on windows anymore by default
- NSIS Installer disables GTK-Wimp for GTK1
- "News" file added to installer
- optionally show the "News" file at the end of an installation

Regards,
Lars
Index: ethereal-new/plugins/asn1/Makefile.nmake
===================================================================
--- ethereal-new/plugins/asn1/Makefile.nmake	(revision 11834)
+++ ethereal-new/plugins/asn1/Makefile.nmake	(working copy)
@@ -6,24 +6,14 @@
 
 ############### no need to modify below this line #########
 
-# XXX: that's odd here, no GTK stuff should be in the plugins dir,
-# so move all GTK specific stuff into gtk dir.
-# As GTK1_CFLAGS isn't correct here, we don't have GTK_CFLAGS
-# any longer, so no better choice here. If the move of GTK code 
-# finished, replace this with GLIB_CFLAGS.
-# The same applies to GTK1_LIBS -> GLIB_LIBS.
-CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GTK1_CFLAGS) \
+CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
 OBJECTS=packet-asn1.obj 
 
 asn1.dll asn1.exp asn1.lib : $(OBJECTS) ..\plugin_api.obj
 	link -dll /out:asn1.dll $(OBJECTS) ..\plugin_api.obj \
-!IFDEF GTK1_DIR
-	$(GTK1_LIBS)
-!ELSE
-	$(GTK2_LIBS)
-!ENDIF
+	$(GLIB_LIBS)
 
 clean:
 	rm -f $(OBJECTS) asn1.dll asn1.exp asn1.lib $(PDB_FILE)
Index: ethereal-new/packaging/nsis/ethereal.nsi
===================================================================
--- ethereal-new/packaging/nsis/ethereal.nsi	(revision 11834)
+++ ethereal-new/packaging/nsis/ethereal.nsi	(working copy)
@@ -70,8 +70,9 @@
 ; the file's extension. "README.win32" won't work in most cases, because extension "win32" 
 ; is usually not associated with an appropriate text editor. We should use extension "txt" 
 ; for a text file or "html" for an html README file.  
-;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\help\overview.txt"
-;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
+!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NEWS.txt"
+!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show News"
+!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
 
 ; ============================================================================
 ; MUI Pages
@@ -98,6 +99,36 @@
 !endif ; MAKENSIS_MODERN_UI
 
 ; ============================================================================
+; Section macros
+; ============================================================================
+!include "Sections.nsh"
+
+; ========= Macro to unselect and disable a section =========
+
+!macro DisableSection SECTION
+
+  Push $0
+    SectionGetFlags "${SECTION}" $0
+    IntOp $0 $0 & ${SECTION_OFF}
+    IntOp $0 $0 | ${SF_RO}
+    SectionSetFlags "${SECTION}" $0
+  Pop $0
+
+!macroend
+
+; ========= Macro to enable (unreadonly) a section =========
+!define SECTION_ENABLE   0xFFFFFFEF
+!macro EnableSection SECTION
+
+  Push $0
+    SectionGetFlags "${SECTION}" $0
+    IntOp $0 $0 & ${SECTION_ENABLE}
+    SectionSetFlags "${SECTION}" $0
+  Pop $0
+
+!macroend
+
+; ============================================================================
 ; License page configuration
 ; ============================================================================
 LicenseText "Ethereal is distributed under the GNU General Public License."
@@ -232,6 +263,7 @@
 File "..\..\README.win32"
 File "..\..\AUTHORS-SHORT"
 File "..\..\COPYING"
+File /oname=NEWS.txt "..\..\NEWS"
 File "..\..\manuf"
 File "..\..\doc\ethereal.html"
 File "..\..\doc\ethereal-filter.html"
@@ -308,10 +340,8 @@
 File "${GTK2_DIR}\lib\gtk-2.0\${GTK2_INST_VERSION}.0\immodules\im-*.dll"
 SetOutPath $INSTDIR\lib\pango\${PANGO_INST_VERSION}.0\modules
 File "${GTK2_DIR}\lib\pango\${PANGO_INST_VERSION}.0\modules\pango-*.dll"
-
 SectionEnd
-!endif
-
+ 
 !ifdef GTK_WIMP_DIR
 Section "GTK-Wimp" SecGTKWimp
 ;-------------------------------------------
@@ -319,9 +349,9 @@
 File "${GTK_WIMP_DIR}\libwimp.dll"
 SetOutPath $INSTDIR\share\themes\Default\gtk-2.0
 File "${GTK_WIMP_DIR}\Theme\gtk-2.0\gtkrc"
-
 SectionEnd
 !endif
+!endif
 
 Section "Tethereal" SecTethereal
 ;-------------------------------------------
@@ -586,6 +616,7 @@
 Delete "$INSTDIR\AUTHORS-SHORT"
 Delete "$INSTDIR\README*"
 Delete "$INSTDIR\FAQ"
+Delete "$INSTDIR\NEWS.txt"
 Delete "$INSTDIR\manuf"
 Delete "$INSTDIR\pcrepattern.3.txt"
 Delete "$SMPROGRAMS\Ethereal\*.*"
@@ -628,18 +659,17 @@
 
 SectionEnd
 
-
 !ifdef MAKENSIS_MODERN_UI
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 !ifdef GTK1_DIR
   !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK1} "${PROGRAM_NAME} is a GUI network protocol analyzer."
 !endif  
 !ifdef GTK2_DIR  
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK2} "${PROGRAM_NAME} is a GUI network protocol analyzer (using the modern GTK2 GUI toolkit)."
-!endif  
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecEtherealGTK2} "${PROGRAM_NAME} is a GUI network protocol analyzer (using the modern GTK2 GUI toolkit)."
 !ifdef GTK_WIMP_DIR
   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTKWimp} "GTKWimp is the GTK2 windows impersonator (native Win32 look and feel)."
 !endif  
+!endif
   !insertmacro MUI_DESCRIPTION_TEXT ${SecTethereal} "Tethereal is a network protocol analyzer."
   !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."
   !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."
@@ -656,10 +686,26 @@
 ; ============================================================================
 ; Callback functions
 ; ============================================================================
-; We simulate the XOR operator
 !ifdef GTK1_DIR & GTK2_DIR
+;Disable GTK-Wimp for GTK1
+Function .onSelChange
+	Push $0
+	SectionGetFlags ${SecEtherealGTK1} $0
+	IntOp  $0 $0 & 1
+	IntCmp $0 1 onSelChange.disableGTK2Sections
+	;enable GTK2Sections
+	!insertmacro EnableSection ${SecGTKWimp}
+	Goto onSelChange.end
+onSelChange.disableGTK2Sections:
+	!insertmacro DisableSection ${SecGTKWimp}
+	Goto onSelChange.end
+onSelChange.end:
+	Pop $0
+FunctionEnd	
+
 !else
 !ifdef GTK1_DIR | GTK2_DIR
+; Disable FileExtension if Ethereal isn't selected
 Function .onSelChange
 	Push $0
 !ifdef GTK1_DIR
Index: ethereal-new/packaging/nsis/Makefile.nmake
===================================================================
--- ethereal-new/packaging/nsis/Makefile.nmake	(revision 11834)
+++ ethereal-new/packaging/nsis/Makefile.nmake	(working copy)
@@ -50,6 +50,7 @@
 	../../doc/mergecap.html 	\
 	../../doc/capinfo.html 	\
 	../../FAQ			\
+	../../NEWS			\
 	../../README			\
 	../../README.win32
 GPL=../../COPYING