WinSCard.dll Api unexpected behaviour/issue on Win7/Vista
We have observed an unexpected change in behaviour with the WinSCard.dll API on windows7/vista that we suspect may be a bug. we poll in a loop SCardGetStatusChange method to detect when a smartcard is inserted or removed (by monitoring the m_dwEventState of each card reader for the CHANGED, PRESENT and EMPTY flags) when a card insert is detected we connect to the card using the SCardConnect method, and perform whatever operations we need to do on the card. when a card removal is detected we call SCardDisconnect method. this all works as expected on XP, however on windows7/vista when the SCardDisconnect method is called after the card has been removed we observe an unexpected CARD_STATE.PRESENT followed CARD_STATE.EMPTY event returned from the SCardGetStatusChange method. in summary the following steps occur: 1) we insert the card -> SCardGetStatusChange reports an event with CARD_STATE.PRESENT flag set 2) we connect to the card using SCardConnect 3) the card is removed -> SCardGetStatusChange reports an event with CARD_STATE.EMPTY flag set 4) we release our connction to the card api by calling SCardDisconnect on XP nothing else happens, however on win7/Vista: 5) SCardGetStatusChange reports an event with CARD_STATE.PRESENT flag set 6) SCardGetStatusChange reports an event with CARD_STATE.EMPTY flag set i.e. on windows 7 /vista we appear to see another card insert/removal when in reality nothing has happened. note these unexpected events also appear to have the CARD_STATE.MUTE flag set, the MUTE flag is not set in the observed events in steps 1 and 3. Also notable is that this issue does not occur if Windows 7 is running in a remote desktop session and receiving smartcard input from a host pc running XP. I.e. the issue only occurs when the operating system reading the smartcard is Windows7/Vista. We have an example project available that illustrates the behaviour if necessary.
December 8th, 2009 1:44pm

Since it is a software development issue, please discuss it in our MSDN forum. Microsoft Development NetworkArthur Xie - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2009 11:44am

ok, this has been posted at the following url http://social.msdn.microsoft.com/Forums/en-US/windowssecurity/thread/1abdb5a1-032a-40fc-8bf1-c2bbba59db9f cheers
December 9th, 2009 7:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics