8286424: GetVersionEx is deprecated
Reviewed-by: dholmes, hseigel
This commit is contained in:
parent
986d87dcc0
commit
4b8a66a5ff
@ -101,6 +101,7 @@
|
|||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#include <versionhelpers.h>
|
||||||
|
|
||||||
// for timer info max values which include all bits
|
// for timer info max values which include all bits
|
||||||
#define ALL_64_BITS CONST64(-1)
|
#define ALL_64_BITS CONST64(-1)
|
||||||
@ -1758,21 +1759,11 @@ void os::print_os_info(outputStream* st) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void os::win32::print_windows_version(outputStream* st) {
|
void os::win32::print_windows_version(outputStream* st) {
|
||||||
OSVERSIONINFOEX osvi;
|
|
||||||
VS_FIXEDFILEINFO *file_info;
|
VS_FIXEDFILEINFO *file_info;
|
||||||
TCHAR kernel32_path[MAX_PATH];
|
TCHAR kernel32_path[MAX_PATH];
|
||||||
UINT len, ret;
|
UINT len, ret;
|
||||||
|
|
||||||
// Use the GetVersionEx information to see if we're on a server or
|
bool is_workstation = !IsWindowsServer();
|
||||||
// workstation edition of Windows. Starting with Windows 8.1 we can't
|
|
||||||
// trust the OS version information returned by this API.
|
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
|
||||||
if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
|
|
||||||
st->print_cr("Call to GetVersionEx failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION);
|
|
||||||
|
|
||||||
// Get the full path to \Windows\System32\kernel32.dll and use that for
|
// Get the full path to \Windows\System32\kernel32.dll and use that for
|
||||||
// determining what version of Windows we're running on.
|
// determining what version of Windows we're running on.
|
||||||
@ -3915,21 +3906,7 @@ void os::win32::initialize_system_info() {
|
|||||||
FLAG_SET_DEFAULT(MaxRAM, MIN2(MaxRAM, (uint64_t) ms.ullTotalVirtual));
|
FLAG_SET_DEFAULT(MaxRAM, MIN2(MaxRAM, (uint64_t) ms.ullTotalVirtual));
|
||||||
}
|
}
|
||||||
|
|
||||||
OSVERSIONINFOEX oi;
|
_is_windows_server = IsWindowsServer();
|
||||||
oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
|
||||||
GetVersionEx((OSVERSIONINFO*)&oi);
|
|
||||||
switch (oi.dwPlatformId) {
|
|
||||||
case VER_PLATFORM_WIN32_NT:
|
|
||||||
{
|
|
||||||
int os_vers = oi.dwMajorVersion * 1000 + oi.dwMinorVersion;
|
|
||||||
if (oi.wProductType == VER_NT_DOMAIN_CONTROLLER ||
|
|
||||||
oi.wProductType == VER_NT_SERVER) {
|
|
||||||
_is_windows_server = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: fatal("Unknown platform");
|
|
||||||
}
|
|
||||||
|
|
||||||
initialize_performance_counter();
|
initialize_performance_counter();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user