Behave more gracefully if WinPcap isn't installed. Don't assert if
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 15 Dec 2009 19:29:21 +0000 (19:29 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 15 Dec 2009 19:29:21 +0000 (19:29 +0000)
we call pcap_open or pcap_open_live when WinPcap isn't loaded - just
return NULL. Don't display the "NPF driver isn't running" dialog if
we're capturing from stdin or a file.

Fix a cut-and-paste error in capture_pcap_linktype_list.

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

capture-wpcap.c
capture.c
gtk/main.c

index 1c925e2bfee364794eacdbf4f1fdd104a26b7bbe..584e989cdf8fc505498a839265c6f59ea0a98f1a 100644 (file)
@@ -295,15 +295,19 @@ pcap_lookupnet(const char *a, bpf_u_int32 *b, bpf_u_int32 *c, char *d)
 pcap_t*
 pcap_open_live(const char *a, int b, int c, int d, char *e)
 {
-       g_assert(has_wpcap);
-       return p_pcap_open_live(a, b, c, d, e);
+    if (!has_wpcap) {
+       return NULL;
+    }
+    return p_pcap_open_live(a, b, c, d, e);
 }
 
 #ifdef HAVE_PCAP_REMOTE
 pcap_t*
 pcap_open(const char *a, int b, int c, int d, struct pcap_rmtauth *e, char *f)
 {
-    g_assert(has_wpcap);
+    if (!has_wpcap) {
+       return NULL;
+    }
     return p_pcap_open(a, b, c, d, e, f);
 }
 
index c2352867f62269f145256f4588f19151278db9fc..493f626eac1bc24875ea370ba198458474682210 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -759,12 +759,12 @@ capture_pcap_linktype_list(const gchar *ifname, char **err_str)
     gchar    **raw_list, **lt_parts;
     data_link_info_t *data_link_info;
 
-    g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List ...");
+    g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Linktype List ...");
 
     /* Try to get our interface list */
     err = sync_linktype_list_open(ifname, &msg);
     if (err != 0) {
-        g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed!");
+        g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Linktype List failed!");
         if (err_str) {
             *err_str = msg;
         } else {
index a0f97057eecdacf31d62e231eba92a74750d936a..2a0d98daccf0e53af5d68ad98b7a68fc0abaa247 100644 (file)
@@ -2665,7 +2665,7 @@ main(int argc, char *argv[])
 
 #ifdef _WIN32
   /* Warn the user if npf.sys isn't loaded. */
-  if (!npf_sys_is_running() && recent.privs_warn_if_no_npf && get_os_major_version() >= 6) {
+  if (!stdin_capture && !cf_name && !npf_sys_is_running() && recent.privs_warn_if_no_npf && get_os_major_version() >= 6) {
     priv_warning_dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
       "The NPF driver isn't running.  You may have trouble\n"
       "capturing or listing interfaces.");