about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-11-29 19:10:11 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-11-29 19:10:11 +0100
commitc73545e25b3f16abd361926372ed6112e0c2bcf8 (patch)
treed4901e5c24ad4822248d9f67b618c07bea090df7 /src
parentb862e74ae447819481f367e678796c8f5cea31ac (diff)
downloadbox64-c73545e25b3f16abd361926372ed6112e0c2bcf8.tar.gz
box64-c73545e25b3f16abd361926372ed6112e0c2bcf8.zip
[BOX32][WRAPPER] Added minimum libresolv wrapping
Diffstat (limited to 'src')
-rw-r--r--src/library_list_32.h3
-rw-r--r--src/wrapped32/generated/functions_list.txt4
-rw-r--r--src/wrapped32/generated/wrappedlibresolvdefs32.h8
-rw-r--r--src/wrapped32/generated/wrappedlibresolvtypes32.h19
-rw-r--r--src/wrapped32/generated/wrappedlibresolvundefs32.h8
-rw-r--r--src/wrapped32/generated/wrapper32.c2
-rw-r--r--src/wrapped32/generated/wrapper32.h1
-rwxr-xr-xsrc/wrapped32/wrappedlibc_private.h2
-rw-r--r--src/wrapped32/wrappedlibresolv.c24
-rw-r--r--src/wrapped32/wrappedlibresolv_private.h107
10 files changed, 176 insertions, 2 deletions
diff --git a/src/library_list_32.h b/src/library_list_32.h
index 1500389d..94d5e5e8 100644
--- a/src/library_list_32.h
+++ b/src/library_list_32.h
@@ -4,7 +4,6 @@
 
 GO("libpthread.so.0", libpthread)
 GO("librt.so.1", librt)
-
 #ifdef ANDROID
 GO("libc.so", libc)
 GO("libm.so", libm)
@@ -14,6 +13,8 @@ GO("libc.so.6", libc)
 GO("libm.so.6", libm)
 GO("libdl.so.2", libdl)
 #endif
+GO("libresolv.so.2", libresolv)
+GO("libresolv.so", libresolv)
 
 GO("ld-linux.so.2", ldlinux)
 
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index c910fea8..14ea3e57 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -1117,6 +1117,7 @@
 #() iEipppp -> iEipppp
 #() iFuiuup -> iFuiuup
 #() iFpiiuu -> iFpiiuu
+#() iEpiipi -> iEpiipi
 #() iFpippp -> iFpippp
 #() iFpCCCC -> iFpCCCC
 #() iFpuipp -> iFpuipp
@@ -2152,6 +2153,9 @@ wrappedlibpthread:
   - pthread_cond_timedwait@GLIBC_2.0
 - iEBh_ppp:
   - pthread_create
+wrappedlibresolv:
+- iEpiipi:
+  - __res_query
 wrappedlibrt:
 - iEuBLL_:
   - __clock_gettime
diff --git a/src/wrapped32/generated/wrappedlibresolvdefs32.h b/src/wrapped32/generated/wrappedlibresolvdefs32.h
new file mode 100644
index 00000000..8846868f
--- /dev/null
+++ b/src/wrapped32/generated/wrappedlibresolvdefs32.h
@@ -0,0 +1,8 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedlibresolvDEFS32_H_
+#define __wrappedlibresolvDEFS32_H_
+
+
+#endif // __wrappedlibresolvDEFS32_H_
diff --git a/src/wrapped32/generated/wrappedlibresolvtypes32.h b/src/wrapped32/generated/wrappedlibresolvtypes32.h
new file mode 100644
index 00000000..23bd722a
--- /dev/null
+++ b/src/wrapped32/generated/wrappedlibresolvtypes32.h
@@ -0,0 +1,19 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedlibresolvTYPES32_H_
+#define __wrappedlibresolvTYPES32_H_
+
+#ifndef LIBNAME
+#error You should only #include this file inside a wrapped*.c file
+#endif
+#ifndef ADDED_FUNCTIONS
+#define ADDED_FUNCTIONS() 
+#endif
+
+typedef int32_t (*iEpiipi_t)(void*, int32_t, int32_t, void*, int32_t);
+
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(__res_query, iEpiipi_t)
+
+#endif // __wrappedlibresolvTYPES32_H_
diff --git a/src/wrapped32/generated/wrappedlibresolvundefs32.h b/src/wrapped32/generated/wrappedlibresolvundefs32.h
new file mode 100644
index 00000000..1d11ace6
--- /dev/null
+++ b/src/wrapped32/generated/wrappedlibresolvundefs32.h
@@ -0,0 +1,8 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedlibresolvUNDEFS32_H_
+#define __wrappedlibresolvUNDEFS32_H_
+
+
+#endif // __wrappedlibresolvUNDEFS32_H_
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index c5efe0f7..4b650d5c 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -1208,6 +1208,7 @@ typedef int32_t (*iEipppi_t)(int32_t, void*, void*, void*, int32_t);
 typedef int32_t (*iEipppp_t)(int32_t, void*, void*, void*, void*);
 typedef int32_t (*iFuiuup_t)(uint32_t, int32_t, uint32_t, uint32_t, void*);
 typedef int32_t (*iFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
+typedef int32_t (*iEpiipi_t)(void*, int32_t, int32_t, void*, int32_t);
 typedef int32_t (*iFpippp_t)(void*, int32_t, void*, void*, void*);
 typedef int32_t (*iFpCCCC_t)(void*, uint8_t, uint8_t, uint8_t, uint8_t);
 typedef int32_t (*iFpuipp_t)(void*, uint32_t, int32_t, void*, void*);
@@ -2828,6 +2829,7 @@ void iEipppi_32(x64emu_t *emu, uintptr_t fcn) { iEipppi_t fn = (iEipppi_t)fcn; e
 void iEipppp_32(x64emu_t *emu, uintptr_t fcn) { iEipppp_t fn = (iEipppp_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); emu->libc_err = errno; }
 void iFuiuup_32(x64emu_t *emu, uintptr_t fcn) { iFuiuup_t fn = (iFuiuup_t)fcn; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFpiiuu_32(x64emu_t *emu, uintptr_t fcn) { iFpiiuu_t fn = (iFpiiuu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); }
+void iEpiipi_32(x64emu_t *emu, uintptr_t fcn) { iEpiipi_t fn = (iEpiipi_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; }
 void iFpippp_32(x64emu_t *emu, uintptr_t fcn) { iFpippp_t fn = (iFpippp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFpCCCC_32(x64emu_t *emu, uintptr_t fcn) { iFpCCCC_t fn = (iFpCCCC_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint8_t, R_ESP + 8), from_ptri(uint8_t, R_ESP + 12), from_ptri(uint8_t, R_ESP + 16), from_ptri(uint8_t, R_ESP + 20)); }
 void iFpuipp_32(x64emu_t *emu, uintptr_t fcn) { iFpuipp_t fn = (iFpuipp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 0bd22070..73657a1f 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -1158,6 +1158,7 @@ void iEipppi_32(x64emu_t *emu, uintptr_t fnc);
 void iEipppp_32(x64emu_t *emu, uintptr_t fnc);
 void iFuiuup_32(x64emu_t *emu, uintptr_t fnc);
 void iFpiiuu_32(x64emu_t *emu, uintptr_t fnc);
+void iEpiipi_32(x64emu_t *emu, uintptr_t fnc);
 void iFpippp_32(x64emu_t *emu, uintptr_t fnc);
 void iFpCCCC_32(x64emu_t *emu, uintptr_t fnc);
 void iFpuipp_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h
index 1a2391a4..67a4aa79 100755
--- a/src/wrapped32/wrappedlibc_private.h
+++ b/src/wrapped32/wrappedlibc_private.h
@@ -1403,7 +1403,7 @@ GO(__res_init, iEv)
 //GO(__res_ninit, iEp)
 //DATA(__resp, 4)
 // __res_randomid
-//GO(__res_state, pEv)
+GO(__res_state, pEv)    // the returned struture certainly needs wrapping
 //DATA(re_syntax_options, 4)    // type B
 // revoke
 GO(rewind, vES)
diff --git a/src/wrapped32/wrappedlibresolv.c b/src/wrapped32/wrappedlibresolv.c
new file mode 100644
index 00000000..381b2f7d
--- /dev/null
+++ b/src/wrapped32/wrappedlibresolv.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "debug.h"
+#include "wrapper32.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
+#include "librarian.h"
+#include "box64context.h"
+#include "emu/x64emu_private.h"
+#include "box32.h"
+
+static const char* libresolvName = "libresolv.so.2";
+#define LIBNAME libresolv
+
+#include "wrappedlib_init32.h"
diff --git a/src/wrapped32/wrappedlibresolv_private.h b/src/wrapped32/wrappedlibresolv_private.h
new file mode 100644
index 00000000..17fb9721
--- /dev/null
+++ b/src/wrapped32/wrappedlibresolv_private.h
@@ -0,0 +1,107 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error Meh...
+#endif
+
+//GO(__b64_ntop, iFpLpL)
+//GO(__b64_pton, iFppL)
+//GO(__dn_comp, iFppipp)
+//GO(__dn_count_labels, iFp)
+//GO(__dn_expand, iFppppi)
+//GOW(dn_expand, iFppppi)
+//GO(__dn_skipname, iFpp)
+//GO(__fp_nquery, vFpiS)
+//GO(__fp_query, vFpS)
+//GO(__fp_resstat, vFpS)
+//GO(_gethtbyaddr, 
+//GO(_gethtbyname, 
+//GO(_gethtbyname2, 
+//GO(_gethtent, 
+//GO(_getlong, 
+//GO(_getshort, 
+//GO(__hostalias, pFp)
+//GO(inet_neta, pFupL)
+//GO(inet_net_ntop, pFipipL)
+//GO(inet_net_pton, iFippL)
+//GO(__loc_aton, iFpp)
+//GO(__loc_ntoa, pFpp)
+//GO(ns_datetosecs, uFpp)
+//GO(ns_format_ttl, iFLpL)
+//GO(__ns_get16, uFp)
+//GOW(ns_get16, uFp)
+//GO(__ns_get32, LFp)
+//GOW(ns_get32, LFp)
+//GO(ns_initparse, iFpip)
+//GO(ns_makecanon, iFppL)
+//GO(ns_msg_getflag, 
+//GO(ns_name_compress, iFppLpp)
+//GO(ns_name_ntol, iFppL)
+//GO(__ns_name_ntop, iFppL)
+//GOW(ns_name_ntop, iFppL)
+//GO(ns_name_pack, iFppipp)
+//GO(ns_name_pton, iFppL)
+//GO(ns_name_rollback, vFppp)
+//GO(ns_name_skip, iFpp)
+//GO(ns_name_uncompress, iFppppL)
+//GO(__ns_name_unpack, iFppppL)
+//GOW(ns_name_unpack, iFppppL)
+//GO(ns_parserr, iFpuip)
+//GO(ns_parse_ttl, iFpp)
+//GO(ns_put16, vFup)
+//GO(ns_put32, vFLp)
+//GO(ns_samedomain, iFpp)
+//GO(ns_samename, iFpp)
+//GO(ns_skiprr, iFppui)
+//GO(ns_sprintrr, iFpppppL)
+//GO(ns_sprintrrf, iFpLpuuLpLpppL)
+//GO(ns_subdomain, iFpp)
+//GO(__p_cdname, pFppS)
+//GO(__p_cdnname, pFppiS)
+//GO(__p_class, pFi)
+//DATA(__p_class_syms, 4)
+//GO(__p_fqname, pFppS)
+//GO(__p_fqnname, pFppipi)
+//GO(__p_option, pFL)
+//GO(__p_query, vFp)
+//GO(__p_rcode, pFi)
+//GO(__p_secstodate, 
+//GO(__p_time, pFu)
+//GO(__p_type, pFi)
+//DATA(__p_type_syms, 4)
+//GO(__putlong, vFup)
+//GO(__putshort, vFWp)
+//GO(__res_close, vFv)
+//GO(__res_context_hostalias, 
+//GO(__res_context_query, 
+//GO(__res_context_search, 
+//GO(__res_dnok, iFp)
+//GO(res_gethostbyaddr, 
+//GO(res_gethostbyname, 
+//GO(res_gethostbyname2, 
+//GO(__res_hnok, iFp)
+//GO(__res_hostalias, pFpppL)
+//GO(__res_isourserver, iFp)
+//GO(__res_mailok, iFp)
+//GO(__res_mkquery, iFipiipippi)
+//GOW(res_mkquery, iFipiipippi)
+//GO(__res_nameinquery, iFpiipp)
+//GO(__res_nmkquery, 
+//GO(__res_nquery, iFppiipi)
+//GO(__res_nquerydomain, 
+//GO(__res_nsearch, iFppiipi)
+//GO(__res_nsend, 
+//DATA(_res_opcodes, 4)
+//GO(__res_ownok, iFp)
+//GO(__res_queriesmatch, iFpppp)
+GO2(__res_query, iEpiipi, res_query)
+GOW(res_query, iEpiipi)
+//GO2(__res_querydomain, iFppiipi, res_querydomain)
+//GOW(res_querydomain, iFppiipi)
+//GO2(__res_search, iFpiipi, res_search)
+//GOW(res_search, iFpiipi)
+//GO(__res_send, iFpipi)
+//GO(res_send_setqhook, 
+//GO(res_send_setrhook, 
+//GO(_sethtent, 
+//GO(__sym_ntop, pFpip)
+//GO(__sym_ntos, pFpip)
+//GO(__sym_ston, iFppp)