Winscard support (for smart cards)

Mounir IDRASSI mounir.idrassi at idrix.fr
Tue May 1 09:11:52 CDT 2007


Hi all,
Followings your comments, I have rewritten the header files and split
winscard.c into smaller files.
You'll find attached with this email a patch containing only the headers
and a skeleton for this dll.
Once integrated into the source tree, I'll provide another patch (or
patches) containing the rest of the implementation.
I hope this time I did it right.

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

-------------- next part --------------
From c9e8ffa28e3f100bd9e696c3a287a75bd366ccd0 Mon Sep 17 00:00:00 2001
From: Mounir IDRASSI <mounir.idrassi at idrix.fr>
Date: Tue, 1 May 2007 15:48:25 +0200
Subject: Headers and skeleton of the wine Winscard dll

---
 Makefile.in                   |    2 +
 configure                     |    3 +
 configure.ac                  |    1 +
 dlls/Makefile.in              |    5 +
 dlls/winscard/Makefile.in     |   20 ++
 dlls/winscard/rsrc.rc         |   33 ++++
 dlls/winscard/scardcomm.c     |  147 +++++++++++++++
 dlls/winscard/scarddb.c       |  390 ++++++++++++++++++++++++++++++++++++++
 dlls/winscard/scardtracking.c |  124 ++++++++++++
 dlls/winscard/winscard.c      |  116 ++++++++++++
 dlls/winscard/winscard.spec   |   66 +++++++
 include/Makefile.in           |    3 +
 include/scarderr.h            |   70 +++++++
 include/winscard.h            |  416 +++++++++++++++++++++++++++++++++++++++++
 include/winsmcrd.h            |  190 +++++++++++++++++++
 15 files changed, 1586 insertions(+), 0 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 1f8f0c9..fd825a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -417,6 +417,7 @@ ALL_MAKEFILES = \
 	dlls/winmm/Makefile \
 	dlls/winmm/tests/Makefile \
 	dlls/winnls32/Makefile \
+	dlls/winscard/Makefile \
 	dlls/winspool.drv/Makefile \
 	dlls/winspool.drv/tests/Makefile \
 	dlls/wintab32/Makefile \
@@ -762,6 +763,7 @@ dlls/wininet/tests/Makefile: dlls/wininet/tests/Makefile.in dlls/Maketest.rules
 dlls/winmm/Makefile: dlls/winmm/Makefile.in dlls/Makedll.rules
 dlls/winmm/tests/Makefile: dlls/winmm/tests/Makefile.in dlls/Maketest.rules
 dlls/winnls32/Makefile: dlls/winnls32/Makefile.in dlls/Makedll.rules
+dlls/winscard/Makefile: dlls/winscard/Makefile.in dlls/Makedll.rules
 dlls/winspool.drv/Makefile: dlls/winspool.drv/Makefile.in dlls/Makedll.rules
 dlls/winspool.drv/tests/Makefile: dlls/winspool.drv/tests/Makefile.in dlls/Maketest.rules
 dlls/wintab32/Makefile: dlls/wintab32/Makefile.in dlls/Makedll.rules
diff --git a/configure b/configure
index 71a66ae..1a11b08 100755
--- a/configure
+++ b/configure
@@ -20839,6 +20839,8 @@ ac_config_files="$ac_config_files dlls/winmm/tests/Makefile"
 
 ac_config_files="$ac_config_files dlls/winnls32/Makefile"
 
+ac_config_files="$ac_config_files dlls/winscard/Makefile"
+
 ac_config_files="$ac_config_files dlls/winspool.drv/Makefile"
 
 ac_config_files="$ac_config_files dlls/winspool.drv/tests/Makefile"
@@ -21806,6 +21808,7 @@ do
     "dlls/winmm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winmm/Makefile" ;;
     "dlls/winmm/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winmm/tests/Makefile" ;;
     "dlls/winnls32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winnls32/Makefile" ;;
+    "dlls/winscard/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winscard/Makefile" ;;    
     "dlls/winspool.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/Makefile" ;;
     "dlls/winspool.drv/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/tests/Makefile" ;;
     "dlls/wintab32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wintab32/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index ddec5f4..19026c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1744,6 +1744,7 @@ AC_CONFIG_FILES([dlls/wininet/tests/Makefile])
 AC_CONFIG_FILES([dlls/winmm/Makefile])
 AC_CONFIG_FILES([dlls/winmm/tests/Makefile])
 AC_CONFIG_FILES([dlls/winnls32/Makefile])
+AC_CONFIG_FILES([dlls/winscard/Makefile])
 AC_CONFIG_FILES([dlls/winspool.drv/Makefile])
 AC_CONFIG_FILES([dlls/winspool.drv/tests/Makefile])
 AC_CONFIG_FILES([dlls/wintab32/Makefile])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index f9707e7..31f3ef8 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -205,6 +205,7 @@ BASEDIRS = \
 	wininet \
 	winmm \
 	winnls32 \
+	winscard \
 	winspool.drv \
 	wintab32 \
 	wintrust \
@@ -571,6 +572,7 @@ IMPORT_LIBS = \
 	wininet/libwininet.$(IMPLIBEXT) \
 	winmm/libwinmm.$(IMPLIBEXT) \
 	winnls32/libwinnls32.$(IMPLIBEXT) \
+	winscard/libwinscard.$(IMPLIBEXT) \
 	winspool.drv/libwinspool.$(IMPLIBEXT) \
 	wintab32/libwintab32.$(IMPLIBEXT) \
 	wintrust/libwintrust.$(IMPLIBEXT) \
@@ -920,6 +922,9 @@ winmm/libwinmm.$(IMPLIBEXT): winmm/winmm.spec $(WINEBUILD)
 
 winnls32/libwinnls32.$(IMPLIBEXT): winnls32/winnls32.spec $(WINEBUILD)
 	@cd winnls32 && $(MAKE) libwinnls32.$(IMPLIBEXT)
+	
+winscard/libwinscard.$(IMPLIBEXT): winscard/winscard.spec $(WINEBUILD)
+	@cd winscard && $(MAKE) libwinscard.$(IMPLIBEXT)
 
 winspool.drv/libwinspool.$(IMPLIBEXT): winspool.drv/winspool.drv.spec $(WINEBUILD)
 	@cd winspool.drv && $(MAKE) libwinspool.$(IMPLIBEXT)
diff --git a/dlls/winscard/Makefile.in b/dlls/winscard/Makefile.in
new file mode 100755
index 0000000..9ce7ad6
--- /dev/null
+++ b/dlls/winscard/Makefile.in
@@ -0,0 +1,20 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = winscard.dll
+IMPORTLIB = libwinscard.$(IMPLIBEXT)
+IMPORTS   = kernel32
+
+C_SRCS = \
+	scarddb.c \
+	scardcomm.c \
+	scardtracking.c \
+	winscard.c
+
+RC_SRCS = \
+	rsrc.rc
+
+ at MAKE_DLL_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/winscard/rsrc.rc b/dlls/winscard/rsrc.rc
new file mode 100644
index 0000000..8226e9d
--- /dev/null
+++ b/dlls/winscard/rsrc.rc
@@ -0,0 +1,33 @@
+/*
+ * Top level resource file for winscard.dll
+ *
+ * Copyright 2007 Mounir IDRASSI  (mounir.idrassi at idrix.fr, 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
+ */
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winver.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#define WINE_FILEDESCRIPTION_STR "Wine Smart Card API"
+#define WINE_FILENAME_STR "winscard.dll"
+#define WINE_FILEVERSION 5,1,2600,2180
+#define WINE_FILEVERSION_STR "5.1.2600.2180"
+
+#include "wine/wine_common_ver.rc"
diff --git a/dlls/winscard/scardcomm.c b/dlls/winscard/scardcomm.c
new file mode 100644
index 0000000..1a3f637
--- /dev/null
+++ b/dlls/winscard/scardcomm.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  (mounir.idrassi at idrix.fr, 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
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "wine/debug.h"
+#include "wine/library.h"
+#include "wine/unicode.h"
+#include <winscard.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(winscard);
+
+LONG WINAPI SCardEstablishContext(DWORD dwScope,LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
+{
+	FIXME(" 0x%08X %p %p %p\n",dwScope,pvReserved1,pvReserved2,phContext);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+
+LONG WINAPI SCardReleaseContext(SCARDCONTEXT hContext)
+{
+	FIXME(" 0x%08X\n", (unsigned int) hContext);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardIsValidContext(SCARDCONTEXT hContext)
+{
+	FIXME(" 0x%08X\n", (unsigned int) hContext);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+
+LONG WINAPI SCardConnectA(
+	SCARDCONTEXT hContext,
+	LPCSTR szReader,
+	DWORD dwShareMode,
+	DWORD dwPreferredProtocols,
+	LPSCARDHANDLE phCard, 
+	LPDWORD pdwActiveProtocol)
+{
+	FIXME(" 0x%08X %s 0x%08X 0x%08X %p %p\n",(unsigned int) hContext,debugstr_a(szReader),dwShareMode,dwPreferredProtocols,phCard,pdwActiveProtocol);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+						
+LONG WINAPI SCardConnectW(SCARDCONTEXT hContext,
+	LPCWSTR szReader,
+	DWORD dwShareMode,
+	DWORD dwPreferredProtocols,
+	LPSCARDHANDLE phCard, 
+	LPDWORD pdwActiveProtocol)
+{
+	FIXME(" 0x%08X %s 0x%08X 0x%08X %p %p\n",(unsigned int) hContext,debugstr_w(szReader),dwShareMode,dwPreferredProtocols,phCard,pdwActiveProtocol);	
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardReconnect(SCARDHANDLE hCard,
+	DWORD dwShareMode,
+	DWORD dwPreferredProtocols,
+	DWORD dwInitialization, 
+	LPDWORD pdwActiveProtocol)
+{
+	FIXME(" 0x%08X 0x%08X 0x%08X 0x%08X %p\n",(unsigned int) hCard,dwShareMode,dwPreferredProtocols,dwInitialization,pdwActiveProtocol);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition)
+{
+	FIXME(" 0x%08X 0x%08X\n",(unsigned int) hCard,dwDisposition);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardBeginTransaction(SCARDHANDLE hCard)
+{
+	FIXME(" 0x%08X\n",(unsigned int) hCard);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
+{	
+	FIXME(" 0x%08X 0x%08X\n",(unsigned int) hCard,dwDisposition);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardCancelTransaction(SCARDHANDLE hCard)
+{
+	FIXME(" 0x%08X\n",(unsigned int) hCard);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardControl(
+	SCARDHANDLE hCard, 
+	DWORD dwControlCode,
+	LPCVOID pbSendBuffer, 
+	DWORD cbSendLength,
+	LPVOID pbRecvBuffer, 
+	DWORD cbRecvLength, 
+	LPDWORD lpBytesReturned)
+{
+	FIXME("0x%08X 0x%08X %p %d %p %d %p - stub\n",(unsigned int) hCard,dwControlCode,pbSendBuffer,cbSendLength,pbRecvBuffer,cbRecvLength,lpBytesReturned);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardTransmit(
+	SCARDHANDLE hCard,
+	LPCSCARD_IO_REQUEST pioSendPci,
+	const BYTE* pbSendBuffer, 
+	DWORD cbSendLength,
+	LPSCARD_IO_REQUEST pioRecvPci,
+	LPBYTE pbRecvBuffer, 
+	LPDWORD pcbRecvLength)
+{
+	FIXME("0x%08X %p %p %d %p %p %p - stub\n",(unsigned int)hCard,pioSendPci,pbSendBuffer,cbSendLength,pioRecvPci,pbRecvBuffer,pcbRecvLength);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
diff --git a/dlls/winscard/scarddb.c b/dlls/winscard/scarddb.c
new file mode 100644
index 0000000..4bc31ff
--- /dev/null
+++ b/dlls/winscard/scarddb.c
@@ -0,0 +1,390 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  (mounir.idrassi at idrix.fr, 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
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "wine/debug.h"
+#include "wine/library.h"
+#include "wine/unicode.h"
+#include <winscard.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(winscard);
+
+/*
+ *  smar cards database functions. Almost all of them are stubs but they need to
+ *  be present as many applications call them and are not affected if they return
+ *  an error
+ */
+LONG WINAPI SCardListCardsA(
+		SCARDCONTEXT hContext,
+		const BYTE* pbAtr,
+		LPCGUID rgquidInterfaces,
+		DWORD cguidInterfaceCount,
+		LPSTR mszCards,
+		LPDWORD pcchCards)
+{
+	FIXME("0x%08X %p %p %d %p %p - stub\n",(unsigned int) hContext,pbAtr,rgquidInterfaces,cguidInterfaceCount,mszCards,pcchCards);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardListCardsW(
+        SCARDCONTEXT hContext,
+        const BYTE* pbAtr,
+        LPCGUID rgquidInterfaces,
+        DWORD cguidInterfaceCount,
+	LPWSTR mszCards,
+	LPDWORD pcchCards)
+{
+	FIXME("0x%08X %p %p %d %p %p - stub\n",(unsigned int)hContext,pbAtr,rgquidInterfaces,cguidInterfaceCount,mszCards,pcchCards);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+	
+LONG WINAPI SCardListInterfacesA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCard,
+	LPGUID pguidInterfaces,
+	LPDWORD pcguidInterfaces)
+{
+	FIXME("0x%08X %s %p %p - stub\n",(unsigned int)hContext,debugstr_a(szCard),pguidInterfaces,pcguidInterfaces);
+	return SCARD_E_UNKNOWN_CARD;
+}
+
+LONG WINAPI SCardListInterfacesW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCard,
+	LPGUID pguidInterfaces,
+	LPDWORD pcguidInterfaces)
+{	
+	FIXME("0x%08X %s %p %p - stub\n",(unsigned int)hContext,debugstr_w(szCard),pguidInterfaces,pcguidInterfaces);
+	return SCARD_E_UNKNOWN_CARD;	
+}
+  
+LONG WINAPI SCardGetProviderIdA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCard,
+	LPGUID pguidProviderId)
+{
+	FIXME("0x%08X %s %p - stub\n",(unsigned int)hContext,debugstr_a(szCard),pguidProviderId);
+	if(!pguidProviderId)
+		return SCARD_E_INVALID_PARAMETER;
+	return SCARD_E_UNKNOWN_CARD;
+}
+	
+LONG WINAPI SCardGetProviderIdW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCard,
+	LPGUID pguidProviderId)
+{
+	FIXME("0x%08X %s %p - stub\n",(unsigned int)hContext,debugstr_w(szCard),pguidProviderId);
+	if(!pguidProviderId)
+		return SCARD_E_INVALID_PARAMETER;
+	return SCARD_E_UNKNOWN_CARD;	
+}
+	
+LONG WINAPI SCardGetCardTypeProviderNameA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCardName,
+	DWORD dwProviderId,
+	LPSTR szProvider,
+	LPDWORD pcchProvider)
+{
+	FIXME("0x%08X %s 0x%08X %p %p - stub\n",(unsigned int)hContext,debugstr_a(szCardName),dwProviderId,szProvider,pcchProvider);
+	return SCARD_E_UNKNOWN_CARD;
+}
+	
+LONG WINAPI SCardGetCardTypeProviderNameW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCardName,
+	DWORD dwProviderId,
+	LPWSTR szProvider,
+	LPDWORD pcchProvider)
+{
+	FIXME("0x%08X %s 0x%08X %p %p - stub\n",(unsigned int)hContext,debugstr_w(szCardName),dwProviderId,szProvider,pcchProvider);
+	return SCARD_E_UNKNOWN_CARD;	
+}
+
+LONG WINAPI SCardIntroduceReaderGroupA(
+	SCARDCONTEXT hContext,
+	LPCSTR szGroupName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_a(szGroupName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardIntroduceReaderGroupW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szGroupName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_w(szGroupName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardForgetReaderGroupA(
+	SCARDCONTEXT hContext,
+	LPCSTR szGroupName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_a(szGroupName));
+	return SCARD_S_SUCCESS;	
+}
+	
+LONG WINAPI SCardForgetReaderGroupW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szGroupName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_w(szGroupName));
+	return SCARD_S_SUCCESS;		
+}
+
+LONG WINAPI SCardIntroduceReaderA(
+	SCARDCONTEXT hContext,
+	LPCSTR szReaderName,
+	LPCSTR szDeviceName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int)hContext,debugstr_a(szReaderName),debugstr_a(szDeviceName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardIntroduceReaderW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szReaderName,
+	LPCWSTR szDeviceName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int)hContext,debugstr_w(szReaderName),debugstr_w(szDeviceName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardForgetReaderA(
+	SCARDCONTEXT hContext,
+	LPCSTR szReaderName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_a(szReaderName));
+	return SCARD_S_SUCCESS;		
+}
+
+LONG WINAPI SCardForgetReaderW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szReaderName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int)hContext,debugstr_w(szReaderName));	
+	return SCARD_S_SUCCESS;	
+}
+
+LONG WINAPI SCardAddReaderToGroupA(
+	SCARDCONTEXT hContext,
+	LPCSTR szReaderName,
+	LPCSTR szGroupName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int) hContext, debugstr_a( szReaderName), debugstr_a(szGroupName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardAddReaderToGroupW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szReaderName,
+	LPCWSTR szGroupName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int) hContext, debugstr_w( szReaderName), debugstr_w(szGroupName));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardRemoveReaderFromGroupA(
+	SCARDCONTEXT hContext,
+	LPCSTR szReaderName,
+	LPCSTR szGroupName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int) hContext, debugstr_a( szReaderName), debugstr_a(szGroupName));
+	return SCARD_S_SUCCESS;	
+}
+	
+LONG WINAPI SCardRemoveReaderFromGroupW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szReaderName,
+	LPCWSTR szGroupName)
+{
+	FIXME("0x%08X %s %s - stub\n",(unsigned int) hContext, debugstr_w( szReaderName), debugstr_w(szGroupName));
+	return SCARD_S_SUCCESS;		
+}
+
+LONG WINAPI SCardIntroduceCardTypeA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCardName,
+	LPCGUID pguidPrimaryProvider,
+	LPCGUID rgguidInterfaces,
+	DWORD dwInterfaceCount,
+	const BYTE* pbAtr,
+	const BYTE* pbAtrMask,
+	DWORD cbAtrLen)
+{
+	FIXME("0x%08X %s %p %p %d %p %p %d - stub\n",(unsigned int) hContext, debugstr_a(szCardName),pguidPrimaryProvider,rgguidInterfaces,dwInterfaceCount,pbAtr,pbAtrMask,cbAtrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardIntroduceCardTypeW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCardName,
+	LPCGUID pguidPrimaryProvider,
+	LPCGUID rgguidInterfaces,
+	DWORD dwInterfaceCount,
+	const BYTE* pbAtr,
+	const BYTE* pbAtrMask,
+	DWORD cbAtrLen)
+{
+	FIXME("0x%08X %s %p %p %d %p %p %d - stub\n",(unsigned int) hContext, debugstr_w(szCardName),pguidPrimaryProvider,rgguidInterfaces,dwInterfaceCount,pbAtr,pbAtrMask,cbAtrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+	
+
+LONG WINAPI SCardSetCardTypeProviderNameA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCardName,
+	DWORD dwProviderId,
+	LPCSTR szProvider)
+{
+	FIXME("0x%08X %s 0x%08X %s - stub\n",(unsigned int) hContext, debugstr_a(szCardName),dwProviderId,debugstr_a(szProvider));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardSetCardTypeProviderNameW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCardName,
+	DWORD dwProviderId,
+	LPCWSTR szProvider)
+{
+	FIXME("0x%08X %s 0x%08X %s - stub\n",(unsigned int) hContext, debugstr_w(szCardName),dwProviderId,debugstr_w(szProvider));
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardForgetCardTypeA(
+	SCARDCONTEXT hContext,
+	LPCSTR szCardName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int) hContext, debugstr_a(szCardName));
+	return SCARD_E_UNKNOWN_CARD;
+}
+	
+LONG WINAPI SCardForgetCardTypeW(
+	SCARDCONTEXT hContext,
+	LPCWSTR szCardName)
+{
+	FIXME("0x%08X %s - stub\n",(unsigned int) hContext, debugstr_w(szCardName));
+	return SCARD_E_UNKNOWN_CARD;	
+}
+	
+LONG WINAPI SCardLocateCardsA(
+	SCARDCONTEXT hContext,
+	LPCSTR mszCards,
+	LPSCARD_READERSTATEA rgReaderStates,
+	DWORD cReaders)
+{
+	FIXME("0x%08X %s %p %d - stub\n",(unsigned int) hContext, debugstr_a(mszCards),rgReaderStates,cReaders);
+	return SCARD_E_UNKNOWN_CARD;
+}
+	
+LONG WINAPI SCardLocateCardsW(
+	SCARDCONTEXT hContext,
+	LPCWSTR mszCards,
+	LPSCARD_READERSTATEW rgReaderStates,
+	DWORD cReaders)
+{
+	FIXME("0x%08X %s %p %d - stub\n",(unsigned int) hContext, debugstr_w(mszCards),rgReaderStates,cReaders);
+	return SCARD_E_UNKNOWN_CARD;	
+}
+
+LONG WINAPI SCardLocateCardsByATRA(
+	SCARDCONTEXT hContext,
+	LPSCARD_ATRMASK rgAtrMasks,
+	DWORD cAtrs,
+	LPSCARD_READERSTATEA rgReaderStates,
+	DWORD cReaders)
+{
+	FIXME("0x%08X %p %d %p %d - stub\n",(unsigned int) hContext, rgAtrMasks, cAtrs, rgReaderStates,  cReaders);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+	
+LONG WINAPI SCardLocateCardsByATRW(
+	SCARDCONTEXT hContext,
+	LPSCARD_ATRMASK rgAtrMasks,
+	DWORD cAtrs,
+	LPSCARD_READERSTATEW rgReaderStates,
+	DWORD cReaders)
+{
+	FIXME("0x%08X %p %d %p %d - stub\n",(unsigned int) hContext, rgAtrMasks, cAtrs, rgReaderStates,  cReaders);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+
+LONG WINAPI SCardListReaderGroupsA(
+	SCARDCONTEXT hContext,
+	LPSTR mszGroups, 
+	LPDWORD pcchGroups)
+{	
+	FIXME(" 0x%08X %p %p - stub\n",(unsigned int) hContext,mszGroups,pcchGroups);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;		
+}
+		
+LONG WINAPI SCardListReaderGroupsW(
+	SCARDCONTEXT hContext,
+	LPWSTR mszGroups, 
+	LPDWORD pcchGroups)
+{
+	FIXME(" 0x%08X %p %p - stub\n",(unsigned int) hContext,mszGroups,pcchGroups);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+	
+LONG WINAPI SCardListReadersA(
+	SCARDCONTEXT hContext,
+	LPCSTR mszGroups,
+	LPSTR mszReaders, 
+	LPDWORD pcchReaders)
+{
+	FIXME(" 0x%08X %p %p %p - stub\n",(unsigned int) hContext,mszGroups,mszReaders,pcchReaders);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardListReadersW(
+	SCARDCONTEXT hContext,
+	LPCWSTR mszGroups,
+	LPWSTR mszReaders, 
+	LPDWORD pcchReaders)
+{
+	FIXME(" 0x%08X %p %p %p - stub\n",(unsigned int) hContext,mszGroups,mszReaders,pcchReaders);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
diff --git a/dlls/winscard/scardtracking.c b/dlls/winscard/scardtracking.c
new file mode 100644
index 0000000..ede697e
--- /dev/null
+++ b/dlls/winscard/scardtracking.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  (mounir.idrassi at idrix.fr, 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
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "wine/debug.h"
+#include "wine/library.h"
+#include "wine/unicode.h"
+#include <winscard.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(winscard);
+
+LONG WINAPI SCardState(
+	SCARDHANDLE hCard,
+	LPDWORD pdwState,
+	LPDWORD pdwProtocol,
+	LPBYTE pbAtr,
+	LPDWORD pcbAtrLen)
+{
+	FIXME(" 0x%08X %p %p %p %p\n",(unsigned int) hCard,pdwState,pdwProtocol,pbAtr,pcbAtrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardStatusA(
+	SCARDHANDLE hCard,
+	LPSTR mszReaderNames, 
+	LPDWORD pcchReaderLen,
+	LPDWORD pdwState,
+	LPDWORD pdwProtocol,
+	LPBYTE pbAtr, 
+	LPDWORD pcbAtrLen)
+{
+	FIXME(" 0x%08X %p %p %p %p %p %p\n",(unsigned int) hCard,mszReaderNames,pcchReaderLen,pdwState,pdwProtocol,pbAtr,pcbAtrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+		
+LONG WINAPI SCardStatusW(
+	SCARDHANDLE hCard,
+	LPWSTR mszReaderNames, 
+	LPDWORD pcchReaderLen,
+	LPDWORD pdwState,
+	LPDWORD pdwProtocol,
+	LPBYTE pbAtr, 
+	LPDWORD pcbAtrLen)
+{
+	FIXME(" 0x%08X %p %p %p %p %p %p\n",(unsigned int) hCard,mszReaderNames,pcchReaderLen,pdwState,pdwProtocol,pbAtr,pcbAtrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardGetStatusChangeA(
+	SCARDCONTEXT hContext,
+	DWORD dwTimeout,
+	LPSCARD_READERSTATEA rgReaderStates, 
+	DWORD cReaders)
+{
+	FIXME(" 0x%08X 0x%08X %p 0x%08X\n",(unsigned int) hContext, dwTimeout,rgReaderStates,cReaders);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+		
+LONG WINAPI SCardGetStatusChangeW(
+	SCARDCONTEXT hContext,
+	DWORD dwTimeout,
+	LPSCARD_READERSTATEW rgReaderStates, 
+	DWORD cReaders)
+{
+	FIXME(" 0x%08X 0x%08X %p 0x%08X\n",(unsigned int) hContext, dwTimeout,rgReaderStates,cReaders);	
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+		
+LONG WINAPI SCardCancel(SCARDCONTEXT hContext)
+{
+	FIXME(" 0x%08X \n",(unsigned int) hContext);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardGetAttrib(
+	SCARDHANDLE hCard, 
+	DWORD dwAttrId,
+	LPBYTE pbAttr, 
+	LPDWORD pcbAttrLen)
+{
+	FIXME(" 0x%08X 0x%08X %p %p \n",(unsigned int) hCard, dwAttrId,pbAttr,pcbAttrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
+
+LONG WINAPI SCardSetAttrib(
+	SCARDHANDLE hCard, 
+	DWORD dwAttrId,
+	const BYTE* pbAttr, 
+	DWORD cbAttrLen)
+{
+	FIXME(" 0x%08X 0x%08X %p 0x%08X \n",(unsigned int) hCard,dwAttrId,pbAttr,cbAttrLen);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;
+}
diff --git a/dlls/winscard/winscard.c b/dlls/winscard/winscard.c
new file mode 100755
index 0000000..30186f4
--- /dev/null
+++ b/dlls/winscard/winscard.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2007 Mounir IDRASSI  (mounir.idrassi at idrix.fr, 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
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "wine/debug.h"
+#include "wine/library.h"
+#include "wine/unicode.h"
+#include <winscard.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(winscard);
+
+static HMODULE WINSCARD_hModule;
+
+SCARD_IO_REQUEST g_rgSCardT0Pci = { SCARD_PROTOCOL_T0, 8 };
+SCARD_IO_REQUEST g_rgSCardT1Pci = { SCARD_PROTOCOL_T1, 8 };
+SCARD_IO_REQUEST g_rgSCardRawPci = { SCARD_PROTOCOL_RAW, 8 };
+
+ SCARD_IO_REQUEST* SCARD_PCI_T0 = NULL;
+ SCARD_IO_REQUEST* SCARD_PCI_T1 = NULL;
+ SCARD_IO_REQUEST* SCARD_PCI_RAW = NULL;
+
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
+
+    switch (fdwReason) {
+        case DLL_PROCESS_ATTACH:
+        {
+		DisableThreadLibraryCalls(hinstDLL);
+		WINSCARD_hModule = hinstDLL;
+		/* initialize protocol requests pointers */
+		SCARD_PCI_T0 		= &g_rgSCardT0Pci;
+		SCARD_PCI_T1 		= &g_rgSCardT1Pci;
+		SCARD_PCI_RAW 	= &g_rgSCardRawPci;
+		break;
+        }
+        case DLL_PROCESS_DETACH:
+        {
+		
+		break;
+        }
+    }
+
+    return TRUE;
+}
+	
+
+/*
+  * events functions
+  */
+  
+HANDLE WINAPI SCardAccessNewReaderEvent()
+{
+	FIXME("stub\n");
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return NULL;
+}
+
+long WINAPI SCardReleaseAllEvents()
+{
+	FIXME("stub\n");
+
+	return SCARD_S_SUCCESS;
+}
+
+long WINAPI SCardReleaseNewReaderEvent(HANDLE hNewReaderEventHandle)
+{
+	FIXME("stub\n");
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_S_SUCCESS;
+}
+
+HANDLE WINAPI SCardAccessStartedEvent()
+{
+	FIXME("stub\n");
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);	
+	return NULL;
+}
+
+void WINAPI SCardReleaseStartedEvent(HANDLE hStartedEventHandle)
+{
+	FIXME("0x%08X - stub\n",(unsigned int) hStartedEventHandle);
+}
+
+
+LONG WINAPI SCardFreeMemory( SCARDCONTEXT hContext,LPCVOID pvMem)
+{
+	FIXME("0x%08X %p - stub\n",(unsigned int)hContext,pvMem);
+	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+	return SCARD_F_UNKNOWN_ERROR;	
+}
+	
+			
diff --git a/dlls/winscard/winscard.spec b/dlls/winscard/winscard.spec
new file mode 100755
index 0000000..f636d46
--- /dev/null
+++ b/dlls/winscard/winscard.spec
@@ -0,0 +1,66 @@
+@ stub ClassInstall32
+@ stdcall SCardAccessNewReaderEvent()
+@ stdcall SCardReleaseAllEvents()
+@ stdcall SCardReleaseNewReaderEvent()
+@ stdcall SCardAccessStartedEvent()
+@ stdcall SCardAddReaderToGroupA(long str str)
+@ stdcall SCardAddReaderToGroupW(long wstr wstr)
+@ stdcall SCardBeginTransaction(long)
+@ stdcall SCardCancel(long)
+@ stdcall SCardConnectA(long str long long ptr ptr)
+@ stdcall SCardConnectW(long wstr long long ptr ptr)
+@ stdcall SCardControl(long long ptr long ptr long ptr)
+@ stdcall SCardDisconnect(long long)
+@ stdcall SCardEndTransaction(long long)
+@ stdcall SCardEstablishContext(long ptr ptr ptr)
+@ stdcall SCardForgetCardTypeA(long str)
+@ stdcall SCardForgetCardTypeW(long wstr)
+@ stdcall SCardForgetReaderA(long str)
+@ stdcall SCardForgetReaderGroupA(long str)
+@ stdcall SCardForgetReaderGroupW(long wstr)
+@ stdcall SCardForgetReaderW(long wstr)
+@ stdcall SCardFreeMemory(long ptr)
+@ stdcall SCardGetAttrib(long long ptr ptr)
+@ stdcall SCardGetCardTypeProviderNameA(long str long str ptr)
+@ stdcall SCardGetCardTypeProviderNameW(long wstr long wstr ptr)
+@ stdcall SCardGetProviderIdA(long str ptr)
+@ stdcall SCardGetProviderIdW(long wstr ptr)
+@ stdcall SCardGetStatusChangeA(long long ptr long)
+@ stdcall SCardGetStatusChangeW(long long ptr long)
+@ stdcall SCardIntroduceCardTypeA(long str ptr ptr long ptr ptr long)
+@ stdcall SCardIntroduceCardTypeW(long wstr ptr ptr long ptr ptr long)
+@ stdcall SCardIntroduceReaderA(long str str)
+@ stdcall SCardIntroduceReaderGroupA(long str)
+@ stdcall SCardIntroduceReaderGroupW(long wstr)
+@ stdcall SCardIntroduceReaderW(long wstr wstr)
+@ stdcall SCardIsValidContext(long)
+@ stdcall SCardListCardsA(long ptr ptr long str ptr)
+@ stdcall SCardListCardsW(long ptr ptr long wstr ptr)
+@ stdcall SCardListInterfacesA(long str ptr ptr)
+@ stdcall SCardListInterfacesW(long wstr ptr ptr)
+@ stdcall SCardListReaderGroupsA(long str ptr)
+@ stdcall SCardListReaderGroupsW(long wstr ptr)
+@ stdcall SCardListReadersA(long str str ptr)
+@ stdcall SCardListReadersW(long wstr wstr ptr)
+@ stdcall SCardLocateCardsA(long str ptr long)
+@ stdcall SCardLocateCardsByATRA(long ptr long ptr long)
+@ stdcall SCardLocateCardsByATRW(long ptr long ptr long)
+@ stdcall SCardLocateCardsW(long wstr ptr long)
+@ stdcall SCardReconnect(long long long long ptr)
+@ stdcall SCardReleaseContext(long)
+@ stdcall SCardReleaseStartedEvent()
+@ stdcall SCardRemoveReaderFromGroupA(long str str)
+@ stdcall SCardRemoveReaderFromGroupW(long wstr wstr)
+@ stdcall SCardSetAttrib(long long ptr long)
+@ stdcall SCardSetCardTypeProviderNameA(long str long str)
+@ stdcall SCardSetCardTypeProviderNameW(long wstr long wstr)
+@ stdcall SCardState(long ptr ptr ptr ptr)
+@ stdcall SCardStatusA(long str ptr ptr ptr ptr ptr)
+@ stdcall SCardStatusW(long wstr ptr ptr ptr ptr ptr)
+@ stdcall SCardTransmit(long ptr ptr long ptr ptr ptr)
+@ extern g_rgSCardRawPci
+@ extern g_rgSCardT0Pci	
+@ extern g_rgSCardT1Pci
+@ extern SCARD_PCI_RAW
+@ extern SCARD_PCI_T0
+@ extern SCARD_PCI_T1
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  (mounir.idrassi at idrix.fr, 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  (mounir.idrassi at idrix.fr, 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  (mounir.idrassi at idrix.fr, 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


More information about the wine-devel mailing list