tool_doswin: Simplify Windows version detection

Closes https://github.com/curl/curl/pull/5754
This commit is contained in:
Cameron Cawley 2020-07-31 20:39:33 +01:00 committed by Marcel Raad
parent 790137b0f7
commit 2646be0dc0
No known key found for this signature in database
GPG Key ID: 9D24FF0262C36959
1 changed files with 3 additions and 14 deletions

View File

@ -707,22 +707,11 @@ bool tool_isVistaOrGreater;
CURLcode win32_init(void)
{
OSVERSIONINFOEX osvi;
unsigned __int64 mask = 0;
unsigned char op = VER_GREATER_EQUAL;
memset(&osvi, 0, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(osvi);
osvi.dwMajorVersion = 6;
VER_SET_CONDITION(mask, VER_MAJORVERSION, op);
VER_SET_CONDITION(mask, VER_MINORVERSION, op);
if(VerifyVersionInfo(&osvi, (VER_MAJORVERSION | VER_MINORVERSION), mask))
if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL))
tool_isVistaOrGreater = true;
else if(GetLastError() == ERROR_OLD_WIN_VERSION)
tool_isVistaOrGreater = false;
else
return CURLE_FAILED_INIT;
tool_isVistaOrGreater = false;
QueryPerformanceFrequency(&tool_freq);
return CURLE_OK;