mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 00:58:48 -05:00
tool_doswin: Simplify Windows version detection
Closes https://github.com/curl/curl/pull/5754
This commit is contained in:
parent
790137b0f7
commit
2646be0dc0
@ -707,22 +707,11 @@ bool tool_isVistaOrGreater;
|
|||||||
|
|
||||||
CURLcode win32_init(void)
|
CURLcode win32_init(void)
|
||||||
{
|
{
|
||||||
OSVERSIONINFOEX osvi;
|
if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
|
||||||
unsigned __int64 mask = 0;
|
VERSION_GREATER_THAN_EQUAL))
|
||||||
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))
|
|
||||||
tool_isVistaOrGreater = true;
|
tool_isVistaOrGreater = true;
|
||||||
else if(GetLastError() == ERROR_OLD_WIN_VERSION)
|
|
||||||
tool_isVistaOrGreater = false;
|
|
||||||
else
|
else
|
||||||
return CURLE_FAILED_INIT;
|
tool_isVistaOrGreater = false;
|
||||||
|
|
||||||
QueryPerformanceFrequency(&tool_freq);
|
QueryPerformanceFrequency(&tool_freq);
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user