#include <glib.h>
#include <gmodule.h>
+#include <epan/strutil.h>
+
#include "capture_ifinfo.h"
#include "capture-pcap-util.h"
#include "capture-pcap-util-int.h"
+#include "capture-wpcap.h"
#include <wsutil/file_util.h>
has_wpcap = TRUE;
}
+/*
+ * The official list of WinPcap mirrors is at
+ * http://www.winpcap.org/misc/mirrors.htm
+ */
+char *
+cant_load_winpcap_err(const char *app_name)
+{
+ return g_strdup_printf(
+"Unable to load WinPcap (wpcap.dll); %s will not be able to capture\n"
+"packets.\n"
+"\n"
+"In order to capture packets, WinPcap must be installed; see\n"
+"\n"
+" http://www.winpcap.org/\n"
+"\n"
+"or the mirror at\n"
+"\n"
+" http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
+"\n"
+"or the mirror at\n"
+"\n"
+" http://winpcap.cs.pu.edu.tw/\n"
+"\n"
+"for a downloadable version of WinPcap and for instructions on how to install\n"
+"WinPcap.",
+ app_name);
+}
+
char*
pcap_lookupdev (char *a)
{
pcap_open_live(const char *a, int b, int c, int d, char *e)
{
if (!has_wpcap) {
+ g_snprintf(e, PCAP_ERRBUF_SIZE,
+ "unable to load WinPcap (wpcap.dll); can't open %s to capture",
+ a);
return NULL;
}
return p_pcap_open_live(a, b, c, d, e);
pcap_open(const char *a, int b, int c, int d, struct pcap_rmtauth *e, char *f)
{
if (!has_wpcap) {
+ g_snprintf(f, PCAP_ERRBUF_SIZE,
+ "unable to load WinPcap (wpcap.dll); can't open %s to capture",
+ a);
return NULL;
}
return p_pcap_open(a, b, c, d, e, f);
int i, j;
char errbuf[PCAP_ERRBUF_SIZE];
+ if (!has_wpcap) {
+ /*
+ * We don't have WinPcap, so we can't get a list of
+ * interfaces.
+ */
+ *err = DONT_HAVE_PCAP;
+ *err_str = cant_load_winpcap_err("you");
+ return NULL;
+ }
+
#ifdef HAVE_PCAP_FINDALLDEVS
if (p_pcap_findalldevs != NULL)
return get_interface_list_findalldevs(err, err_str);
void
get_compiled_pcap_version(GString *str)
{
- g_string_append(str, "with WinPcap (version unknown)");
+ g_string_append(str, "with WinPcap (" STRINGIFY(PCAP_VERSION) ")");
}
/*