提交 b3a860d8 编写于 作者: M mbaesken

8211106: [windows] Update OS detection code to recognize Windows Server 2019

Reviewed-by: alanb, clanger, bobv
上级 4e9b3517
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* 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
......@@ -351,6 +351,7 @@ GetJavaProperties(JNIEnv* env)
static java_props_t sprops = {0};
int majorVersion;
int minorVersion;
int buildNumber = 0;
if (sprops.line_separator) {
return &sprops;
......@@ -390,6 +391,8 @@ GetJavaProperties(JNIEnv* env)
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);
......@@ -440,6 +443,7 @@ GetJavaProperties(JNIEnv* env)
}
majorVersion = HIWORD(file_info->dwProductVersionMS);
minorVersion = LOWORD(file_info->dwProductVersionMS);
buildNumber = HIWORD(file_info->dwProductVersionLS);
free(version_info);
} while (0);
......@@ -470,6 +474,8 @@ GetJavaProperties(JNIEnv* env)
* 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.
......@@ -543,7 +549,14 @@ GetJavaProperties(JNIEnv* env)
}
} else {
switch (minorVersion) {
case 0: sprops.os_name = "Windows Server 2016"; break;
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)";
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册