aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2007-09-15 00:18:17 +0000
committerGerald Combs <gerald@wireshark.org>2007-09-15 00:18:17 +0000
commitd2d4fcd903f3c675d85a4d32bff280f4a5bc8e6e (patch)
tree88cf3b0551436062acb26b33f60dd27417944d81 /gtk
parentd0c2725672061a344852cc3f7473e36826522638 (diff)
Add routines under Windows to check if npf.sys is running, and to
fetch the major OS version. If we're running Windows >= 6 (Vista) _and_ npf.sys isn't running, warn the user in Wireshark and TShark. Add a recent prefs item to disable the warning in Wireshark. svn path=/trunk/; revision=22877
Diffstat (limited to 'gtk')
-rw-r--r--gtk/main.c19
-rw-r--r--gtk/recent.c14
-rw-r--r--gtk/recent.h1
3 files changed, 34 insertions, 0 deletions
diff --git a/gtk/main.c b/gtk/main.c
index 0ce7c9b9a9..3bd7dfbbdf 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1475,6 +1475,14 @@ priv_warning_dialog_cb(gpointer dialog, gint btn _U_, gpointer data _U_)
recent.privs_warn_if_elevated = !simple_dialog_check_get(dialog);
}
+#ifdef _WIN32
+static void
+npf_warning_dialog_cb(gpointer dialog, gint btn _U_, gpointer data _U_)
+{
+ recent.privs_warn_if_no_npf = !simple_dialog_check_get(dialog);
+}
+#endif
+
static void
main_cf_cb_file_closing(capture_file *cf)
{
@@ -2935,6 +2943,17 @@ main(int argc, char *argv[])
simple_dialog_set_cb(priv_warning_dialog, priv_warning_dialog_cb, NULL);
}
+#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) {
+ 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.");
+ simple_dialog_check_set(priv_warning_dialog, "Don't show this message again.");
+ simple_dialog_set_cb(priv_warning_dialog, npf_warning_dialog_cb, NULL);
+ }
+#endif
+
/* If we were given the name of a capture file, read it in now;
we defer it until now, so that, if we can't open it, and pop
up an alert box, the alert box is more likely to come up on
diff --git a/gtk/recent.c b/gtk/recent.c
index 7b78d11294..361cd2807a 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -72,6 +72,7 @@
#define RECENT_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen_remembered_dir"
#define RECENT_GUI_GEOMETRY "gui.geom."
#define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated"
+#define RECENT_KEY_PRIVS_WARN_IF_NO_NPF "privs.warn_if_no_npf"
#define RECENT_FILE_NAME "recent"
@@ -264,6 +265,11 @@ write_recent(void)
fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_ELEVATED ": %s\n",
recent.privs_warn_if_elevated == TRUE ? "TRUE" : "FALSE");
+ fprintf(rf, "\n# Warn if npf.sys isn't loaded on Windows >= 6.0.\n");
+ fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_NO_NPF ": %s\n",
+ recent.privs_warn_if_no_npf == TRUE ? "TRUE" : "FALSE");
+
if (get_last_open_dir() != NULL) {
fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
@@ -465,6 +471,13 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_)
else {
recent.privs_warn_if_elevated = FALSE;
}
+ } else if (strcmp(key, RECENT_KEY_PRIVS_WARN_IF_NO_NPF) == 0) {
+ if (strcasecmp(value, "true") == 0) {
+ recent.privs_warn_if_no_npf = TRUE;
+ }
+ else {
+ recent.privs_warn_if_no_npf = FALSE;
+ }
}
return PREFS_SET_OK;
@@ -578,6 +591,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
#endif
recent.privs_warn_if_elevated = TRUE;
+ recent.privs_warn_if_no_npf = TRUE;
/* Construct the pathname of the user's recent file. */
rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
diff --git a/gtk/recent.h b/gtk/recent.h
index a5dc1937e1..0a2fa6c0bb 100644
--- a/gtk/recent.h
+++ b/gtk/recent.h
@@ -68,6 +68,7 @@ typedef struct recent_settings_tag {
gboolean has_gui_geometry_status_pane; /* gui_geometry_status_pane is valid */
gint gui_geometry_status_pane; /* this is autodetected in GTK2 only */
gboolean privs_warn_if_elevated;
+ gboolean privs_warn_if_no_npf;
} recent_settings_t;
/** Global recent settings. */