summaryrefslogtreecommitdiff
path: root/wsutil/os_version_info.c
diff options
context:
space:
mode:
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