< prev index next >

src/windows/native/java/lang/java_props_md.c

Print this page
rev 13466 : 8211106: [windows] Update OS detection code to recognize Windows Server 2019
Reviewed-by: alanb, clanger, bobv

*** 1,7 **** /* ! * Copyright (c) 1998, 2016, 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
*** 349,358 **** --- 349,359 ---- GetJavaProperties(JNIEnv* env) { static java_props_t sprops = {0}; int majorVersion; int minorVersion; + int buildNumber = 0; if (sprops.line_separator) { return &sprops; }
*** 388,397 **** --- 389,400 ---- 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); }
*** 438,447 **** --- 441,451 ---- 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
*** 468,477 **** --- 472,483 ---- * 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) + * Windows Server 2019 10 0 (!VER_NT_WORKSTATION) + * where (buildNumber > 17762) * * This mapping will presumably be augmented as new Windows * versions are released. */ switch (platformId) {
*** 541,551 **** case 0: sprops.os_name = "Windows 10"; break; default: sprops.os_name = "Windows NT (unknown)"; } } else { switch (minorVersion) { ! case 0: sprops.os_name = "Windows Server 2016"; break; default: sprops.os_name = "Windows NT (unknown)"; } } } else { sprops.os_name = "Windows NT (unknown)"; --- 547,564 ---- case 0: sprops.os_name = "Windows 10"; break; default: sprops.os_name = "Windows NT (unknown)"; } } else { switch (minorVersion) { ! case 0: ! /* Windows server 2019 GA 10/2018 build number is 17763 */ ! if (buildNumber > 17762) { ! sprops.os_name = "Windows Server 2019"; ! } else { ! sprops.os_name = "Windows Server 2016"; ! } ! break; default: sprops.os_name = "Windows NT (unknown)"; } } } else { sprops.os_name = "Windows NT (unknown)";
< prev index next >