Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
schannel: Replace deprecated GetVersion with VerifyVersionInfo
  • Loading branch information
MarcelRaad authored and jay committed Jul 22, 2015
1 parent ad32457 commit 7a8e861
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/vtls/schannel.c
Expand Up @@ -1120,12 +1120,21 @@ schannel_recv(struct connectdata *conn, int sockindex,
*/
if(len && !connssl->decdata_offset && connssl->recv_connection_closed &&
!connssl->recv_sspi_close_notify) {
DWORD winver_full, winver_major, winver_minor;
winver_full = GetVersion();
winver_major = (DWORD)(LOBYTE(LOWORD(winver_full)));
winver_minor = (DWORD)(HIBYTE(LOWORD(winver_full)));
BOOL isWin2k;
ULONGLONG cm;
OSVERSIONINFOEX osver = { sizeof osver, 5, };

if(winver_major == 5 && winver_minor == 0 && sspi_status == SEC_E_OK)
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);

isWin2k = VerifyVersionInfo(&osver,
(VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
cm);

if(isWin2k && sspi_status == SEC_E_OK)
connssl->recv_sspi_close_notify = true;
else {
*err = CURLE_RECV_ERROR;
Expand Down

0 comments on commit 7a8e861

Please sign in to comment.