From 332e8d6164bfb33dfae19704ef8c3e851a71b2d3 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 4 Jun 2016 20:58:39 +0100 Subject: win32: Used centralised verify windows version function Closes #845 --- lib/vtls/schannel.c | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 38a2aa33e..23019f812 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -58,8 +58,10 @@ #include "warnless.h" #include "x509asn1.h" #include "curl_printf.h" +#include "system_win32.h" + + /* The last #include file should be: */ #include "curl_memory.h" -/* The last #include file should be: */ #include "memdebug.h" /* ALPN requires version 8.1 of the Windows SDK, which was @@ -1261,39 +1263,8 @@ cleanup: */ if(len && !connssl->decdata_offset && connssl->recv_connection_closed && !connssl->recv_sspi_close_notify) { - bool isWin2k = FALSE; - -#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \ - (_WIN32_WINNT < _WIN32_WINNT_WIN2K) - OSVERSIONINFO osver; - - memset(&osver, 0, sizeof(osver)); - osver.dwOSVersionInfoSize = sizeof(osver); - - /* Find out the Windows version */ - if(GetVersionEx(&osver)) { - /* Verify the version number is 5.0 */ - if(osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) - isWin2k = TRUE; - } -#else - ULONGLONG cm; - OSVERSIONINFOEX osver; - - memset(&osver, 0, sizeof(osver)); - osver.dwOSVersionInfoSize = sizeof(osver); - osver.dwMajorVersion = 5; - - cm = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL); - cm = VerSetConditionMask(cm, VER_MINORVERSION, VER_EQUAL); - cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); - cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL); - - if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION | - VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR), - cm)) - isWin2k = TRUE; -#endif + bool isWin2k = Curl_verify_windows_version(5, 0, PLATFORM_WINNT, + VERSION_EQUAL); if(isWin2k && sspi_status == SEC_E_OK) connssl->recv_sspi_close_notify = true; -- cgit v1.2.3