summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2015-11-21 02:43:17 +0000
committerSteve Holme <steve_holme@hotmail.com>2015-11-21 02:43:17 +0000
commit8d17117683226e90b8854fc7e5f99fe7cacae591 (patch)
tree179dda61755b2292efe9807b89616f08a1562e3f
parentc90e3485795f561e38cd67f64892a37788fa14dc (diff)
downloadgnurl-8d17117683226e90b8854fc7e5f99fe7cacae591.tar.gz
gnurl-8d17117683226e90b8854fc7e5f99fe7cacae591.tar.bz2
gnurl-8d17117683226e90b8854fc7e5f99fe7cacae591.zip
schannel: Use GetVersionEx() when VerifyVersionInfo() isn't available
Regression from commit 7a8e861a5 as highlighted in the msys autobuilds.
-rw-r--r--lib/vtls/schannel.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index 2174e21a3..0e7ae6d8f 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -1120,7 +1120,23 @@ cleanup:
*/
if(len && !connssl->decdata_offset && connssl->recv_connection_closed &&
!connssl->recv_sspi_close_notify) {
- BOOL isWin2k;
+ 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))
+ return CURLE_FAILED_INIT;
+
+ /* Verify the version number is 5.0 */
+ if(osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0)
+ isWin2k = TRUE;
+#else
ULONGLONG cm;
OSVERSIONINFOEX osver;
@@ -1133,10 +1149,11 @@ cleanup:
cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
- isWin2k = VerifyVersionInfo(&osver,
- (VER_MAJORVERSION | VER_MINORVERSION |
- VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
- cm);
+ if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
+ VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
+ cm))
+ isWin2k = TRUE;
+#endif
if(isWin2k && sspi_status == SEC_E_OK)
connssl->recv_sspi_close_notify = true;