about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-07-05 09:53:39 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-07-05 09:53:39 +0200
commit42bad3ea6b33be5285f5c03fd42838c7810bf789 (patch)
tree2af71da9881e535de2201bfd045ed163dc9ad750 /src
parentf9c4eda1fc12b0497a65c3fe5947802ad99c6a2e (diff)
downloadbox64-42bad3ea6b33be5285f5c03fd42838c7810bf789.tar.gz
box64-42bad3ea6b33be5285f5c03fd42838c7810bf789.zip
Added 1 more wrapped funciton to libcups (for #1629)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt2
-rw-r--r--src/wrapped/generated/wrappedlibcupstypes.h2
-rw-r--r--src/wrapped/wrappedlibcups.c27
-rw-r--r--src/wrapped/wrappedlibcups_private.h2
4 files changed, 32 insertions, 1 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index f20d21dd..96915cb2 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -4367,6 +4367,8 @@ wrappedlibc:
 wrappedlibcmusl:
 wrappedlibcrypt:
 wrappedlibcups:
+- vFpp:
+  - cupsSetPasswordCB2
 - iFuipuupp:
   - cupsEnumDests
 wrappedlibdl:
diff --git a/src/wrapped/generated/wrappedlibcupstypes.h b/src/wrapped/generated/wrappedlibcupstypes.h
index 0ed3b41a..f17b8fc0 100644
--- a/src/wrapped/generated/wrappedlibcupstypes.h
+++ b/src/wrapped/generated/wrappedlibcupstypes.h
@@ -11,9 +11,11 @@
 #define ADDED_FUNCTIONS() 
 #endif
 
+typedef void (*vFpp_t)(void*, void*);
 typedef int32_t (*iFuipuupp_t)(uint32_t, int32_t, void*, uint32_t, uint32_t, void*, void*);
 
 #define SUPER() ADDED_FUNCTIONS() \
+	GO(cupsSetPasswordCB2, vFpp_t) \
 	GO(cupsEnumDests, iFuipuupp_t)
 
 #endif // __wrappedlibcupsTYPES_H_
diff --git a/src/wrapped/wrappedlibcups.c b/src/wrapped/wrappedlibcups.c
index cc25e980..5e4f631e 100644
--- a/src/wrapped/wrappedlibcups.c
+++ b/src/wrapped/wrappedlibcups.c
@@ -63,6 +63,28 @@ static void* find_cups_dest_cb_t_Fct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for libcups cups_dest_cb_t callback\n");
     return NULL;
 }
+// cups_password_cb2_t ...
+#define GO(A)   \
+static uintptr_t my_cups_password_cb2_t_fct_##A = 0;                                        \
+static void* my_cups_password_cb2_t_##A(void* a, void* b, void* c, void* d, void* e)        \
+{                                                                                           \
+    return (void*)RunFunctionFmt(my_cups_password_cb2_t_fct_##A, "ppppp", a, b, c, d, e);   \
+}
+SUPER()
+#undef GO
+static void* find_cups_password_cb2_t_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_cups_password_cb2_t_fct_##A == (uintptr_t)fct) return my_cups_password_cb2_t_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_cups_password_cb2_t_fct_##A == 0) {my_cups_password_cb2_t_fct_##A = (uintptr_t)fct; return my_cups_password_cb2_t_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libcups cups_password_cb2_t callback\n");
+    return NULL;
+}
 
 #undef SUPER
 
@@ -71,4 +93,9 @@ EXPORT int my_cupsEnumDests(x64emu_t* emu, uint32_t flags, int msec, int* cancel
     return my->cupsEnumDests(flags, msec, cancel, type, mask, find_cups_dest_cb_t_Fct(f), data);
 }
 
+EXPORT void my_cupsSetPasswordCB2(x64emu_t* emu, void* f, void* data)
+{
+    my->cupsSetPasswordCB2(find_cups_password_cb2_t_Fct(f), data);
+}
+
 #include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedlibcups_private.h b/src/wrapped/wrappedlibcups_private.h
index 2ee530db..13f3b988 100644
--- a/src/wrapped/wrappedlibcups_private.h
+++ b/src/wrapped/wrappedlibcups_private.h
@@ -208,7 +208,7 @@ GO(cupsSetDefaultDest, vFppip)
 //GO(_cupsSetLocale, 
 //GO(_cupsSetNegotiateAuthString, 
 //GO(cupsSetPasswordCB, 
-//GO(cupsSetPasswordCB2, 
+GOM(cupsSetPasswordCB2, vFEpp)
 //GO(cupsSetServer, 
 //GO(cupsSetServerCertCB, 
 //GO(cupsSetServerCredentials,