ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Patch to airpcap_loader that produces a modal dialog with ga

From: "Peter Johansson" <peterjohansson73@xxxxxxxxx>
Date: Fri, 30 Mar 2007 08:16:51 +0200


2007/3/29, Peter Johansson <peterjohansson73@xxxxxxxxx>:
I compiled Wireshark with HAVE_AIRPDCAP by mistake (since I do not have AirPcap). This leads to a runtime problem however. When choosing "options" from the "Capture interfaces" dialog, I receive a modal dialogue with an OK button with a textual description that is only garbage (uninitialized memory).

The provided patch adds a new error - AIRPCAP_NOT_LOADED (2) code to the airpcap loader that also adds the text "AirPcap was expected to be loaded but is not" to the modal dialogue instead of the uninitialized string.

Regards, Peter



Repost to include a missing file in the previous mail.
 
/ Regards, Peter
Index: C:/wireshark-win32-libs/airpcap_loader.h
===================================================================
--- C:/wireshark-win32-libs/airpcap_loader.h	(revision 21269)
+++ C:/wireshark-win32-libs/airpcap_loader.h	(working copy)
@@ -33,6 +33,7 @@
 /* Error values from "get_airpcap_interface_list()". */
 #define	CANT_GET_AIRPCAP_INTERFACE_LIST	0	/* error getting list */
 #define	NO_AIRPCAP_INTERFACES_FOUND	1	/* list is empty */
+#define	AIRPCAP_NOT_LOADED	2	/* AirPcap not loaded */
 
 #define AIRPCAP_CHANNEL_ANY_NAME "ANY"
 
Index: C:/wireshark-win32-libs/airpcap_loader.c
===================================================================
--- C:/wireshark-win32-libs/airpcap_loader.c	(revision 21269)
+++ C:/wireshark-win32-libs/airpcap_loader.c	(working copy)
@@ -1138,7 +1138,11 @@
     char errbuf[PCAP_ERRBUF_SIZE];
 
     if (!AirpcapLoaded)
-	return il;
+    {
+        *err = AIRPCAP_NOT_LOADED;
+        *err_str = "AirPcap was expected to be loaded but is not";
+        return il;
+    }
 
     if (!g_PAirpcapGetDeviceList(&devsList, errbuf))
     {
Index: C:/wireshark-win32-libs/gtk/capture_dlg.c
===================================================================
--- C:/wireshark-win32-libs/gtk/capture_dlg.c	(revision 21279)
+++ C:/wireshark-win32-libs/gtk/capture_dlg.c	(working copy)
@@ -639,7 +639,9 @@
   decryption_cm = OBJECT_GET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_DECRYPTION_KEY);
   update_decryption_mode_list(decryption_cm);
 
-  if (airpcap_if_list == NULL && err == CANT_GET_AIRPCAP_INTERFACE_LIST) {
+  if (airpcap_if_list == NULL &&
+      (err == CANT_GET_AIRPCAP_INTERFACE_LIST ||
+       err == AIRPCAP_NOT_LOADED)) {
     simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_str);
     g_free(err_str);
   }