On Windows, if we can't open a capture device, check whether WinPcap is
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Dec 2011 21:59:24 +0000 (21:59 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Dec 2011 21:59:24 +0000 (21:59 +0000)
loaded and, if not, report that as the problem, rather than suggesting
that you didn't specify the proper interface.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40332 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c

index f0ddbac65816ed27864828e77f98375b699dc71d..467a517b599dce4336aff8456ea7cedfd692df97 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
 #include "version_info.h"
 
 #include "capture-pcap-util.h"
+#ifdef _WIN32
+#include "capture-wpcap.h"
+#include "capture_errs.h"
+#endif /* _WIN32 */
 
 #include "pcapio.h"
 
@@ -676,21 +680,31 @@ get_capture_device_open_failure_messages(const char *open_err_str,
         libpcap_warn = "";
     g_snprintf(errmsg, (gulong) errmsg_len,
                "The capture session could not be initiated (%s).", open_err_str);
-#ifndef _WIN32
+#ifdef _WIN32
+    if (!has_wpcap) {
+      char *detailed_err;
+
+      detailed_err = cant_load_winpcap_err("TShark");
+      g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len,
+                 "\n",
+                 "%s\n", detailed_err);
+      g_free(detailed_err);
+    } else {
+      g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len,
+                 "\n"
+                 "Please check that \"%s\" is the proper interface.\n"
+                 "\n"
+                 "\n"
+                 "Help can be found at:\n"
+                 "\n"
+                 "       http://wiki.wireshark.org/WinPcap\n"
+                 "       http://wiki.wireshark.org/CaptureSetup\n",
+                 iface);
+    }
+#else
     g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len,
                "Please check to make sure you have sufficient permissions, and that you have "
                "the proper interface or pipe specified.%s", libpcap_warn);
-#else
-    g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len,
-               "\n"
-               "Please check that \"%s\" is the proper interface.\n"
-               "\n"
-               "\n"
-               "Help can be found at:\n"
-               "\n"
-               "       http://wiki.wireshark.org/WinPcap\n"
-               "       http://wiki.wireshark.org/CaptureSetup\n",
-               iface);
 #endif /* _WIN32 */
 }