Mounir IDRASSI mounir.idrassi@idrix.fr writes:
+/*
- pcsc-lite functions pointers
- */
+typedef LONG (*SCardEstablishContextPtr)(DWORD dwScope,LPCVOID pvReserved1,
- LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
+typedef LONG (*SCardReleaseContextPtr)(SCARDCONTEXT hContext); +typedef LONG (*SCardIsValidContextPtr)(SCARDCONTEXT hContext); +typedef LONG (*SCardSetTimeoutPtr)(SCARDCONTEXT hContext, DWORD dwTimeout); +typedef LONG (*SCardConnectPtr)(SCARDCONTEXT hContext,LPCSTR szReader,DWORD dwShareMode,
- DWORD dwPreferredProtocols,LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
+typedef LONG (*SCardReconnectPtr)(SCARDHANDLE hCard,DWORD dwShareMode,
- DWORD dwPreferredProtocols,DWORD dwInitialization, LPDWORD pdwActiveProtocol);
+typedef LONG (*SCardDisconnectPtr)(SCARDHANDLE hCard, DWORD dwDisposition); +typedef LONG (*SCardBeginTransactionPtr)(SCARDHANDLE hCard); +typedef LONG (*SCardEndTransactionPtr)(SCARDHANDLE hCard, DWORD dwDisposition); +typedef LONG (*SCardCancelTransactionPtr)(SCARDHANDLE hCard); +typedef LONG (*SCardStatusPtr)(SCARDHANDLE hCard,LPSTR mszReaderNames, LPDWORD pcchReaderLen,
- LPDWORD pdwState,LPDWORD pdwProtocol,BYTE* pbAtr,LPDWORD pcbAtrLen);
+typedef LONG (*SCardGetStatusChangePtr)(SCARDCONTEXT hContext,DWORD dwTimeout,
- LPSCARD_READERSTATEA rgReaderStates, DWORD cReaders);
+typedef LONG (*SCardControlPtr)(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer,
- DWORD cbSendLength,LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned);
+typedef LONG (*SCardTransmitPtr)(SCARDHANDLE hCard,LPCSCARD_IO_REQUEST pioSendPci,
- const BYTE* pbSendBuffer, DWORD cbSendLength,
- LPSCARD_IO_REQUEST pioRecvPci, BYTE* pbRecvBuffer, LPDWORD pcbRecvLength);
+typedef LONG (*SCardListReaderGroupsPtr)(SCARDCONTEXT hContext,LPSTR mszGroups, LPDWORD pcchGroups); +typedef LONG (*SCardListReadersPtr)(SCARDCONTEXT hContext,LPCSTR mszGroups,
- LPSTR mszReaders, LPDWORD pcchReaders);
+typedef LONG (*SCardCancelPtr)(SCARDCONTEXT hContext); +typedef LONG (*SCardGetAttribPtr)(SCARDHANDLE hCard, DWORD dwAttrId,BYTE* pbAttr, LPDWORD pcbAttrLen); +typedef LONG (*SCardSetAttribPtr)(SCARDHANDLE hCard, DWORD dwAttrId,const BYTE* pbAttr, DWORD cbAttrLen);
I don't think the pcsc-lite library is guaranteed to be binary compatible with the Windows definitions. You'll need to include the correct headers and convert data types between Windows and Unix definitions.
Actually, pcsc-lite defines the same headers from PSDK with the same types for 32bit architecture. Including pcsclite headers will clash with wine's headers. The only possible modification is to redefine pcsclite types with different names but this is useless as they are the same as the ones in winscard. The only exception is for winscard handles: in pcsclite they are always defined as "long", whereas in PSDK they are defined as ULONG_PTR. So, for me, the only thing to do is convert those handles back and forth from long to ULONG_PTR. Another possible issue is when wine is running under a 64bit host and pcsclite is compiled on 64bit mode...but I think this is a more global issue. Am I missing something? Please advise. Thanks.
Mounir IDRASSI IDRIX - Cryptography and IT Security Experts http://www.idrix.fr
Alexandre Julliard wrote:
I don't think the pcsc-lite library is guaranteed to be binary compatible with the Windows definitions. You'll need to include the correct headers and convert data types between Windows and Unix definitions.
Mounir IDRASSI mounir.idrassi@idrix.fr writes:
Actually, pcsc-lite defines the same headers from PSDK with the same types for 32bit architecture. Including pcsclite headers will clash with wine's headers. The only possible modification is to redefine pcsclite types with different names but this is useless as they are the same as the ones in winscard.
Unfortunately they aren't, the pcsclite headers use unsigned long instead of DWORD for instance. This won't have the same size on 64-bit.