Alexandre Julliard : ctapi32: Implement Wow64 entry points in the Unix library.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 15:45:07 CST 2021


Module: wine
Branch: master
Commit: fc67bbf27fbcd5d32a373b599e038fab069d9177
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fc67bbf27fbcd5d32a373b599e038fab069d9177

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov  8 20:53:51 2021 +0100

ctapi32: Implement Wow64 entry points in the Unix library.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ctapi32/ctapi32.c |  4 +---
 dlls/ctapi32/unixlib.c | 54 ++++++++++++++++++++++++++++++++++++++++++++------
 dlls/ctapi32/unixlib.h |  5 -----
 3 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/dlls/ctapi32/ctapi32.c b/dlls/ctapi32/ctapi32.c
index 471da7bbd14..5d5060ace47 100644
--- a/dlls/ctapi32/ctapi32.c
+++ b/dlls/ctapi32/ctapi32.c
@@ -38,7 +38,6 @@ static unixlib_handle_t ctapi_handle;
 
 
 static BOOL load_functions(void) {
-	struct attach_params params;
 	char soname[MAX_PATH] = FALLBACK_LIBCTAPI;
 	LONG result;
 	HKEY key_handle;
@@ -61,8 +60,7 @@ static BOOL load_functions(void) {
 	}
 
 	TRACE("Loading library '%s'\n", soname);
-        params.libname = soname;
-        if (!CTAPI_CALL( attach, &params )) return TRUE;
+        if (!CTAPI_CALL( attach, soname )) return TRUE;
 
 	MESSAGE("Wine cannot find any usable hardware library, ctapi32.dll not working.\n");
 	MESSAGE("Please create the key \"HKEY_CURRENT_USER\\Software\\Wine\\ctapi32\" in your registry\n");
diff --git a/dlls/ctapi32/unixlib.c b/dlls/ctapi32/unixlib.c
index a31c0a13c30..cdfe6e6eb73 100644
--- a/dlls/ctapi32/unixlib.c
+++ b/dlls/ctapi32/unixlib.c
@@ -40,9 +40,9 @@ static void *ctapi_handle;
 
 static NTSTATUS attach( void *args )
 {
-    struct attach_params *params = args;
+    const char *libname = args;
 
-    if (!(ctapi_handle = dlopen( params->libname, RTLD_NOW ))) return STATUS_DLL_NOT_FOUND;
+    if (!(ctapi_handle = dlopen( libname, RTLD_NOW ))) return STATUS_DLL_NOT_FOUND;
 
 #define LOAD_FUNCPTR(f) if((p##f = dlsym(ctapi_handle, #f)) == NULL) return STATUS_ENTRYPOINT_NOT_FOUND
     LOAD_FUNCPTR(CT_init);
@@ -60,14 +60,14 @@ static NTSTATUS detach( void *args )
 
 static NTSTATUS ct_init( void *args )
 {
-    struct ct_init_params *params = args;
+    const struct ct_init_params *params = args;
 
     return pCT_init(params->ctn, params->pn);
 }
 
 static NTSTATUS ct_data( void *args )
 {
-    struct ct_data_params *params = args;
+    const struct ct_data_params *params = args;
 
     return pCT_data(params->ctn, params->dad, params->sad, params->lenc,
                     params->command, params->lenr, params->response);
@@ -75,12 +75,12 @@ static NTSTATUS ct_data( void *args )
 
 static NTSTATUS ct_close( void *args )
 {
-    struct ct_close_params *params = args;
+    const struct ct_close_params *params = args;
 
     return pCT_close(params->ctn);
 }
 
-unixlib_entry_t __wine_unix_call_funcs[] =
+const unixlib_entry_t __wine_unix_call_funcs[] =
 {
     attach,
     detach,
@@ -88,3 +88,45 @@ unixlib_entry_t __wine_unix_call_funcs[] =
     ct_data,
     ct_close,
 };
+
+#ifdef _WIN64
+
+typedef ULONG PTR32;
+
+static NTSTATUS wow64_ct_data( void *args )
+{
+    struct
+    {
+        IU16  ctn;
+        PTR32 dad;
+        PTR32 sad;
+        IU16  lenc;
+        PTR32 command;
+        PTR32 lenr;
+        PTR32 response;
+    } const *params32 = args;
+
+    struct ct_data_params params =
+    {
+        params32->ctn,
+        ULongToPtr(params32->dad),
+        ULongToPtr(params32->sad),
+        params32->lenc,
+        ULongToPtr(params32->command),
+        ULongToPtr(params32->lenr),
+        ULongToPtr(params32->response)
+    };
+
+    return ct_data( &params );
+}
+
+const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
+{
+    attach,
+    detach,
+    ct_init,
+    wow64_ct_data,
+    ct_close,
+};
+
+#endif  /* _WIN64 */
diff --git a/dlls/ctapi32/unixlib.h b/dlls/ctapi32/unixlib.h
index 05301b99fcf..535c2aeae09 100644
--- a/dlls/ctapi32/unixlib.h
+++ b/dlls/ctapi32/unixlib.h
@@ -31,11 +31,6 @@ typedef unsigned short IU16;
 typedef signed char IS8;
 typedef signed short IS16;
 
-struct attach_params
-{
-    const char *libname;
-};
-
 struct ct_init_params
 {
     IU16 ctn;




More information about the wine-cvs mailing list