Move get_os_major_version() to wsutil and rename it to get_windows_major_version().
It's Windows-specific, so name it appropriately. Change-Id: Ic518cbfabebf95757f6b308a4d547a6cabed6a5e Reviewed-on: https://code.wireshark.org/review/2528 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
3c979e63a7
commit
a70dea1956
3
tshark.c
3
tshark.c
|
@ -66,6 +66,7 @@
|
|||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/report_err.h>
|
||||
#include <wsutil/copyright_info.h>
|
||||
#include <wsutil/os_version_info.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include <epan/timestamp.h>
|
||||
|
@ -895,7 +896,7 @@ check_capture_privs(void) {
|
|||
#ifdef _WIN32
|
||||
load_wpcap();
|
||||
/* Warn the user if npf.sys isn't loaded. */
|
||||
if (!npf_sys_is_running() && get_os_major_version() >= 6) {
|
||||
if (!npf_sys_is_running() && get_windows_major_version() >= 6) {
|
||||
fprintf(stderr, "The NPF driver isn't running. You may have trouble "
|
||||
"capturing or\nlisting interfaces.\n");
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include <wsutil/report_err.h>
|
||||
#include <wsutil/u3.h>
|
||||
#include <wsutil/copyright_info.h>
|
||||
#include <wsutil/os_version_info.h>
|
||||
|
||||
#include <wiretap/merge.h>
|
||||
|
||||
|
@ -2100,7 +2101,7 @@ check_and_warn_user_startup(gchar *cf_name _U_)
|
|||
|
||||
#ifdef _WIN32
|
||||
/* Warn the user if npf.sys isn't loaded. */
|
||||
if (!get_stdin_capture() && !cf_name && !npf_sys_is_running() && recent.privs_warn_if_no_npf && get_os_major_version() >= 6) {
|
||||
if (!get_stdin_capture() && !cf_name && !npf_sys_is_running() && recent.privs_warn_if_no_npf && get_windows_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.");
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
|
||||
#include "version.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCAP
|
||||
# include <sys/capability.h>
|
||||
#endif
|
||||
|
@ -219,23 +215,6 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
|
|||
end_string(str);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* Get the major OS version.
|
||||
*/
|
||||
/* XXX - Should this return the minor version as well, e.g. 0x00050002? */
|
||||
guint32
|
||||
get_os_major_version()
|
||||
{
|
||||
OSVERSIONINFO info;
|
||||
info.dwOSVersionInfoSize = sizeof info;
|
||||
if (GetVersionEx(&info)) {
|
||||
return info.dwMajorVersion;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
|
|
|
@ -56,13 +56,6 @@ void get_compiled_version_info(GString *str,
|
|||
void get_runtime_version_info(GString *str,
|
||||
void (*additional_info)(GString *));
|
||||
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* Get the major OS version.
|
||||
*/
|
||||
guint32 get_os_major_version();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -476,3 +476,27 @@ get_os_version_info(GString *str)
|
|||
g_string_append(str, "an unknown OS");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* Get the Windows major OS version.
|
||||
*
|
||||
* XXX - Should this return the minor version as well, e.g. 0x00050002?
|
||||
*
|
||||
* XXX - I think Microsoft have now stuck it at 6 forever, so it really
|
||||
* distinguishes, on the versions of Windows we currently support and
|
||||
* future Windows versions between Windows 2000/XP (major version 5) and
|
||||
* everything after it (major version 6).
|
||||
*/
|
||||
guint32
|
||||
get_windows_major_version(void)
|
||||
{
|
||||
OSVERSIONINFO info;
|
||||
|
||||
info.dwOSVersionInfoSize = sizeof info;
|
||||
if (GetVersionEx(&info)) {
|
||||
return info.dwMajorVersion;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,13 @@ extern "C" {
|
|||
*/
|
||||
WS_DLL_PUBLIC void get_os_version_info(GString *str);
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Get the Windows major OS version.
|
||||
*/
|
||||
WS_DLL_PUBLIC guint32 get_windows_major_version(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
Loading…
Reference in New Issue