diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-12-29 21:59:24 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-12-29 21:59:24 +0000 |
commit | 71c7f43d37c0c1e47fefa978e0f03643ae607e93 (patch) | |
tree | c0095c0f29e779f1a28a3a6c520e83bf41f6579d /dumpcap.c | |
parent | aefe0984672b6c5aeb7a9b4a2d13929c12456c42 (diff) |
On Windows, if we can't open a capture device, check whether WinPcap is
loaded and, if not, report that as the problem, rather than suggesting
that you didn't specify the proper interface.
svn path=/trunk/; revision=40332
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 38 |
1 files changed, 26 insertions, 12 deletions
@@ -79,6 +79,10 @@ #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 */ } |