[Pcsclite-cvs-commit] PCSC/src winscard.c,1.36,1.37

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv25582/src

Modified Files:
	winscard.c 
Log Message:
SCardReconnect(): if the reset fails it may be either because:
- the card is unresponsive (SCARD_W_UNRESPONSIVE_CARD)
or
- no card is present (SCARD_E_NO_SMARTCARD) and the SCardConnect() was
  successfull with SCARD_SHARE_DIRECT (no need for a card)


Index: winscard.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- winscard.c	29 Jun 2004 08:00:23 -0000	1.36
+++ winscard.c	29 Jun 2004 08:31:40 -0000	1.37
@@ -427,7 +427,17 @@
 						rContext->readerState->cardAtrLength);
 				}
 				else
+				{
+					DWORD dwStatus, dwAtrLen;
+					UCHAR ucAtr[MAX_ATR_SIZE];
+
 					DebugLogA("Error resetting card.");
+					IFDStatusICC(rContext, &dwStatus, ucAtr, &dwAtrLen);
+					if (dwStatus & SCARD_PRESENT)
+						return SCARD_W_UNRESPONSIVE_CARD;
+					else
+						return SCARD_E_NO_SMARTCARD;
+				}
 				break;
 
 			default: