BUG: SCardBeginTransaction() May Fail to Detect a Reset Card (230031)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
    • the operating system: Microsoft Windows Millennium Edition
    • the operating system: Microsoft Windows NT

This article was previously published under Q230031

SYMPTOMS

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.

CAUSE

The problem is caused by an anomaly in this API.

RESOLUTION

Call SCardStatus() immediately after SCardBeginTransaction() to make sure the card has not been reset.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

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!
				

REFERENCES

Please see the MSDN online help for more information on SCardBeginTransaction() and other SCard APIs.

Modification Type:MinorLast Reviewed:9/27/2004
Keywords:kbAPI kbbug kbFAQ kbKernBase kbpending kbSecurity kbSmartCard KB230031