[Pcsclite-cvs-commit] PCSC/src winscard_clnt.c,1.27,1.28

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


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

Modified Files:
	winscard_clnt.c 
Log Message:
This is hack to allow a change of ATR at Reconnect without physically
changing the card. This should not happen in real life so should not be
problematic and so is active by default (ATR_CHANGE_AT_RECONNECT).


Index: winscard_clnt.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_clnt.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- winscard_clnt.c	19 Mar 2004 10:08:29 -0000	1.27
+++ winscard_clnt.c	19 Mar 2004 10:15:47 -0000	1.28
@@ -36,6 +36,13 @@
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 #endif
 
+/*
+ * This is hack to allow a change of ATR at Reconnect without physically
+ * changing the card. This should not happen in real life so should not be
+ * problematic and so is active by default.
+ */
+#define ATR_CHANGE_AT_RECONNECT
+
 struct _psChannelMap
 {
 	SCARDHANDLE hCard;
@@ -987,7 +994,11 @@
 	 */
 
 	*pcchReaderLen = strlen(psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName) + 1;
+#ifdef ATR_CHANGE_AT_RECONNECT
+	*pcbAtrLen = scStatusStruct.pcbAtrLen;
+#else
 	*pcbAtrLen = (readerStates[i])->cardAtrLength;
+#endif
 
 	*pdwState = (readerStates[i])->readerState;
 	*pdwProtocol = (readerStates[i])->cardProtocol;
@@ -1008,8 +1019,13 @@
 		if (*pcbAtrLen > dwAtrLen)
 			rv = SCARD_E_INSUFFICIENT_BUFFER;
 
+#ifdef ATR_CHANGE_AT_RECONNECT
+		memcpy(pbAtr, scStatusStruct.pbAtr,
+			min(*pcbAtrLen, dwAtrLen));
+#else
 		memcpy(pbAtr, (readerStates[i])->cardAtr,
-			min((readerStates[i])->cardAtrLength, dwAtrLen));
+			min(*pcbAtrLen, dwAtrLen));
+#endif
 	}
 	
 	SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);