diff options
author | Gerald Combs <gerald@wireshark.org> | 2007-09-15 00:18:17 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2007-09-15 00:18:17 +0000 |
commit | d2d4fcd903f3c675d85a4d32bff280f4a5bc8e6e (patch) | |
tree | 88cf3b0551436062acb26b33f60dd27417944d81 /epan/privileges.c | |
parent | d0c2725672061a344852cc3f7473e36826522638 (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 'epan/privileges.c')
-rw-r--r-- | epan/privileges.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/epan/privileges.c b/epan/privileges.c index 54b294522e..a44bc69c44 100644 --- a/epan/privileges.c +++ b/epan/privileges.c @@ -32,6 +32,9 @@ #ifdef _WIN32 #include "emem.h" +#include <windows.h> +#include <wchar.h> +#include <tchar.h> /* * Called when the program starts, to save whatever credential information @@ -40,6 +43,7 @@ void get_credential_info(void) { +npf_sys_is_running(); } /* @@ -94,6 +98,30 @@ get_cur_groupname(void) { return groupname; } +/* + * If npf.sys is running, return TRUE. + */ +gboolean +npf_sys_is_running() { + SC_HANDLE h_scm, h_serv; + SERVICE_STATUS ss; + + h_scm = OpenSCManager(NULL, NULL, 0); + if (!h_scm) + return FALSE; + + h_serv = OpenService(h_scm, _T("npf"), SC_MANAGER_CONNECT|SERVICE_QUERY_STATUS); + if (!h_serv) + return FALSE; + + if (QueryServiceStatus(h_serv, &ss)) { + if (ss.dwCurrentState & SERVICE_RUNNING) + return TRUE; + } + return FALSE; +} + + #else /* _WIN32 */ #ifdef HAVE_SYS_TYPES_H @@ -242,3 +270,16 @@ get_cur_groupname(void) { } #endif /* _WIN32 */ + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: tabs + * End: + * + * ex: set shiftwidth=8 tabstop=8 noexpandtab + * :indentSize=8:tabSize=8:noTabs=false: + */ |