BUG: SCardBeginTransaction() May Fail to Detect a Reset CardID: Q230031
|
For Smart Card Resource Manager version 1.0, when a blocked SCardBeginTransaction() call returns after another thread or process reset the card, the return code is still set to SCARD_S_SUCCESS, instead of SCARD_W_RESET_CARD.
The problem is caused by an anomaly in this API.
Call SCardStatus() immediately after SCardBeginTransaction() to make sure the card has not been reset.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
The following scenario produces the described problem:
Thread1 Thread2
------- -------
SCardBeginTransaction(...);
...
---> A switch to Thread2 occurs here.
ret = SCardBeginTransaction(); //Blocking
<--- A switch to Thread1 occurs here.
ret =SCardEndTransaction(hCard, SCARD_RESET_CARD)
...
---> A switch to Thread2 occurs here.
// Thread2 transaction is started here
// and return value is SCARD_S_SUCCESS.
// No warning that the card was reset!
Please see the MSDN online help for more information on SCardBeginTransaction() and other SCard APIs.
Additional query words: SCardBeginTransaction SCARD_W_RESET_CARD SCard API
Keywords : kbAPI kbKernBase kbSDKPlatform kbSDKWin32 kbSmartCard
Version : winnt:
Platform : winnt
Issue type : kbbug
Last Reviewed: May 26, 1999