Yes I started with this referenced discussion.
Here is a first patch. With it, Winscard can identify your smartcard reader.
Is it good enough to be sent to wine-patch ?
Here (http://www.linuxunderground.be/compteco/winscard_test.zip) a
Windows test program that identifies your smartcard reader.
PS: don't use versions 1.6.0 and 1.6.1 of pcsc-lite
(https://alioth.debian.org/tracker/?func=detailatid=410085aid=312555group_id=30105)
--
Vincent
Le 28/09/2010 13:56, Jerome Leclanche a écrit :
The referenced discussion, in case anyone's curious:
http://www.winehq.org/pipermail/wine-devel/2008-August/068462.html
J. Leclanche
On Tue, Sep 28, 2010 at 12:43 PM, Tom Wicklinetwickl...@gmail.com wrote:
Hello Vincent,
I don't believe anyone is working on winscard.dll at this time. You are more
then
welcome to work on it or any other part of Wine.
A couple years back their was a discussion about winscard.dll so you might
want to search through the wine-dev mailing list. Maybe those old
discussions
can be of some help.
Just some tips,
Make sure you use the same coding style that's already used.
Send as many test as you can.
Keep your patches small and clean.
Send patches here for review and to wine-patches for inclusion.
Welcome to the wonderful world of Wine!
Cheers,
Tom
On Tue, Sep 28, 2010 at 4:49 PM, vinyvincent.hardy...@gmail.com wrote:
Hi all,
Is anyone working on winscard.dll ?
If not, may I propose patches ?
I would like to have a working winscard.dll in wine.
--
Vincent
--
Wine is not a conclusion but a process...
From 5cf45149ef8eb35f87c93a500938c7e55349796e Mon Sep 17 00:00:00 2001
From: Vincent Hardy vincent.hardy...@gmail.com
Date: Tue, 28 Sep 2010 13:02:06 +0200
Subject: [PATCH] First winscard patch
Windows test program :
www.linuxunderground.be/compteco/winscard_test.zip
(this program identifies your smartcard reader)
---
dlls/winscard/winscard.c| 162 ---
dlls/winscard/winscard.spec |2 +-
include/winsmcrd.h |2 +
3 files changed, 156 insertions(+), 10 deletions(-)
diff --git a/dlls/winscard/winscard.c b/dlls/winscard/winscard.c
index bbf1d72..decc72c 100644
--- a/dlls/winscard/winscard.c
+++ b/dlls/winscard/winscard.c
@@ -17,16 +17,27 @@
*/
#include config.h
+#include wine/port.h
#include stdarg.h
#include windef.h
#include winbase.h
#include wine/debug.h
+#include wine/library.h
#include winscard.h
#include winternl.h
+static BOOL PCSCLite_loadlib(void);
+static BOOL PCSCLite_loadfunctions(void);
+
WINE_DEFAULT_DEBUG_CHANNEL(winscard);
+static LONG (*pSCardEstablishContext)(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
+static LONG (*pSCardIsValidContext)(SCARDCONTEXT hContext);
+static LONG (*pSCardReleaseContext)(SCARDCONTEXT hContext);
+static LONG (*pSCardListReaders)(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders);
+
static HMODULE WINSCARD_hModule;
+static void *g_pcscliteHandle = NULL;
static HANDLE g_startedEvent = NULL;
const SCARD_IO_REQUEST g_rgSCardT0Pci = { SCARD_PROTOCOL_T0, 8 };
@@ -44,6 +55,10 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
DisableThreadLibraryCalls(hinstDLL);
WINSCARD_hModule = hinstDLL;
+
+ if (PCSCLite_loadlib())
+ PCSCLite_loadfunctions();
+
/* FIXME: for now, we act as if the pcsc daemon is always started */
g_startedEvent = CreateEventA(NULL,TRUE,TRUE,NULL);
break;
@@ -51,6 +66,13 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_PROCESS_DETACH:
{
CloseHandle(g_startedEvent);
+
+/* release PCSC-lite */
+if (g_pcscliteHandle)
+{
+wine_dlclose(g_pcscliteHandle,NULL,0);
+g_pcscliteHandle = NULL;
+}
break;
}
}
@@ -58,6 +80,62 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
+static BOOL PCSCLite_loadlib(void)
+{
+char error[256];
+
+if (g_pcscliteHandle)
+return TRUE; /*already loaded*/
+else
+{
+g_pcscliteHandle = wine_dlopen(libpcsclite.so, RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error));
+if (g_pcscliteHandle)
+return TRUE;
+else
+{
+WARN(Failed to open library libpcsclite.so : %s\n, error);
+return FALSE;
+}
+}
+}
+
+static BOOL PCSCLite_loadfunctions(void)
+{
+char error[256];
+
+#define LOAD_FUNC(name) \
+if ((p##name = wine_dlsym(g_pcscliteHandle,#name, error, sizeof(error) ))); \
+else WARN( Failed to load %s: %s\n, #name, error )
+
+LOAD_FUNC(SCardIsValidContext);
+LOAD_FUNC(SCardEstablishContext);
+LOAD_FUNC(SCardReleaseContext);
+