[Pcsclite-cvs-commit] PCSC/src readerfactory.c,1.22,1.23

rousseau@quantz.debian.org rousseau@quantz.debian.org
Mon, 22 Sep 2003 14:59:34 +0200


Update of /cvsroot/pcsclite/PCSC/src
In directory quantz:/tmp/cvs-serv1546

Modified Files:
	readerfactory.c 
Log Message:
initialize dwGetSize to the size of the value buffer before calling
IFDGetCapabilities().


Index: readerfactory.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/readerfactory.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- readerfactory.c	18 Sep 2003 06:11:48 -0000	1.22
+++ readerfactory.c	22 Sep 2003 12:59:32 -0000	1.23
@@ -73,7 +73,6 @@
 
 LONG RFAddReader(LPSTR lpcReader, DWORD dwPort, LPSTR lpcLibrary)
 {
-
 	DWORD dwContext, dwContextB, dwGetSize;
 	UCHAR ucGetData[1], ucThread[1];
 	char lpcStripReader[MAX_READERNAME];
@@ -86,7 +85,6 @@
 	 */
 	dwContext = 0;
 	dwContextB = 0;
-	dwGetSize = 0;
 	rv = 0;
 	i = 0;
 	j = 0;
@@ -185,11 +183,13 @@
 		/*
 		 * Call on the driver to see if it is thread safe 
 		 */
+		dwGetSize = sizeof(ucThread);
 		rv = IFDGetCapabilities((sContexts[parentNode]),
 		       TAG_IFD_THREAD_SAFE, &dwGetSize, ucThread);
 
 		if (rv == IFD_SUCCESS && dwGetSize == 1 && ucThread[0] == 1)
 		{
+			DebugLogA("Driver is thread safe");
 			(sContexts[dwContext])->mMutex = 0;
 		}
 	}
@@ -250,6 +250,7 @@
 	 * Call on the driver to see if there are multiple slots 
 	 */
 
+	dwGetSize = sizeof(ucGetData);
 	rv = IFDGetCapabilities((sContexts[dwContext]),
 		TAG_IFD_SLOTS_NUMBER, &dwGetSize, ucGetData);
 
@@ -350,6 +351,8 @@
 			/*
 			 * Call on the driver to see if the slots are thread safe 
 			 */
+
+			dwGetSize = sizeof(ucThread);
 			rv = IFDGetCapabilities((sContexts[dwContext]),
 		                  TAG_IFD_SLOT_THREAD_SAFE, &dwGetSize, ucThread);
 
@@ -526,6 +529,8 @@
 							(tagValue > 1))
 						{
 							supportedChannels = tagValue;
+							DebugLogB("Support %d simultaneous readers",
+								tagValue);
 						} else
 						{
 							supportedChannels = -1;