Winscard: Add initial implementation of pcsclite helper

Mounir IDRASSI mounir.idrassi at idrix.fr
Thu Aug 28 09:19:43 CDT 2008


---
 dlls/winscard/Makefile.in       |    1 +
 dlls/winscard/pcsclite_helper.c |   66 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 dlls/winscard/pcsclite_helper.c

diff --git a/dlls/winscard/Makefile.in b/dlls/winscard/Makefile.in
index 796280d..49e3a3b 100644
--- a/dlls/winscard/Makefile.in
+++ b/dlls/winscard/Makefile.in
@@ -7,6 +7,7 @@ IMPORTLIB = winscard
 IMPORTS   = kernel32
 
 C_SRCS = \
+	pcsclite_helper.c \
 	winscard.c
 
 RC_SRCS = \
diff --git a/dlls/winscard/pcsclite_helper.c b/dlls/winscard/pcsclite_helper.c
new file mode 100644
index 0000000..67e1686
--- /dev/null
+++ b/dlls/winscard/pcsclite_helper.c
@@ -0,0 +1,66 @@
+/*
+ * Implementation of pcsclite helpers used by Winscard implementation 
+ *
+ * Copyright 2008 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 <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "wine/debug.h"
+#include "winscard.h"
+#include "pcsclite_helper.h"
+
+
+/*
+ * Definitions for RAW protocol in pcsclite and WIN32
+ * are different
+ */
+unsigned long Win32ToLiteProtocol(DWORD dwProtocol)
+{
+    if (SCARD_PROTOCOL_RAW == dwProtocol)
+    {
+        return LITE_SCARD_PROTOCOL_RAW;
+    }
+    else
+    {
+        return (unsigned long) dwProtocol;
+    }
+}
+
+DWORD LiteToWin32Protocol(unsigned long ulProtocol)
+{
+    if (LITE_SCARD_PROTOCOL_RAW == ulProtocol)
+    {
+        return SCARD_PROTOCOL_RAW;
+    }
+    else
+    {
+        return (DWORD) ulProtocol;
+    }
+}
+
+LONG TranslateToWin32Error(long lError)
+{
+    if(lError == PCSCLITE_SCARD_E_UNSUPPORTED_FEATURE)
+        return SCARD_E_UNSUPPORTED_FEATURE;
+    else if(lError == PCSCLITE_SCARD_W_INSERTED_CARD)
+        return SCARD_F_UNKNOWN_ERROR; /* FIXME: is there a better WIN32 error code */
+    else
+        return (LONG) lError;
+}
-- 
1.6.0

------=_20080828163743_33339--





More information about the wine-patches mailing list