From fffb479e0c1d4ca8a609f96693c238b86c51a21f Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Thu, 11 Sep 2014 11:15:46 +0000 Subject: [PATCH] Workaround for bug in pcsc lite where timeout value 0 for SCardGetStatusChange() behaves just like INFINIT. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1835 423420c4-83ab-492f-b58f-81f9feb106b5 --- scard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scard.c b/scard.c index 1658c37..948cd70 100644 --- a/scard.c +++ b/scard.c @@ -3,7 +3,7 @@ Smart Card support Copyright (C) Alexi Volkov 2006 Copyright 2010-2013 Pierre Ossman for Cendio AB - Copyright 2011-2013 Henrik Andersson for Cendio AB + Copyright 2011-2014 Henrik Andersson for Cendio AB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1175,6 +1175,11 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) memset(myRsArray, 0, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); copyReaderState_ServerToMyPCSC(rsArray, myRsArray, (SERVER_DWORD) dwCount); + /* Workaround for a bug in pcsclite, timeout value of 0 is handled as INFINIT + but is by Windows PCSC spec. used for polling current state. + */ + if (dwTimeout == 0) + dwTimeout = 1; rv = SCardGetStatusChange(myHContext, (MYPCSC_DWORD) dwTimeout, myRsArray, (MYPCSC_DWORD) dwCount); copyReaderState_MyPCSCToServer(myRsArray, rsArray, (MYPCSC_DWORD) dwCount);