summaryrefslogtreecommitdiff
path: root/wsutil/os_version_info.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-21 14:32:45 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-21 21:33:11 +0000
commita70dea195625f32a026d10d937345d177f81aead (patch)
tree96f3fd13e785998781d9a179745494a14788d1ee /wsutil/os_version_info.c
parent3c979e63a7c2341f0c3bdf270d22fce17bb93562 (diff)
downloadwireshark-a70dea195625f32a026d10d937345d177f81aead.tar.gz
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>
Diffstat (limited to 'wsutil/os_version_info.c')
-rw-r--r--wsutil/os_version_info.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/wsutil/os_version_info.c b/wsutil/os_version_info.c
index ba91b4163d..e72ee7f990 100644
--- a/wsutil/os_version_info.c
+++ b/wsutil/os_version_info.c
@@ -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