For interfaces that don't support PacketOpenAdapter (such as TurboCap),

disable the "Details" button in the interface list. Update an error
dialog to try to be more helpful.

svn path=/trunk/; revision=28675
This commit is contained in:
Gerald Combs 2009-06-09 20:08:47 +00:00
parent 0db429e50c
commit caa884723c
5 changed files with 48 additions and 4 deletions

View File

@ -319,3 +319,16 @@ wpcap_packet_load(void)
}
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: tabs
* End:
*
* ex: set shiftwidth=4 tabstop=4 noexpandtab
* :indentSize=4:tabSize=4:noTabs=false:
*/

View File

@ -715,7 +715,7 @@ airpcap_if_is_any(airpcap_if_info_t* if_info)
void
airpcap_update_channel_combo(GtkWidget* channel_cb, airpcap_if_info_t* if_info)
{
if(!if_info || airpcap_if_is_any(if_info))
if(!if_info || airpcap_if_is_any(if_info) || !airpcap_if_selected)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(channel_cb), -1);
change_airpcap_settings = FALSE;

View File

@ -2330,9 +2330,15 @@ capture_if_details_open_win(char *iface)
/* open the network adapter */
adapter = wpcap_packet_open(iface);
if(adapter == NULL) {
/*
* We have an adapter that is not exposed through normal APIs (e.g. TurboCap)
* or an adapter that isn't plugged in.
*
* XXX - We should use the TurboCap API to get info about TurboCap adapters.
*/
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%sCould not open adapter: %s!%s"
"\n\nThe adapter might be removed from the system in the meantime!",
"%sCould not open adapter %s!%s"
"\n\nHas it been unplugged?",
simple_dialog_primary_start(), iface, simple_dialog_primary_end());
return;
}
@ -2496,5 +2502,21 @@ capture_if_details_open(char *iface)
}
}
gboolean
capture_if_has_details(char *iface) {
LPADAPTER adapter;
if (!iface) {
return FALSE;
}
adapter = wpcap_packet_open(iface);
if (adapter) {
wpcap_packet_close(adapter);
return TRUE;
}
return FALSE;
}
#endif /* HAVE_LIBPCAP && _WIN32 */

View File

@ -33,3 +33,8 @@
*/
extern void capture_if_details_open(char *iface);
/** See if we have a detail-able interface.
*
* @param iface the interface name to test
*/
extern gboolean capture_if_has_details(char *iface);

View File

@ -774,10 +774,14 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
/* details button */
#ifdef _WIN32
if_dlg_data->details_bt = gtk_button_new_from_stock(WIRESHARK_STOCK_CAPTURE_DETAILS);
g_signal_connect(if_dlg_data->details_bt, "clicked", G_CALLBACK(capture_details_cb), if_dlg_data);
gtk_tooltips_set_tip(tooltips, if_dlg_data->details_bt,
"Open the capture details dialog of this interface.", NULL);
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->details_bt, 8, 9, row, row+1);
if (capture_if_has_details(if_dlg_data->device)) {
g_signal_connect(if_dlg_data->details_bt, "clicked", G_CALLBACK(capture_details_cb), if_dlg_data);
} else {
gtk_widget_set_sensitive(if_dlg_data->details_bt, FALSE);
}
#endif
if_data = g_list_append(if_data, if_dlg_data);