As I was working on the winscard headers, I also did small tweaks on the winscard stub implementation. I admit it's mostly whitespace changes: * removed unneeded #includes. They should be added back when the implementation actually requires them. * use LPCBYTE like in the headers instead of 'const BYTE*' * standardize the stub traces * use 4-space indentation for functions * I would really have liked to get rid of the (unsigneg int) casts, but as the handle types are ULONG_PTRs it seems like it won't be possible. That's quite annoying. If anyone has suggestions...
So I'm posting it here for review and so Mounir IDRASSI gets a chance to tweak it further and submit it so he gets the credit (since it's his work much more then mine).
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 | 133 +++++++++++++++++ dlls/winscard/scarddb.c | 325 +++++++++++++++++++++++++++++++++++++++++ dlls/winscard/scardtracking.c | 104 +++++++++++++ dlls/winscard/winscard.c | 109 ++++++++++++++ dlls/winscard/winscard.spec | 66 +++++++++ 11 files changed, 801 insertions(+), 0 deletions(-)
diff --git a/Makefile.in b/Makefile.in index 30e0581..eb5307f 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 \ @@ -763,6 +764,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 d322b0e..712a3be 100755 --- a/configure +++ b/configure @@ -20903,6 +20903,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" @@ -21872,6 +21874,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 52323c7..6ad89eb 100644 --- a/configure.ac +++ b/configure.ac @@ -1747,6 +1747,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 100644 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 + +@MAKE_DLL_RULES@ + +@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@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..4a5fd16 --- /dev/null +++ b/dlls/winscard/scardcomm.c @@ -0,0 +1,133 @@ +/* + * Copyright 2007 Mounir IDRASSI (mounir.idrassi@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 "winscard.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winscard); + + +LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, + LPCVOID pvReserved2, + LPSCARDCONTEXT phContext) +{ + FIXME("(0x%08x %p %p %p): stub\n", dwScope, pvReserved1, pvReserved2, phContext); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return SCARD_F_UNKNOWN_ERROR; +} + + +LONG WINAPI SCardReleaseContext(SCARDCONTEXT hContext) +{ + FIXME("(0x%08x): stub\n", (unsigned int)hContext); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return SCARD_F_UNKNOWN_ERROR; +} + +LONG WINAPI SCardIsValidContext(SCARDCONTEXT hContext) +{ + FIXME("(0x%08x): stub\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): stub\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): stub\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): stub\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): stub\n", (unsigned int)hCard, dwDisposition); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return SCARD_F_UNKNOWN_ERROR; +} + +LONG WINAPI SCardBeginTransaction(SCARDHANDLE hCard) +{ + FIXME("(0x%08x): stub\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): stub\n", (unsigned int)hCard, dwDisposition); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return SCARD_F_UNKNOWN_ERROR; +} + +LONG WINAPI SCardCancelTransaction(SCARDHANDLE hCard) +{ + FIXME("(0x%08x): stub\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, + LPCBYTE 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..ffe7727 --- /dev/null +++ b/dlls/winscard/scarddb.c @@ -0,0 +1,325 @@ +/* + * Copyright 2007 Mounir IDRASSI (mounir.idrassi@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 "winscard.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winscard); + + +/* Smart 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, LPCBYTE 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, LPCBYTE 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, + LPCBYTE pbAtr, LPCBYTE 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, + LPCBYTE pbAtr, LPCBYTE 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..8b109ac --- /dev/null +++ b/dlls/winscard/scardtracking.c @@ -0,0 +1,104 @@ +/* + * Copyright 2007 Mounir IDRASSI (mounir.idrassi@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 "winscard.h" +#include "wine/debug.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): stub\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): stub\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): stub\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): stub\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): stub\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): stub\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): stub\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): stub\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 100644 index 0000000..9ed5930 --- /dev/null +++ b/dlls/winscard/winscard.c @@ -0,0 +1,109 @@ +/* + * Copyright 2007 Mounir IDRASSI (mounir.idrassi@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 "winscard.h" +#include "wine/debug.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; +} + + +/* + * event 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(void) +{ + FIXME("stub\n"); +} + + +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 100644 index 0000000..c2bbe55 --- /dev/null +++ b/dlls/winscard/winscard.spec @@ -0,0 +1,66 @@ +@ stub ClassInstall32 +@ stdcall SCardAccessNewReaderEvent() +@ 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 SCardForgetReaderW(long wstr) +@ stdcall SCardForgetReaderGroupA(long str) +@ stdcall SCardForgetReaderGroupW(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 SCardIntroduceReaderW(long wstr wstr) +@ stdcall SCardIntroduceReaderGroupA(long str) +@ stdcall SCardIntroduceReaderGroupW(long 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 SCardListReadersA(long str str ptr) +@ stdcall SCardListReadersW(long wstr wstr ptr) +@ stdcall SCardListReaderGroupsA(long str ptr) +@ stdcall SCardListReaderGroupsW(long wstr ptr) +@ stdcall SCardLocateCardsA(long str ptr long) +@ stdcall SCardLocateCardsW(long wstr ptr long) +@ stdcall SCardLocateCardsByATRA(long ptr long ptr long) +@ stdcall SCardLocateCardsByATRW(long ptr long ptr long) +@ stdcall SCardReconnect(long long long long ptr) +@ stdcall SCardReleaseAllEvents() +@ stdcall SCardReleaseContext(long) +@ stdcall SCardReleaseNewReaderEvent() +@ 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