[Pcsclite-cvs-commit] PCSC/src ifdwrapper.c,1.8,1.9

sauveron-guest@quantz.debian.org sauveron-guest@quantz.debian.org
Wed, 14 Jan 2004 13:08:02 +0100


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

Modified Files:
	ifdwrapper.c 
Log Message:
Add the support of IFDHandler interface v3

Index: ifdwrapper.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/ifdwrapper.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ifdwrapper.c	13 Jan 2004 17:53:41 -0000	1.8
+++ ifdwrapper.c	14 Jan 2004 12:07:59 -0000	1.9
@@ -120,15 +120,17 @@
  * channel to the IFD. 
  */
 
-LONG IFDOpenIFD(PREADER_CONTEXT rContext, DWORD dwChannelId)
+LONG IFDOpenIFD(PREADER_CONTEXT rContext)
 {
 
 	RESPONSECODE rv;
 	LPVOID vFunction;
+	LPVOID vFunction1;
 
 #ifndef PCSCLITE_STATIC_DRIVER
 	RESPONSECODE(*IO_create_channel) (DWORD) = NULL;
 	RESPONSECODE(*IFDH_create_channel) (DWORD, DWORD) = NULL;
+	RESPONSECODE(*IFDH_create_channel_by_name) (DWORD, LPSTR) = NULL;
 #endif
 
 	/*
@@ -136,12 +138,14 @@
 	 */
 	rv = 0;
 	vFunction = 0;
+	vFunction1 = 0;
 
 #ifndef PCSCLITE_STATIC_DRIVER
 	/*
 	 * Make sure the symbol exists in the driver 
 	 */
 	vFunction = rContext->psFunctions.pvfCreateChannel;
+	vFunction1 = rContext->psFunctions.pvfCreateChannelByName;
 
 	if (vFunction == 0)
 	{
@@ -151,10 +155,15 @@
 	if (rContext->dwVersion == IFD_HVERSION_1_0)
 	{
 		IO_create_channel = (RESPONSECODE(*)(DWORD)) vFunction;
-	} else
+	} else if (rContext->dwVersion == IFD_HVERSION_2_0)
 	{
 		IFDH_create_channel = (RESPONSECODE(*)(DWORD, DWORD)) vFunction;
 	}
+	else
+	{
+		IFDH_create_channel = (RESPONSECODE(*)(DWORD, DWORD)) vFunction;
+		IFDH_create_channel_by_name = (RESPONSECODE(*)(DWORD, LPSTR)) vFunction1;
+	}
 #endif
 
 	/*
@@ -165,18 +174,24 @@
 #ifndef PCSCLITE_STATIC_DRIVER
 	if (rContext->dwVersion == IFD_HVERSION_1_0)
 	{
-		rv = (*IO_create_channel) (dwChannelId);
+		rv = (*IO_create_channel) (rContext->dwPort);
+	} else if (rContext->dwVersion == IFD_HVERSION_2_0)
+	{
+		rv = (*IFDH_create_channel) (rContext->dwSlot, rContext->dwPort);
 	} else
 	{
-		rv = (*IFDH_create_channel) (rContext->dwSlot, dwChannelId);
+		rv = (*IFDH_create_channel_by_name) (rContext->dwSlot, rContext->lpcDevice);
 	}
 #else
 	if (rContext->dwVersion == IFD_HVERSION_1_0)
 	{
-		rv = IO_Create_Channel(dwChannelId);
+		rv = IO_Create_Channel(rContext->dwPort);
+	} else if (rContext->dwVersion == IFD_HVERSION_2_0)
+	{ 
+		rv = IFDHCreateChannel(rContext->dwSlot, rContext->dwPort);
 	} else
 	{
-		rv = IFDHCreateChannel(rContext->dwSlot, dwChannelId);
+		rv = IFDHCreateChannelByName(rContext->dwSlot, rContext->lpcDevice);
 	}
 #endif
 	SYS_MutexUnLock(rContext->mMutex);