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.
This commit is contained in:
Chun-wei Fan 2021-11-22 12:48:19 +08:00
parent 5f56477cc7
commit 7540bed89e

View File

@ -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);
}