Hi,
Please find attached the patch for adding header files for the support
of smart cards through Winscard dll.
If it's OK, should I post it elsewhere?
Thanks in advance.

Mounir IDRASSI
IDRIX - Cryptography and IT Security Experts
http://www.idrix.fr


Eric Pouech wrote:
>
> sorry, I didn't actually compare the files, just saw the comments (my
> bad)  
> that'll be better for the first patch not to include those C files  
> go ahead ;-)
> A+
>

From 90fb2bc92327fc839d6a0ef68c3157035cd50c65 Mon Sep 17 00:00:00 2001
From: Mounir IDRASSI <[EMAIL PROTECTED]>
Date: Tue, 1 May 2007 18:03:01 +0200
Subject: Header files for the support of smart cards using Winscard dll

---
 include/Makefile.in |    3 +
 include/scarderr.h  |   70 +++++++++
 include/winscard.h  |  416 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/winsmcrd.h  |  190 +++++++++++++++++++++++
 4 files changed, 679 insertions(+), 0 deletions(-)

diff --git a/include/Makefile.in b/include/Makefile.in
index 2577872..7dc0cc3 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -293,6 +293,7 @@ SRCDIR_INCLUDES = \
        rpcndr.h \
        rpcnterr.h \
        rpcproxy.h \
+       scarderr.h \
        schannel.h \
        schemadef.h \
        schnlsp.h \
@@ -351,6 +352,8 @@ SRCDIR_INCLUDES = \
        winreg.h \
        winres.h \
        winresrc.h \
+       winscard.h \
+       winsmcrd.h \
        winsock.h \
        winsock2.h \
        winspool.h \
diff --git a/include/scarderr.h b/include/scarderr.h
new file mode 100755
index 0000000..c07833e
--- /dev/null
+++ b/include/scarderr.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  ([EMAIL PROTECTED], for IDRIX)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#ifndef _WINE_SCARDERR_H
+#define _WINE_SCARDERR_H
+
+
+#define SCARD_S_SUCCESS                                0x00000000
+#define SCARD_F_INTERNAL_ERROR                 0x80100001 /* An internal error 
occured while executing the operation */
+#define SCARD_E_CANCELLED                              0x80100002 /* 
SCardCancel was called to cancel the operation */
+#define SCARD_E_INVALID_HANDLE                 0x80100003 /* The given handle 
is not valid */
+#define SCARD_E_INVALID_PARAMETER              0x80100004 /* An invalid 
parameter was given in input*/
+#define SCARD_E_INVALID_TARGET                 0x80100005 /* Smart card 
service encountered inconsistent installation information */
+#define SCARD_E_NO_MEMORY                      0x80100006 /* No enough memory 
available to complete the operation */
+#define SCARD_F_WAITED_TOO_LONG                0x80100007 /* A timeout occured 
in an internal operation */
+#define SCARD_E_INSUFFICIENT_BUFFER            0x80100008 /* The output buffer 
is too small to receive data */
+#define SCARD_E_UNKNOWN_READER         0x80100009 /* The given reader name is 
unknwon to the system */
+#define SCARD_E_TIMEOUT                                0x8010000A /* The 
operation timed out */
+#define SCARD_E_SHARING_VIOLATION              0x8010000B /* can't access the 
card because of other connections*/
+
+#ifndef SCARD_E_NO_SMARTCARD
+#define SCARD_E_NO_SMARTCARD                   0x8010000C /* no smart card 
found on the reader*/
+#endif
+
+#define SCARD_E_UNKNOWN_CARD                   0x8010000D /* The given card 
name is unknwon to the ssytem */
+#define SCARD_E_CANT_DISPOSE                   0x8010000E /* The system can't 
handle the disposition request in SCardDisconnect or SCardEndTransaction*/
+#define SCARD_E_PROTO_MISMATCH         0x8010000F /* The given protocol is not 
compatible with the currenr card context */
+#define SCARD_E_NOT_READY                              0x80100010 /* The 
reader or the card are not ready for use */
+#define SCARD_E_INVALID_VALUE                  0x80100011 /* An invalid value 
was detected while */
+#define SCARD_E_SYSTEM_CANCELLED               0x80100012 /* The system 
canceld the current operation with the reader */
+#define SCARD_F_COMM_ERROR                     0x80100013 /* A communication 
error occured with the reader */
+#define SCARD_F_UNKNOWN_ERROR          0x80100014 /* An unknown error occured 
*/
+#define SCARD_E_INVALID_ATR                            0x80100015 /* The ATR 
value is invalid */
+#define SCARD_E_NOT_TRANSACTED         0x80100016 /* no transaction exists */
+#define SCARD_E_READER_UNAVAILABLE             0x80100017 /* The reader is 
unavailable for use by the system, e.g. removed */
+
+#define SCARD_E_PCI_TOO_SMALL                  0x80100019 /* The PCI request 
receive buffer is too small*/
+#define SCARD_E_READER_UNSUPPORTED     0x8010001A /* The reader is unsupported 
due to the lack of capabilities*/
+#define SCARD_E_DUPLICATE_READER               0x8010001B /* more than one 
reader with the same name exist*/
+#define SCARD_E_CARD_UNSUPPORTED               0x8010001C /* The card inserted 
is not supported by the system */
+#define SCARD_E_NO_SERVICE                             0x8010001D /* The Smart 
card resource manager is not running */
+#define SCARD_E_SERVICE_STOPPED                0x8010001E /* The Smart card 
resource manager has been stopped */
+
+#define SCARD_E_NO_READERS_AVAILABLE           0x8010002E /* no reader found 
on the system */
+
+#define SCARD_W_UNSUPPORTED_CARD               0x80100065 /* the card is 
unsupported and the reader can't communicate with it*/
+#define SCARD_W_UNRESPONSIVE_CARD              0x80100066 /* the card didn't 
send answer to the reset*/
+#define SCARD_W_UNPOWERED_CARD         0x80100067 /* the card is unpowered  
and the reader can't communicate with it*/
+#define SCARD_W_RESET_CARD                     0x80100068 /* the card has been 
reset and any held information are invalid*/
+#define SCARD_W_REMOVED_CARD                   0x80100069 /* the card has been 
removed from the reader*/
+
+
+
+#endif
diff --git a/include/winscard.h b/include/winscard.h
new file mode 100755
index 0000000..f302a9f
--- /dev/null
+++ b/include/winscard.h
@@ -0,0 +1,416 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  ([EMAIL PROTECTED], for IDRIX)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+
+#ifndef _WINE_WINSCARD_H
+#define _WINE_WINSCARD_H
+
+#include "winsmcrd.h"
+#include "scarderr.h"
+
+/*
+ * these variables store pre-filled protocol requests
+ */
+extern SCARD_IO_REQUEST g_rgSCardT0Pci;
+extern SCARD_IO_REQUEST g_rgSCardT1Pci;
+extern SCARD_IO_REQUEST g_rgSCardRawPci;
+
+/*
+ * These are handy shotcuts to be used in SCardTransmit
+ * They are implemented here as pointer variables
+ */
+ extern SCARD_IO_REQUEST* SCARD_PCI_T0;                /* equal to 
(&g_rgSCardT0Pci) */
+ extern SCARD_IO_REQUEST* SCARD_PCI_T1;                /* equal to 
(&g_rgSCardT1Pci) */
+ extern SCARD_IO_REQUEST* SCARD_PCI_RAW;       /* equal to (&g_rgSCardRawPci) 
*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+       
+       
+/*
+ * Smart Card service manager function
+ */    
+       
+LONG WINAPI SCardEstablishContext(
+               DWORD dwScope,
+               LPCVOID pvReserved1, 
+               LPCVOID pvReserved2, 
+               LPSCARDCONTEXT phContext);
+
+LONG WINAPI SCardReleaseContext(
+               SCARDCONTEXT hContext); 
+
+LONG WINAPI SCardFreeMemory(
+               SCARDCONTEXT hContext,
+               LPCVOID pvMem);
+
+HANDLE WINAPI SCardAccessStartedEvent(void);
+
+void WINAPI SCardReleaseStartedEvent(
+               HANDLE hStartedEventHandle);
+
+LONG WINAPI SCardIsValidContext(
+               SCARDCONTEXT hContext);
+
+       
+/*
+ * Smart Card database functions
+ */    
+
+LONG WINAPI SCardListReaderGroupsA(
+               SCARDCONTEXT hContext,
+               LPSTR mszGroups, 
+               LPDWORD pcchGroups);            
+LONG WINAPI SCardListReaderGroupsW(
+               SCARDCONTEXT hContext,
+               LPWSTR mszGroups, 
+               LPDWORD pcchGroups);            
+       
+#define SCardListReaderGroups  WINELIB_NAME_AW(SCardListReaderGroups)
+       
+
+LONG WINAPI SCardListReadersA(
+               SCARDCONTEXT hContext,
+               LPCSTR mszGroups,
+               LPSTR mszReaders, 
+               LPDWORD pcchReaders);
+LONG WINAPI SCardListReadersW(
+               SCARDCONTEXT hContext,
+               LPCWSTR mszGroups,
+               LPWSTR mszReaders, 
+               LPDWORD pcchReaders);
+               
+#define SCardListReaders       WINELIB_NAME_AW(SCardListReaders)
+
+LONG WINAPI SCardListCardsA(
+               SCARDCONTEXT hContext,
+               const BYTE* pbAtr,
+               LPCGUID rgquidInterfaces,
+               DWORD cguidInterfaceCount,
+               LPSTR mszCards,
+               LPDWORD pcchCards);
+LONG WINAPI SCardListCardsW(
+               SCARDCONTEXT hContext,
+               const BYTE* pbAtr,
+               LPCGUID rgquidInterfaces,
+               DWORD cguidInterfaceCount,
+               LPWSTR mszCards,
+               LPDWORD pcchCards);
+                 
+#define SCardListCards         WINELIB_NAME_AW(SCardListCards) 
+       
+LONG WINAPI SCardListInterfacesA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCard,
+               LPGUID pguidInterfaces,
+               LPDWORD pcguidInterfaces);
+LONG WINAPI SCardListInterfacesW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCard,
+               LPGUID pguidInterfaces,
+               LPDWORD pcguidInterfaces);
+
+#define SCardListInterfaces    WINELIB_NAME_AW(SCardListInterfaces)            
+  
+LONG WINAPI SCardGetProviderIdA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCard,
+               LPGUID pguidProviderId);
+LONG WINAPI SCardGetProviderIdW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCard, 
+               LPGUID pguidProviderId);  
+    
+#define SCardGetProviderId     WINELIB_NAME_AW(SCardGetProviderId)             
    
+       
+LONG WINAPI SCardGetCardTypeProviderNameA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCardName,
+               DWORD dwProviderId,
+               LPSTR szProvider,
+               LPDWORD pcchProvider);
+LONG WINAPI SCardGetCardTypeProviderNameW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCardName,
+               DWORD dwProviderId,
+               LPWSTR szProvider,
+               LPDWORD pcchProvider);  
+    
+#define SCardGetCardTypeProviderName   
WINELIB_NAME_AW(SCardGetCardTypeProviderName)                   
+
+LONG WINAPI SCardIntroduceReaderGroupA(
+               SCARDCONTEXT hContext,
+               LPCSTR szGroupName);    
+LONG WINAPI SCardIntroduceReaderGroupW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szGroupName);
+    
+#define SCardIntroduceReaderGroup      
WINELIB_NAME_AW(SCardIntroduceReaderGroup)                          
+
+LONG WINAPI SCardForgetReaderGroupA(
+               SCARDCONTEXT hContext,
+               LPCSTR szGroupName);    
+LONG WINAPI SCardForgetReaderGroupW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szGroupName);
+    
+#define SCardForgetReaderGroup         WINELIB_NAME_AW(SCardForgetReaderGroup)
+
+
+LONG WINAPI SCardIntroduceReaderA(
+               SCARDCONTEXT hContext,
+               LPCSTR szReaderName,
+               LPCSTR szDeviceName);
+LONG WINAPI SCardIntroduceReaderW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szReaderName,
+               LPCWSTR szDeviceName);
+    
+#define SCardIntroduceReader   WINELIB_NAME_AW(SCardIntroduceReader)           
                    
+
+LONG WINAPI SCardForgetReaderA(
+               SCARDCONTEXT hContext,
+               LPCSTR szReaderName);
+LONG WINAPI SCardForgetReaderW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szReaderName);
+    
+#define SCardForgetReader      WINELIB_NAME_AW(SCardForgetReader)              
                        
+
+LONG WINAPI SCardAddReaderToGroupA(
+               SCARDCONTEXT hContext,
+               LPCSTR szReaderName,
+               LPCSTR szGroupName);    
+LONG WINAPI SCardAddReaderToGroupW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szReaderName,
+               LPCWSTR szGroupName);
+    
+#define SCardAddReaderToGroup  WINELIB_NAME_AW(SCardAddReaderToGroup)          
                            
+
+LONG WINAPI SCardRemoveReaderFromGroupA(
+               SCARDCONTEXT hContext,
+               LPCSTR szReaderName,
+               LPCSTR szGroupName);    
+LONG WINAPI SCardRemoveReaderFromGroupW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szReaderName,
+               LPCWSTR szGroupName);
+
+#define SCardRemoveReaderFromGroup     
WINELIB_NAME_AW(SCardRemoveReaderFromGroup)                                     
    
+
+LONG WINAPI SCardIntroduceCardTypeA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCardName,
+               LPCGUID pguidPrimaryProvider,
+               LPCGUID rgguidInterfaces,
+               DWORD dwInterfaceCount,
+               const BYTE* pbAtr,
+               const BYTE* pbAtrMask,
+               DWORD cbAtrLen);        
+LONG WINAPI SCardIntroduceCardTypeW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCardName,
+               LPCGUID pguidPrimaryProvider,
+               LPCGUID rgguidInterfaces,
+               DWORD dwInterfaceCount,
+               const BYTE* pbAtr,
+               const BYTE* pbAtrMask,
+               DWORD cbAtrLen);        
+       
+#define SCardIntroduceCardType         WINELIB_NAME_AW(SCardIntroduceCardType) 
                                        
+
+LONG WINAPI SCardSetCardTypeProviderNameA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCardName,
+               DWORD dwProviderId,
+               LPCSTR szProvider);     
+LONG WINAPI SCardSetCardTypeProviderNameW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCardName,
+               DWORD dwProviderId,
+               LPCWSTR szProvider);
+
+#define SCardSetCardTypeProviderName   
WINELIB_NAME_AW(SCardSetCardTypeProviderName)                                   
        
+
+LONG WINAPI SCardForgetCardTypeA(
+               SCARDCONTEXT hContext,
+               LPCSTR szCardName);     
+LONG WINAPI SCardForgetCardTypeW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szCardName);
+       
+#define SCardForgetCardType    WINELIB_NAME_AW(SCardForgetCardType)            
                                
+
+LONG WINAPI SCardLocateCardsA(
+               SCARDCONTEXT hContext,
+               LPCSTR mszCards,
+               LPSCARD_READERSTATEA rgReaderStates,
+               DWORD cReaders);        
+LONG WINAPI SCardLocateCardsW(
+               SCARDCONTEXT hContext,
+               LPCWSTR mszCards,
+               LPSCARD_READERSTATEW rgReaderStates,
+               DWORD cReaders);
+
+#define SCardLocateCards       WINELIB_NAME_AW(SCardLocateCards)               
                                
+
+LONG WINAPI SCardLocateCardsByATRA(
+               SCARDCONTEXT hContext,
+               LPSCARD_ATRMASK rgAtrMasks,
+               DWORD cAtrs,
+               LPSCARD_READERSTATEA rgReaderStates,
+               DWORD cReaders);        
+LONG WINAPI SCardLocateCardsByATRW(
+               SCARDCONTEXT hContext,
+               LPSCARD_ATRMASK rgAtrMasks,
+               DWORD cAtrs,
+               LPSCARD_READERSTATEW rgReaderStates,
+               DWORD cReaders);        
+       
+#define SCardLocateCardsByATR  WINELIB_NAME_AW(SCardLocateCardsByATR)          
                                        
+       
+/*
+  * Smart card communication functions
+  */
+       
+LONG WINAPI SCardConnectA(
+               SCARDCONTEXT hContext,
+               LPCSTR szReader,
+               DWORD dwShareMode,
+               DWORD dwPreferredProtocols,
+               LPSCARDHANDLE phCard, 
+               LPDWORD pdwActiveProtocol);                                     
        
+LONG WINAPI SCardConnectW(
+               SCARDCONTEXT hContext,
+               LPCWSTR szReader,
+               DWORD dwShareMode,
+               DWORD dwPreferredProtocols,
+               LPSCARDHANDLE phCard, 
+               LPDWORD pdwActiveProtocol);                                     
        
+
+#define SCardConnect   WINELIB_NAME_AW(SCardConnect)                           
                        
+
+LONG WINAPI SCardReconnect(
+               SCARDHANDLE hCard,
+               DWORD dwShareMode,
+               DWORD dwPreferredProtocols,
+               DWORD dwInitialization, 
+               LPDWORD pdwActiveProtocol);
+
+LONG WINAPI SCardDisconnect(
+               SCARDHANDLE hCard, 
+               DWORD dwDisposition);
+
+LONG WINAPI SCardBeginTransaction(
+               SCARDHANDLE hCard);
+
+LONG WINAPI SCardEndTransaction(
+               SCARDHANDLE hCard, 
+               DWORD dwDisposition);
+
+LONG WINAPI SCardCancelTransaction(
+               SCARDHANDLE hCard);
+
+LONG WINAPI SCardControl(
+               SCARDHANDLE hCard, 
+               DWORD dwControlCode,
+               LPCVOID pbSendBuffer, 
+               DWORD cbSendLength,
+               LPVOID pbRecvBuffer, 
+               DWORD cbRecvLength, 
+               LPDWORD lpBytesReturned);
+
+LONG WINAPI SCardTransmit(
+               SCARDHANDLE hCard,
+               LPCSCARD_IO_REQUEST pioSendPci,
+               const BYTE* pbSendBuffer, 
+               DWORD cbSendLength,
+               LPSCARD_IO_REQUEST pioRecvPci,
+               LPBYTE pbRecvBuffer, 
+               LPDWORD pcbRecvLength);
+               
+LONG WINAPI SCardCancel(
+               SCARDCONTEXT hContext);
+
+
+/*
+ * Smart card tracking functions
+ */
+
+LONG WINAPI SCardState(
+               SCARDHANDLE hCard,
+               LPDWORD pdwState,
+               LPDWORD pdwProtocol,
+               LPBYTE pbAtr,
+               LPDWORD pcbAtrLen);
+
+LONG WINAPI SCardStatusA(
+               SCARDHANDLE hCard,
+               LPSTR mszReaderNames, 
+               LPDWORD pcchReaderLen,
+               LPDWORD pdwState,
+               LPDWORD pdwProtocol,
+               LPBYTE pbAtr, 
+               LPDWORD pcbAtrLen);             
+LONG WINAPI SCardStatusW(
+               SCARDHANDLE hCard,
+               LPWSTR mszReaderNames, 
+               LPDWORD pcchReaderLen,
+               LPDWORD pdwState,
+               LPDWORD pdwProtocol,
+               LPBYTE pbAtr, 
+               LPDWORD pcbAtrLen);     
+
+#define SCardStatus    WINELIB_NAME_AW(SCardStatus)                            
                        
+
+LONG WINAPI SCardGetStatusChangeA(
+               SCARDCONTEXT hContext,
+               DWORD dwTimeout,
+               LPSCARD_READERSTATEA rgReaderStates, 
+               DWORD cReaders);                
+LONG WINAPI SCardGetStatusChangeW(
+               SCARDCONTEXT hContext,
+               DWORD dwTimeout,
+               LPSCARD_READERSTATEW rgReaderStates, 
+               DWORD cReaders);                
+
+#define SCardGetStatusChange   WINELIB_NAME_AW(SCardGetStatusChange)           
+
+LONG WINAPI SCardGetAttrib(
+               SCARDHANDLE hCard, 
+               DWORD dwAttrId,
+               LPBYTE pbAttr, 
+               LPDWORD pcbAttrLen);
+
+LONG WINAPI SCardSetAttrib(
+               SCARDHANDLE hCard, 
+               DWORD dwAttrId,
+               const BYTE* pbAttr, 
+               DWORD cbAttrLen);
+       
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/winsmcrd.h b/include/winsmcrd.h
new file mode 100755
index 0000000..cc03a35
--- /dev/null
+++ b/include/winsmcrd.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  ([EMAIL PROTECTED], for IDRIX)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#ifndef _WINE_WINSCMCRD_H
+#define _WINE_WINSCMCRD_H
+
+
+#define MAX_ATR_SIZE                   36      /* Maximum ATR size */
+
+#ifndef SCARD_ATR_LENGTH
+#define SCARD_ATR_LENGTH               MAX_ATR_SIZE
+#endif
+
+/*
+ * These values define the protocol used to
+ * communicate with the card
+ */
+#define SCARD_PROTOCOL_UNDEFINED    0x00000000  /* No protocol defined */
+#define SCARD_PROTOCOL_T0              0x00000001  /* T=0 protocol. */
+#define SCARD_PROTOCOL_T1              0x00000002  /* T=1 protocol */
+#define SCARD_PROTOCOL_RAW             0x00010000  /* Raw protocol, for memory 
card for example */
+#define SCARD_PROTOCOL_Tx               (SCARD_PROTOCOL_T0 | 
SCARD_PROTOCOL_T1) /* Can be used in SCardConnect */
+
+/*
+ * The following value is used as a length value
+ * in functions where we want the winscard dll
+ * to allocate memory for us
+ */
+#define SCARD_AUTOALLOCATE (DWORD)(-1)
+
+/*
+ * Values used by SCardEstablishContext
+ */
+#define SCARD_SCOPE_USER                       0x0000  /* context in user 
scope */
+#define SCARD_SCOPE_TERMINAL           0x0001  /* context in terminal scope */
+#define SCARD_SCOPE_SYSTEM             0x0002  /* context in system scope */
+
+/*
+ * Flags used by SCardGetStatusChange to indicate
+ * the reader status.
+ */
+#define SCARD_STATE_UNAWARE            0x0000  /* called want to know the 
current state */
+#define SCARD_STATE_IGNORE             0x0001  /* don't update the state for 
the given reader */
+#define SCARD_STATE_CHANGED            0x0002  /* reader state has not changed 
*/
+#define SCARD_STATE_UNKNOWN            0x0004  /* reader state unknown */
+#define SCARD_STATE_UNAVAILABLE        0x0008  /* reader state unavailable */
+#define SCARD_STATE_EMPTY                      0x0010  /* no card on the 
reader*/
+#define SCARD_STATE_PRESENT            0x0020  /* card present on the reader */
+#define SCARD_STATE_ATRMATCH           0x0040  /* card's ATR matches the given 
ATR */
+#define SCARD_STATE_EXCLUSIVE          0x0080  /* an exclusive connection on 
the card exists*/
+#define SCARD_STATE_INUSE                      0x0100  /* card in use but the 
connection can be shared */
+#define SCARD_STATE_MUTE                       0x0200  /* card is mute, 
doesn't answer to reset */
+#define SCARD_STATE_UNPOWERED  0x0400  /* card present but not powered */
+
+
+/*
+ * These values define how SCardConnect should
+ * connect to the card
+ */
+#define SCARD_SHARE_EXCLUSIVE          0x0001  /* connect to the card in 
exclusive mode (no other connection allowed) */
+#define SCARD_SHARE_SHARED             0x0002  /* connection can be shared 
with others */
+#define SCARD_SHARE_DIRECT             0x0003  /* access directly the reader, 
no other connection allowed */
+
+/*
+ * Values used by SCardDisconnect to specify
+ * how the card should be treated on closing
+ * the connection
+ */
+#define SCARD_LEAVE_CARD                       0x0000  /* do nothing */
+#define SCARD_RESET_CARD                       0x0001  /* reset the card */
+#define SCARD_UNPOWER_CARD             0x0002  /* unpower the card */
+#define SCARD_EJECT_CARD                       0x0003  /* eject the card from 
the reader if supported */
+
+/*
+ * Values returned by SCardStatus indicating
+ * the reader's state
+ */
+#define SCARD_UNKNOWN                  0x0001  /* state unknown */
+#define SCARD_ABSENT                           0x0002  /* no card on the 
reader */
+#define SCARD_PRESENT                          0x0004  /* card is present on 
the reader */
+#define SCARD_SWALLOWED                        0x0008  /* card inside the 
reader but not powered */
+#define SCARD_POWERED                  0x0010  /* card present and powered */
+#define SCARD_NEGOTIABLE                       0x0020  /* card present and 
ready to negotiate protocol */
+#define SCARD_SPECIFIC                         0x0040  /* card has ended 
protocol negotiation */
+
+/*
+ * definitions used by SCardGetAttrib and SCardSetAttrib for
+ * requesting and setting readers attributes
+ * Other values maybe supported
+ */
+#define SCARD_ATTR_ICC_PRESENCE                        0x00090300
+#define SCARD_ATTR_CURRENT_PROTOCOL_TYPE       0x00080201
+#define SCARD_ATTR_ATR_STRING                          0x00090303
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A      0x7FFF0003
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W      0x7FFF0005
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME_A        0x7FFF0004
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME_W        0x7FFF0006
+
+#define SCARD_ATTR_DEVICE_FRIENDLY_NAME        
WINELIB_NAME_AW(SCARD_ATTR_DEVICE_FRIENDLY_NAME_)
+#define SCARD_ATTR_DEVICE_SYSTEM_NAME          
WINELIB_NAME_AW(SCARD_ATTR_DEVICE_SYSTEM_NAME_)
+
+/*
+ * Type definitions used by all the functions
+ */
+typedef ULONG_PTR SCARDCONTEXT;
+typedef SCARDCONTEXT *PSCARDCONTEXT;
+typedef SCARDCONTEXT *LPSCARDCONTEXT;
+
+typedef ULONG_PTR SCARDHANDLE;
+typedef SCARDHANDLE *PSCARDHANDLE;
+typedef SCARDHANDLE *LPSCARDHANDLE;
+
+
+/*
+ * SCARD_READERSTATE is used by SCardGetStatusChange as an
+ * input/output for any change of readers states
+ */
+typedef struct
+{
+       LPCSTR szReader;
+       void *pvUserData;
+       unsigned long dwCurrentState;
+       unsigned long dwEventState;
+       unsigned long cbAtr;
+       unsigned char rgbAtr[MAX_ATR_SIZE];
+}
+SCARD_READERSTATEA;
+
+typedef struct
+{
+       LPCWSTR szReader;
+       void *pvUserData;
+       unsigned long dwCurrentState;
+       unsigned long dwEventState;
+       unsigned long cbAtr;
+       unsigned char rgbAtr[MAX_ATR_SIZE];
+}
+SCARD_READERSTATEW;
+
+typedef SCARD_READERSTATEA  *PSCARD_READERSTATEA,      *LPSCARD_READERSTATEA;
+
+typedef SCARD_READERSTATEW  *PSCARD_READERSTATEW,      *LPSCARD_READERSTATEW;
+
+DECL_WINELIB_TYPE_AW(SCARD_READERSTATE)
+DECL_WINELIB_TYPE_AW(PSCARD_READERSTATE)
+DECL_WINELIB_TYPE_AW(LPSCARD_READERSTATE)
+       
+/*
+ * This structure is used by SCardTransmit to communicate
+ * with the card
+ */
+typedef struct _SCARD_IO_REQUEST
+{
+       unsigned long dwProtocol;       /* protocol used for this request */
+       unsigned long cbPciLength;      /* total length of the request data, 
usually sizeof(SCARD_IO_REQUEST) */
+}
+SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
+
+typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
+
+/*
+ * This structure is used by the new functions 
+ * SCardLocateCardsByATRA and SCardLocateCardsByATRW
+ */
+typedef struct _SCARD_ATRMASK {
+    unsigned long              cbAtr;                                          
/* number of used bytes in rgbAtr and rgbMask*/
+    unsigned char              rgbAtr[MAX_ATR_SIZE];           /* ATR bytes of 
the card */
+    unsigned char              rgbMask[MAX_ATR_SIZE];          /* Mask used 
for accepted ATR values */
+} SCARD_ATRMASK;
+
+typedef SCARD_ATRMASK  *PSCARD_ATRMASK, *LPSCARD_ATRMASK;
+
+#endif
+
-- 
1.4.4.2



Reply via email to