[glib/improve-win32-version] gutils.c: Improve g_get_os_info() for Windows Server 2008+
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/improve-win32-version] gutils.c: Improve g_get_os_info() for Windows Server 2008+
- Date: Mon, 22 Nov 2021 04:55:04 +0000 (UTC)
commit 7540bed89ec540ddc57b806b70cd625265ebd0f6
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Nov 22 12:48:19 2021 +0800
gutils.c: Improve g_get_os_info() for Windows Server 2008+
Instead of Windows 7/8/8.1 Server, use the proper names Server 2008
R2/2012/2012 R2 so that things are clearer to people. Since nowadays
GLib requires Windows 7 (_WIN32_WINNT 0x0601, meaning the server
counterpart is Server 2008 R2), we include Server 2008 in the list for
completeness' sake, but exclude the Server 2003/2003R2 from the list.
glib/gutils.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/glib/gutils.c b/glib/gutils.c
index 21a3fa770..2fe8b9726 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -1383,10 +1383,10 @@ get_windows_version (gboolean with_windows)
{
gchar *win81_update;
- g_string_append (version, "8.1");
-
- if (!g_win32_check_windows_version (6, 3, 0, G_WIN32_OS_WORKSTATION))
- g_string_append (version, " Server");
+ if (g_win32_check_windows_version (6, 3, 0, G_WIN32_OS_WORKSTATION))
+ g_string_append (version, "8.1");
+ else
+ g_string_append (version, "Server 2012 R2");
win81_update = get_windows_8_1_update ();
@@ -1406,8 +1406,23 @@ get_windows_version (gboolean with_windows)
g_string_append (version, versions[i].version);
- if (!g_win32_check_windows_version (versions[i].major, versions[i].minor, versions[i].sp,
G_WIN32_OS_WORKSTATION))
- g_string_append (version, " Server");
+ if (g_win32_check_windows_version (versions[i].major, versions[i].minor, versions[i].sp,
G_WIN32_OS_SERVER))
+ {
+ /*
+ * This condition should now always hold, since Windows
+ * 7+/Server 2008 R2+ is now required
+ */
+ if (versions[i].major == 6)
+ {
+ g_string_append (version, "Server");
+ if (versions[i].minor == 2)
+ g_string_append (version, " 2012");
+ else if (versions[i].minor == 1)
+ g_string_append (version, " 2008 R2");
+ else
+ g_string_append (version, " 2008");
+ }
+ }
g_string_append (version, versions[i].spversion);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]