Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

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

From: "Peter Johansson" <peterjohansson73@xxxxxxxxx>
Date: Thu, 29 Mar 2007 12:06:37 +0200
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

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))
     {