aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-01-15 16:01:54 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-01-15 16:01:54 +0000
commitdaedf0142c5abaeb771134a3a81cc8cb9d1c00ec (patch)
tree08496e22000d2b1541922c7965ac58f5c9c804d7 /gtk
parent880254937e7c01af93950f460c992e962bd56bef (diff)
Recently the capture interface name was added to the title of the capture info dialog.
On WIN32, this interface name is in a somehwat unreadable format "\Device\NPF_{242423...", display the interface description on win32 systems instead "Realtek RTL ..." svn path=/trunk/; revision=13048
Diffstat (limited to 'gtk')
-rw-r--r--gtk/capture_info_dlg.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gtk/capture_info_dlg.c b/gtk/capture_info_dlg.c
index 8738c5b9a5..fba382fb0a 100644
--- a/gtk/capture_info_dlg.c
+++ b/gtk/capture_info_dlg.c
@@ -41,6 +41,7 @@
#include "dlg_utils.h"
#include "ui_util.h"
#include "main.h"
+#include "pcap-util.h"
/* a single capture counter value (with title, pointer to value and GtkWidgets) */
/* as the packet_counts is a struct, not an array, keep a pointer to the */
@@ -88,6 +89,13 @@ gchar *iface)
capture_info_ui_t *info;
gchar *cap_w_title;
gchar *title_iface;
+#ifdef _WIN32
+ GList *if_list;
+ GList *if_entry;
+ int err;
+ char err_buf[PCAP_ERRBUF_SIZE];
+ if_info_t *if_info;
+#endif
info = g_malloc0(sizeof(capture_info_ui_t));
info->counts[0].title = "Total";
@@ -115,13 +123,39 @@ gchar *iface)
info->counts[11].title = "Other";
info->counts[11].value_ptr = &(cinfo->counts->other);
+#ifdef _WIN32
+ /* on win32 (at least Win2k and XP),
+ * the interface name is something like "\Device\NPF_{242423..."
+ * which is pretty useless to the normal user. Try to convert to a somewhat
+ * more readable format to show in the capture info dialog title. */
+ if_list = get_interface_list(&err, err_buf);
+ if (if_list != NULL) {
+ if_entry = if_list;
+ do {
+ if_info = if_entry->data;
+ if (strcmp(if_info->name, iface) == 0) {
+ iface = if_info->description;
+ break;
+ }
+ } while ((if_entry = g_list_next(if_entry)) != NULL);
+ }
+#endif
+
+ title_iface = g_strdup_printf("Ethereal: Capture from %s", iface);
+
/* use user-defined title if preference is set */
- title_iface = g_strdup_printf("Ethereal: Capture - Interface %s", iface);
cap_w_title = create_user_window_title(title_iface);
info->cap_w = dlg_window_new(cap_w_title);
g_free(title_iface);
g_free(cap_w_title);
+#ifdef _WIN32
+ if(if_list != NULL) {
+ /* this indirectly frees up the space iface points to, so do it after last
+ * usage of iface */
+ free_interface_list(if_list);
+ }
+#endif
gtk_window_set_modal(GTK_WINDOW(info->cap_w), TRUE);