PATCH - Added wrapper dll for ct-api (CardTerminal API)
Steven Edwards
winehacker at gmail.com
Fri Jun 15 21:29:12 CDT 2007
Resending on behalf of Christian Eggers as an ambassador. He said his
last attempt to send bounced
I know this is not a dll that ships with Windows but neither is
capi2032.dll it seems. Doing a google search on ctapi32 shows some
people using it on windows though, so it does make it a good candidate
to go in as I guess the native version will never work.
>From dde022c61beb5a98ccd767f8b8509f6d9b982c98 Mon Sep 17 00:00:00 2001
From: Christian Eggers <christian at omnibook.wgnetz.xx>
Date: Tue, 12 Jun 2007 21:59:35 +0200
Subject: Added wrapper dll for ct-api (CardTerminal API):
- permits access to chip card terminals which provides a ct-api (for
example ReinerSCT cyberJack)
- needs libctapi.so (possibly as symlink) or ctapi-cyberjack.so at runtime
--
Steven Edwards
"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo
-------------- next part --------------
From dde022c61beb5a98ccd767f8b8509f6d9b982c98 Mon Sep 17 00:00:00 2001
From: Christian Eggers <christian at omnibook.wgnetz.xx>
Date: Tue, 12 Jun 2007 21:59:35 +0200
Subject: Added wrapper dll for ct-api (CardTerminal API):
- permits access to chip card terminals which provides a ct-api (for example ReinerSCT cyberJack)
- needs libctapi.so (possibly as symlink) or ctapi-cyberjack.so at runtime
---
Makefile.in | 2 +
configure | 3 +
configure.ac | 1 +
dlls/Makefile.in | 5 ++
dlls/ctapi32/Makefile.in | 13 +++++
dlls/ctapi32/ctapi.h | 108 +++++++++++++++++++++++++++++++++++++++++++++
dlls/ctapi32/ctapi32.c | 93 ++++++++++++++++++++++++++++++++++++++
dlls/ctapi32/ctapi32.spec | 3 +
8 files changed, 228 insertions(+), 0 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index fbf9268..cc01362 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -188,6 +188,7 @@ ALL_MAKEFILES = \
dlls/crypt32/tests/Makefile \
dlls/cryptdll/Makefile \
dlls/cryptnet/Makefile \
+ dlls/ctapi32/Makefile \
dlls/ctl3d32/Makefile \
dlls/d3d8/Makefile \
dlls/d3d8/tests/Makefile \
@@ -541,6 +542,7 @@ dlls/crypt32/Makefile: dlls/crypt32/Make
dlls/crypt32/tests/Makefile: dlls/crypt32/tests/Makefile.in dlls/Maketest.rules
dlls/cryptdll/Makefile: dlls/cryptdll/Makefile.in dlls/Makedll.rules
dlls/cryptnet/Makefile: dlls/cryptnet/Makefile.in dlls/Makedll.rules
+dlls/ctapi32/Makefile: dlls/ctapi32/Makefile.in dlls/Makedll.rules
dlls/ctl3d32/Makefile: dlls/ctl3d32/Makefile.in dlls/Makedll.rules
dlls/d3d8/Makefile: dlls/d3d8/Makefile.in dlls/Makedll.rules
dlls/d3d8/tests/Makefile: dlls/d3d8/tests/Makefile.in dlls/Maketest.rules
diff --git a/configure b/configure
index 2353f9f..99201d8 100755
--- a/configure
+++ b/configure
@@ -20440,6 +20440,8 @@ ac_config_files="$ac_config_files dlls/c
ac_config_files="$ac_config_files dlls/cryptnet/Makefile"
+ac_config_files="$ac_config_files dlls/ctapi32/Makefile"
+
ac_config_files="$ac_config_files dlls/ctl3d32/Makefile"
ac_config_files="$ac_config_files dlls/d3d8/Makefile"
@@ -21652,6 +21654,7 @@ do
"dlls/crypt32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/crypt32/tests/Makefile" ;;
"dlls/cryptdll/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/cryptdll/Makefile" ;;
"dlls/cryptnet/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/cryptnet/Makefile" ;;
+ "dlls/ctapi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ctapi32/Makefile" ;;
"dlls/ctl3d32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ctl3d32/Makefile" ;;
"dlls/d3d8/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3d8/Makefile" ;;
"dlls/d3d8/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3d8/tests/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 72359fe..11bcd1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1471,6 +1471,7 @@ AC_CONFIG_FILES([dlls/crypt32/Makefile])
AC_CONFIG_FILES([dlls/crypt32/tests/Makefile])
AC_CONFIG_FILES([dlls/cryptdll/Makefile])
AC_CONFIG_FILES([dlls/cryptnet/Makefile])
+AC_CONFIG_FILES([dlls/ctapi32/Makefile])
AC_CONFIG_FILES([dlls/ctl3d32/Makefile])
AC_CONFIG_FILES([dlls/d3d8/Makefile])
AC_CONFIG_FILES([dlls/d3d8/tests/Makefile])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 9a56e3b..3aba6b0 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -39,6 +39,7 @@ BASEDIRS = \
crypt32 \
cryptdll \
cryptnet \
+ ctapi32 \
ctl3d32 \
d3d8 \
d3d9 \
@@ -482,6 +483,7 @@ IMPORT_LIBS = \
crtdll/libcrtdll.$(IMPLIBEXT) \
crypt32/libcrypt32.$(IMPLIBEXT) \
cryptdll/libcryptdll.$(IMPLIBEXT) \
+ ctapi32/libctapi32.$(IMPLIBEXT) \
ctl3d32/libctl3d32.$(IMPLIBEXT) \
d3d8/libd3d8.$(IMPLIBEXT) \
d3d9/libd3d9.$(IMPLIBEXT) \
@@ -645,6 +647,9 @@ crypt32/libcrypt32.$(IMPLIBEXT): crypt32
cryptdll/libcryptdll.$(IMPLIBEXT): cryptdll/cryptdll.spec $(WINEBUILD)
@cd cryptdll && $(MAKE) libcryptdll.$(IMPLIBEXT)
+ctapi32/libctapi32.$(IMPLIBEXT): ctapi32/ctapi32.spec $(WINEBUILD)
+ @cd ctapi32 && $(MAKE) libctapi32.$(IMPLIBEXT)
+
ctl3d32/libctl3d32.$(IMPLIBEXT): ctl3d32/ctl3d32.spec $(WINEBUILD)
@cd ctl3d32 && $(MAKE) libctl3d32.$(IMPLIBEXT)
diff --git a/dlls/ctapi32/Makefile.in b/dlls/ctapi32/Makefile.in
new file mode 100644
index 0000000..742882e
--- /dev/null
+++ b/dlls/ctapi32/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+MODULE = ctapi32.dll
+IMPORTLIB = libctapi32.$(IMPLIBEXT)
+IMPORTS = kernel32
+
+C_SRCS = ctapi32.c
+
+ at MAKE_DLL_RULES@
+
+ at DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/ctapi32/ctapi.h b/dlls/ctapi32/ctapi.h
new file mode 100644
index 0000000..19c5dd9
--- /dev/null
+++ b/dlls/ctapi32/ctapi.h
@@ -0,0 +1,108 @@
+/*
+ * CT-API library for the REINER SCT cyberJack pinpad/e-com USB.
+ * Copyright (C) 2001 REINER SCT
+ * Author: Matthias Bruestle
+ * Support: support at reiner-sct.com
+ *
+ * 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 H_CTAPI
+#define H_CTAPI
+
+/* More uniqe defines */
+
+#define CT_API_AD_HOST 2
+#define CT_API_AD_REMOTE 5
+
+#define CT_API_AD_CT 1
+#define CT_API_AD_ICC1 0
+#define CT_API_AD_ICC2 2
+#define CT_API_AD_ICC3 3
+#define CT_API_AD_ICC4 4
+#define CT_API_AD_ICC5 5
+#define CT_API_AD_ICC6 6
+#define CT_API_AD_ICC7 7
+#define CT_API_AD_ICC8 8
+#define CT_API_AD_ICC9 9
+#define CT_API_AD_ICC10 10
+#define CT_API_AD_ICC11 11
+#define CT_API_AD_ICC12 12
+#define CT_API_AD_ICC13 13
+#define CT_API_AD_ICC14 14
+
+#define CT_API_RV_OK 0
+#define CT_API_RV_ERR_INVALID -1
+#define CT_API_RV_ERR_CT -8
+#define CT_API_RV_ERR_TRANS -10
+#define CT_API_RV_ERR_MEMORY -11
+#define CT_API_RV_ERR_HOST -127
+#define CT_API_RV_ERR_HTSI -128
+
+/* MUSCLE style defines */
+
+#define OK 0 /* Success */
+#define ERR_INVALID -1 /* Invalid Data */
+#define ERR_CT -8 /* CT Error */
+#define ERR_TRANS -10 /* Transmission Error */
+#define ERR_MEMORY -11 /* Memory Allocate Error */
+#define ERR_HOST -127 /* Host Error */
+#define ERR_HTSI -128 /* HTSI Error */
+
+#define PORT_COM1 0 /* COM 1 */
+#define PORT_COM2 1 /* COM 2 */
+#define PORT_COM3 2 /* COM 3 */
+#define PORT_COM4 3 /* COM 4 */
+#define PORT_Printer 4 /* Printer Port (MAC) */
+#define PORT_Modem 5 /* Modem Port (MAC) */
+#define PORT_LPT1 6 /* LPT 1 */
+#define PORT_LPT2 7 /* LPT 2 */
+
+#define CT 1
+#define HOST 2
+
+/* Short */
+#define CJ_CTAPI_MAX_LENC 4+1+255+1
+#define CJ_CTAPI_MAX_LENR 256+2
+/* Extended */
+/* #define CJ_CTAPI_MAX_LENC 5+2+65535+2 */
+/* #define CJ_CTAPI_MAX_LENR 65536+2 */
+/* Maximum for CTAPI */
+/* #define CJ_CTAPI_MAX_LENC 65535 */
+/* #define CJ_CTAPI_MAX_LENR 65535 */
+
+
+typedef unsigned char IU8;
+typedef unsigned short IU16;
+
+typedef signed char IS8;
+typedef signed short IS16;
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+IS8 CT_init( IU16 ctn, IU16 pn );
+IS8 CT_data( IU16 ctn, IU8 *dad, IU8 *sad, IU16 lenc, IU8 *command, IU16 *lenr,
+ IU8 *response );
+IS8 CT_close( IU16 ctn );
+
+/* Proprietary extension */
+IS8 CT_keycb( IU16 ctn, void (* cb)(IU16 ctn, IU8 status) );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* H_CTAPI */
+
diff --git a/dlls/ctapi32/ctapi32.c b/dlls/ctapi32/ctapi32.c
new file mode 100644
index 0000000..ea09965
--- /dev/null
+++ b/dlls/ctapi32/ctapi32.c
@@ -0,0 +1,93 @@
+/*
+ * WINE ct-api wrapper
+ *
+ * Copyright 2007 Christian Eggers
+ *
+ * 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 <wine/library.h>
+#include <wine/debug.h>
+#include <windef.h>
+#include "ctapi.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ctapi);
+
+
+static IS8 (*pCT_init)(IU16 ctn, IU16 pn) = NULL;
+static IS8 (*pCT_data)(IU16 ctn, IU8 *dad, IU8 *sad, IU16 lenc, IU8 *command,
+ IU16 *lenr, IU8 *response) = NULL;
+static IS8 (*pCT_close)(IU16 ctn) = NULL;
+
+#ifndef SONAMES_LIBCTAPI
+#define SONAMES_LIBCTAPI "libctapi.so","libctapi-cyberjack.so"
+#endif
+
+static void load_functions() {
+ const char *ctapi_sonames[] = {SONAMES_LIBCTAPI};
+ int i;
+ void *ctapi_handle = NULL;
+
+ if (pCT_init) /* loaded already */
+ return;
+ for (i = 0; i < sizeof(ctapi_sonames)/sizeof(ctapi_sonames[0]); i++) {
+ TRACE("Looking for library '%s'\n", ctapi_sonames[i]);
+ ctapi_handle = wine_dlopen(ctapi_sonames[i], RTLD_NOW, NULL, 0);
+ if (ctapi_handle) {
+ TRACE("Successfully loaded '%s'\n", ctapi_sonames[i]);
+ break;
+ }
+ else {
+ TRACE("Not found\n");
+ }
+ }
+ if(!ctapi_handle) {
+ FIXME("Wine cannot find any useable hardware library, ctapi32.dll not working.\n");
+ return;
+ }
+#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(ctapi_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); return;}
+LOAD_FUNCPTR(CT_init);
+LOAD_FUNCPTR(CT_data);
+LOAD_FUNCPTR(CT_close);
+#undef LOAD_FUNCPTR
+}
+
+
+IS8 WINAPI WIN_CT_init(IU16 ctn, IU16 pn)
+{
+ load_functions();
+ if (!pCT_init)
+ return ERR_HOST;
+ return pCT_init(ctn, pn);
+}
+
+IS8 WINAPI WIN_CT_data(IU16 ctn, IU8 *dad, IU8 *sad, IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response)
+{
+ load_functions();
+ if (!pCT_data)
+ return ERR_HOST;
+ return pCT_data(ctn, dad, sad, lenc, command, lenr, response);
+}
+
+IS8 WINAPI WIN_CT_close(IU16 ctn)
+{
+ load_functions();
+ if (!pCT_close)
+ return ERR_HOST;
+ return pCT_close(ctn);
+}
+
diff --git a/dlls/ctapi32/ctapi32.spec b/dlls/ctapi32/ctapi32.spec
new file mode 100644
index 0000000..3ffd370
--- /dev/null
+++ b/dlls/ctapi32/ctapi32.spec
@@ -0,0 +1,3 @@
+1 stdcall CT_close (long) WIN_CT_close
+2 stdcall CT_data (long ptr ptr long ptr ptr ptr) WIN_CT_data
+3 stdcall CT_init (long long) WIN_CT_init
--
1.4.3.4
More information about the wine-patches
mailing list