about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-01-06 20:25:54 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-01-06 20:25:54 +0100
commit91e678da5b689079e914086a48c41e6a5f6fd9f1 (patch)
tree170b3dc5cd28c73c20ee6e8a768c6b4717b97d06 /src
parent8a7c2b52289da11903fa633a899ffef26938d840 (diff)
downloadbox64-91e678da5b689079e914086a48c41e6a5f6fd9f1.tar.gz
box64-91e678da5b689079e914086a48c41e6a5f6fd9f1.zip
[BOX32][WRAPPER] Added a few more 32bts wrapped functions to libc and libresolv
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/generated/functions_list.txt2
-rw-r--r--src/wrapped32/generated/wrappedlibresolvtypes32.h3
-rw-r--r--src/wrapped32/generated/wrapper32.c2
-rw-r--r--src/wrapped32/generated/wrapper32.h1
-rwxr-xr-xsrc/wrapped32/wrappedlibc.c17
-rwxr-xr-xsrc/wrapped32/wrappedlibc_private.h6
-rw-r--r--src/wrapped32/wrappedlibresolv_private.h2
7 files changed, 19 insertions, 14 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 9b0b554e..e1b0e77b 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -326,6 +326,7 @@
 #() pFip -> pFip
 #() pEia -> pEia
 #() pFuu -> pFuu
+#() pEup -> pEup
 #() pFup -> pFup
 #() pELL -> pELL
 #() pFLL -> pFLL
@@ -2441,6 +2442,7 @@ wrappedlibresolv:
   - __dn_expand
 - iFppiipi:
   - __res_nquery
+  - __res_nsearch
 wrappedlibrt:
 - iEuBLL_:
   - __clock_gettime
diff --git a/src/wrapped32/generated/wrappedlibresolvtypes32.h b/src/wrapped32/generated/wrappedlibresolvtypes32.h
index 3501297d..373a015c 100644
--- a/src/wrapped32/generated/wrappedlibresolvtypes32.h
+++ b/src/wrapped32/generated/wrappedlibresolvtypes32.h
@@ -26,6 +26,7 @@ typedef int32_t (*iFppiipi_t)(void*, void*, int32_t, int32_t, void*, int32_t);
 	GO(res_search, iEpiipi_t) \
 	GO(__res_search, iFpiipi_t) \
 	GO(__dn_expand, iFppppi_t) \
-	GO(__res_nquery, iFppiipi_t)
+	GO(__res_nquery, iFppiipi_t) \
+	GO(__res_nsearch, iFppiipi_t)
 
 #endif // __wrappedlibresolvTYPES32_H_
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index e38db28e..6434a371 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -420,6 +420,7 @@ typedef void* (*pFiu_t)(int32_t, uint32_t);
 typedef void* (*pFip_t)(int32_t, void*);
 typedef void* (*pEia_t)(int32_t, void*);
 typedef void* (*pFuu_t)(uint32_t, uint32_t);
+typedef void* (*pEup_t)(uint32_t, void*);
 typedef void* (*pFup_t)(uint32_t, void*);
 typedef void* (*pELL_t)(uintptr_t, uintptr_t);
 typedef void* (*pFLL_t)(uintptr_t, uintptr_t);
@@ -2226,6 +2227,7 @@ void pFiu_32(x64emu_t *emu, uintptr_t fcn) { pFiu_t fn = (pFiu_t)fcn; R_EAX = to
 void pFip_32(x64emu_t *emu, uintptr_t fcn) { pFip_t fn = (pFip_t)fcn; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8))); }
 void pEia_32(x64emu_t *emu, uintptr_t fcn) { pEia_t fn = (pEia_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4), from_locale(from_ptri(ptr_t, R_ESP + 8)))); emu->libc_err = errno; }
 void pFuu_32(x64emu_t *emu, uintptr_t fcn) { pFuu_t fn = (pFuu_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8))); }
+void pEup_32(x64emu_t *emu, uintptr_t fcn) { pEup_t fn = (pEup_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8))); emu->libc_err = errno; }
 void pFup_32(x64emu_t *emu, uintptr_t fcn) { pFup_t fn = (pFup_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8))); }
 void pELL_32(x64emu_t *emu, uintptr_t fcn) { pELL_t fn = (pELL_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(from_ulong(from_ptri(ulong_t, R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)))); emu->libc_err = errno; }
 void pFLL_32(x64emu_t *emu, uintptr_t fcn) { pFLL_t fn = (pFLL_t)fcn; R_EAX = to_ptrv(fn(from_ulong(from_ptri(ulong_t, R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)))); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 50f32d78..d6d068cd 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -367,6 +367,7 @@ void pFiu_32(x64emu_t *emu, uintptr_t fnc);
 void pFip_32(x64emu_t *emu, uintptr_t fnc);
 void pEia_32(x64emu_t *emu, uintptr_t fnc);
 void pFuu_32(x64emu_t *emu, uintptr_t fnc);
+void pEup_32(x64emu_t *emu, uintptr_t fnc);
 void pFup_32(x64emu_t *emu, uintptr_t fnc);
 void pELL_32(x64emu_t *emu, uintptr_t fnc);
 void pFLL_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c
index 464d5af7..9f42db10 100755
--- a/src/wrapped32/wrappedlibc.c
+++ b/src/wrapped32/wrappedlibc.c
@@ -130,6 +130,7 @@ static const char* libcName =
 
 extern int fix_64bit_inodes;
 typedef int32_t (*iFiiV_t)(int32_t, int32_t, ...);
+typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*);
 #if 0
 typedef int (*iFL_t)(unsigned long);
 typedef void (*vFpp_t)(void*, void*);
@@ -147,7 +148,6 @@ typedef int32_t (*iFiiII_t)(int, int, int64_t, int64_t);
 typedef int32_t (*iFiiiV_t)(int, int, int, ...);
 typedef int32_t (*iFippi_t)(int32_t, void*, void*, int32_t);
 typedef int32_t (*iFpppp_t)(void*, void*, void*, void*);
-typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*);
 typedef int32_t (*iFppii_t)(void*, void*, int32_t, int32_t);
 typedef int32_t (*iFipuu_t)(int32_t, void*, uint32_t, uint32_t);
 typedef int32_t (*iFipiI_t)(int32_t, void*, int32_t, int64_t);
@@ -305,13 +305,13 @@ static void* findnftw64Fct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for libc nftw64 callback\n");
     return NULL;
 }
-#if 0
+
 // globerr
 #define GO(A)   \
-static uintptr_t my32_globerr_fct_##A = 0;                                        \
-static int my32_globerr_##A(void* epath, int eerrno)                              \
+static uintptr_t my32_globerr_fct_##A = 0;                                      \
+static int my32_globerr_##A(void* epath, int eerrno)                            \
 {                                                                               \
-    return (int)RunFunction(my_context, my32_globerr_fct_##A, 2, epath, eerrno);  \
+    return (int)RunFunctionFmt(my32_globerr_fct_##A, "pi", epath, eerrno);      \
 }
 SUPER()
 #undef GO
@@ -329,7 +329,7 @@ static void* findgloberrFct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for libc globerr callback\n");
     return NULL;
 }
-#endif
+
 #undef dirent
 // filter_dir
 #define GO(A)   \
@@ -1626,19 +1626,18 @@ EXPORT int32_t my32_epoll_wait(x64emu_t* emu, int32_t epfd, void* events, int32_
         UnalignEpollEvent32(events, _events, ret);
     return ret;
 }
-#if 0
 EXPORT int32_t my32_glob(x64emu_t *emu, void* pat, int32_t flags, void* errfnc, void* pglob)
 {
     static iFpipp_t f = NULL;
     if(!f) {
         library_t* lib = my_lib;
         if(!lib) return 0;
-        f = (iFpipp_t)dlsym(lib->priv.w.lib, "glob");
+        f = (iFpipp_t)dlsym(NULL, "glob");
     }
 
     return f(pat, flags, findgloberrFct(errfnc), pglob);
 }
-
+#if 0
 #ifndef ANDROID
 EXPORT int32_t my32_glob64(x64emu_t *emu, void* pat, int32_t flags, void* errfnc, void* pglob)
 {
diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h
index 1c233ec8..ac64e0da 100755
--- a/src/wrapped32/wrappedlibc_private.h
+++ b/src/wrapped32/wrappedlibc_private.h
@@ -628,9 +628,9 @@ GO(getwchar_unlocked, uEv)
 //GO(getwd, pEp)
 // __getwd_chk
 GO(getxattr, iEpppL)
-//GOM(glob, iEEpipp)             //%%
+GOM(glob, iEEpipp)             //%%
 //GOM(glob64, iEEpipp)           //%%
-//GO(globfree, vEp)
+GO(globfree, vEp)
 //GO(globfree64, vEp)
 // glob_pattern_p   // Weak
 GOM(gmtime, pEEp)
@@ -668,7 +668,7 @@ GO(iconv, LELbp_bL_bp_bL_)
 GO(iconv_close, iEp)
 GO(iconv_open, pEpp)
 //GO(if_freenameindex, vEp)
-//GO(if_indextoname, pEup)
+GOW(if_indextoname, pEup)
 //GO(if_nameindex, pEv)
 GO(if_nametoindex, uEp)
 // imaxabs  // Weak
diff --git a/src/wrapped32/wrappedlibresolv_private.h b/src/wrapped32/wrappedlibresolv_private.h
index 5ddea5fd..fcf0f0cd 100644
--- a/src/wrapped32/wrappedlibresolv_private.h
+++ b/src/wrapped32/wrappedlibresolv_private.h
@@ -87,7 +87,7 @@ GOM(ns_parserr, iFEpuip)
 //GO(__res_nmkquery, 
 GO2(__res_nquery, iFppiipi, res_nquery)
 //GO(__res_nquerydomain, 
-//GO(__res_nsearch, iFppiipi)
+GO2(__res_nsearch, iFppiipi, res_nsearch)
 //GO(__res_nsend, 
 //DATA(_res_opcodes, 4)
 //GO(__res_ownok, iFp)