< prev index next >
src/java.base/windows/native/libjava/java_props_md.c
Print this page
rev 51982 : 8211106: [windows] Update OS detection code to recognize Windows Server 2019
*** 1,7 ****
/*
! * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 357,366 ****
--- 357,367 ----
GetJavaProperties(JNIEnv* env)
{
static java_props_t sprops = {0};
int majorVersion;
int minorVersion;
+ int buildNumber = 0;
if (sprops.line_separator) {
return &sprops;
}
*** 396,405 ****
--- 397,408 ----
OSVERSIONINFOEX ver;
ver.dwOSVersionInfoSize = sizeof(ver);
GetVersionEx((OSVERSIONINFO *) &ver);
majorVersion = ver.dwMajorVersion;
minorVersion = ver.dwMinorVersion;
+ /* distinguish Windows Server 2016 and 2019 by build number */
+ buildNumber = ver.dwBuildNumber;
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
platformId = ver.dwPlatformId;
sprops.patch_level = _strdup(ver.szCSDVersion);
}
*** 446,455 ****
--- 449,459 ----
free(version_info);
break;
}
majorVersion = HIWORD(file_info->dwProductVersionMS);
minorVersion = LOWORD(file_info->dwProductVersionMS);
+ buildNumber = HIWORD(file_info->dwProductVersionLS);
free(version_info);
} while (0);
/*
* From msdn page on OSVERSIONINFOEX, current as of this
*** 476,485 ****
--- 480,492 ----
* Windows 8 6 2 (VER_NT_WORKSTATION)
* Windows Server 2012 6 2 (!VER_NT_WORKSTATION)
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
* Windows 10 10 0 (VER_NT_WORKSTATION)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
+ * where (buildNumber <= 17676)
+ * Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
+ * where (buildNumber > 17676)
*
* This mapping will presumably be augmented as new Windows
* versions are released.
*/
switch (platformId) {
*** 552,561 ****
--- 559,572 ----
} else {
switch (minorVersion) {
case 0: sprops.os_name = "Windows Server 2016"; break;
default: sprops.os_name = "Windows NT (unknown)";
}
+ /* Windows server 2019 preview build number is 17677 */
+ if ((minorVersion == 0) && (buildNumber > 17676)) {
+ sprops.os_name = "Windows Server 2019";
+ }
}
} else {
sprops.os_name = "Windows NT (unknown)";
}
break;
< prev index next >