diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-01 12:32:33 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-01 12:32:33 +0100 |
| commit | ab73969ea4c317bff252176ed3d57f45ccde6924 (patch) | |
| tree | 0d1d5c547de437f41e02a972e52ad0c962e1c5d5 /src/wrapped32 | |
| parent | 93b371eb8cd2797a021103a4aad41ba7672cd32e (diff) | |
| download | box64-ab73969ea4c317bff252176ed3d57f45ccde6924.tar.gz box64-ab73969ea4c317bff252176ed3d57f45ccde6924.zip | |
[BOX32][WRAPPER] Improved networks functions
Diffstat (limited to 'src/wrapped32')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 4 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 1 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibresolvtypes32.h | 3 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 4 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibresolv.c | 17 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibresolv_private.h | 4 |
8 files changed, 29 insertions, 8 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index ef50d56b..f5443203 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -1132,7 +1132,6 @@ #() iEipppp -> iEipppp #() iFuiuup -> iFuiuup #() iFpiiuu -> iFpiiuu -#() iEpiipi -> iEpiipi #() iFpippp -> iFpippp #() iFpCCCC -> iFpCCCC #() iFpuipp -> iFpuipp @@ -1279,6 +1278,7 @@ #() iEEiippi -> iEEiippi #() iEEipiup -> iEEipiup #() iEEuppLp -> iEEuppLp +#() iEEpiipi -> iEEpiipi #() iEEpiipV -> iEEpiipV #() iFEpiuuu -> iFEpiuuu #() iEEpiLpp -> iEEpiLpp @@ -1766,6 +1766,7 @@ wrappedlibc: - __ctype_tolower_loc - __ctype_toupper_loc - __errno_location + - __res_state - localeconv - pFv: - __h_errno_location @@ -2194,6 +2195,7 @@ wrappedlibpthread: wrappedlibresolv: - iEpiipi: - __res_query + - res_query wrappedlibrt: - iEuBLL_: - __clock_gettime diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index 61534ccc..aa0683f0 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -143,6 +143,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(__ctype_tolower_loc, pEv_t) \ GO(__ctype_toupper_loc, pEv_t) \ GO(__errno_location, pEv_t) \ + GO(__res_state, pEv_t) \ GO(localeconv, pEv_t) \ GO(__h_errno_location, pFv_t) \ GO(getpwuid, pEu_t) \ diff --git a/src/wrapped32/generated/wrappedlibresolvtypes32.h b/src/wrapped32/generated/wrappedlibresolvtypes32.h index 23bd722a..548138a5 100644 --- a/src/wrapped32/generated/wrappedlibresolvtypes32.h +++ b/src/wrapped32/generated/wrappedlibresolvtypes32.h @@ -14,6 +14,7 @@ typedef int32_t (*iEpiipi_t)(void*, int32_t, int32_t, void*, int32_t); #define SUPER() ADDED_FUNCTIONS() \ - GO(__res_query, iEpiipi_t) + GO(__res_query, iEpiipi_t) \ + GO(res_query, iEpiipi_t) #endif // __wrappedlibresolvTYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 42929822..e8a936a8 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1223,7 +1223,6 @@ 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*); @@ -1370,6 +1369,7 @@ typedef void (*vFXLpppi_t)(void*, uintptr_t, void*, void*, void*, int32_t); typedef int32_t (*iEEiippi_t)(x64emu_t*, int32_t, int32_t, void*, void*, int32_t); typedef int32_t (*iEEipiup_t)(x64emu_t*, int32_t, void*, int32_t, uint32_t, void*); typedef int32_t (*iEEuppLp_t)(x64emu_t*, uint32_t, void*, void*, uintptr_t, void*); +typedef int32_t (*iEEpiipi_t)(x64emu_t*, void*, int32_t, int32_t, void*, int32_t); typedef int32_t (*iEEpiipV_t)(x64emu_t*, void*, int32_t, int32_t, void*, void*); typedef int32_t (*iFEpiuuu_t)(x64emu_t*, void*, int32_t, uint32_t, uint32_t, uint32_t); typedef int32_t (*iEEpiLpp_t)(x64emu_t*, void*, int32_t, uintptr_t, void*, void*); @@ -2866,7 +2866,6 @@ 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)); } @@ -3013,6 +3012,7 @@ void vFXLpppi_32(x64emu_t *emu, uintptr_t fcn) { vFXLpppi_t fn = (vFXLpppi_t)fcn void iEEiippi_32(x64emu_t *emu, uintptr_t fcn) { iEEiippi_t fn = (iEEiippi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; } void iEEipiup_32(x64emu_t *emu, uintptr_t fcn) { iEEipiup_t fn = (iEEipiup_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } void iEEuppLp_32(x64emu_t *emu, uintptr_t fcn) { iEEuppLp_t fn = (iEEuppLp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } +void iEEpiipi_32(x64emu_t *emu, uintptr_t fcn) { iEEpiipi_t fn = (iEEpiipi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, 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 iEEpiipV_32(x64emu_t *emu, uintptr_t fcn) { iEEpiipV_t fn = (iEEpiipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, 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_ptrv(R_ESP + 20)); emu->libc_err = errno; } void iFEpiuuu_32(x64emu_t *emu, uintptr_t fcn) { iFEpiuuu_t fn = (iFEpiuuu_t)fcn; R_EAX = fn(emu, from_ptriv(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_ptri(uint32_t, R_ESP + 20)); } void iEEpiLpp_32(x64emu_t *emu, uintptr_t fcn) { iEEpiLpp_t fn = (iEEpiLpp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); emu->libc_err = errno; } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 4316305a..46dce8f2 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -1173,7 +1173,6 @@ 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); @@ -1320,6 +1319,7 @@ void vFXLpppi_32(x64emu_t *emu, uintptr_t fnc); void iEEiippi_32(x64emu_t *emu, uintptr_t fnc); void iEEipiup_32(x64emu_t *emu, uintptr_t fnc); void iEEuppLp_32(x64emu_t *emu, uintptr_t fnc); +void iEEpiipi_32(x64emu_t *emu, uintptr_t fnc); void iEEpiipV_32(x64emu_t *emu, uintptr_t fnc); void iFEpiuuu_32(x64emu_t *emu, uintptr_t fnc); void iEEpiLpp_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 6b0fac79..2fefa65b 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1412,7 +1412,7 @@ GO(__res_init, iEv) //GO(__res_ninit, iEp) //DATA(__resp, 4) // __res_randomid -GO(__res_state, pEv) // the returned struture certainly needs wrapping +GOM(__res_state, pEEv) //DATA(re_syntax_options, 4) // type B // revoke GO(rewind, vES) diff --git a/src/wrapped32/wrappedlibresolv.c b/src/wrapped32/wrappedlibresolv.c index 381b2f7d..7ef81e3a 100644 --- a/src/wrapped32/wrappedlibresolv.c +++ b/src/wrapped32/wrappedlibresolv.c @@ -3,6 +3,8 @@ #include <string.h> #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <dlfcn.h> +#include <resolv.h> +#include <netdb.h> #include "wrappedlibs.h" @@ -21,4 +23,19 @@ static const char* libresolvName = "libresolv.so.2"; #define LIBNAME libresolv +#include "generated/wrappedlibresolvtypes32.h" + +#include "wrappercallback32.h" + +void* convert_res_state_to_32(void* d, void* s); +void* convert_res_state_to_64(void* d, void* s); + +EXPORT int my32_res_query(x64emu_t* emu, void* dname, int class, int type, void* answer, int anslen) +{ + convert_res_state_to_64(emu->res_state_64, emu->res_state_32); + int ret = my->__res_query(dname, class, type, answer, anslen); + emu->libc_herr = h_errno; + return ret; +} + #include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedlibresolv_private.h b/src/wrapped32/wrappedlibresolv_private.h index 17fb9721..e5041815 100644 --- a/src/wrapped32/wrappedlibresolv_private.h +++ b/src/wrapped32/wrappedlibresolv_private.h @@ -92,8 +92,8 @@ //DATA(_res_opcodes, 4) //GO(__res_ownok, iFp) //GO(__res_queriesmatch, iFpppp) -GO2(__res_query, iEpiipi, res_query) -GOW(res_query, iEpiipi) +GO2(__res_query, iEEpiipi, my32_res_query) +GOWM(res_query, iEEpiipi) //GO2(__res_querydomain, iFppiipi, res_querydomain) //GOW(res_querydomain, iFppiipi) //GO2(__res_search, iFpiipi, res_search) |