diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-05-26 11:56:41 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-05-26 11:56:41 +0200 |
| commit | 103875b4875fa3dd0b3001b6f9df38a4a0cb69c8 (patch) | |
| tree | 41f08e4f37933c7a8207de3afd7e929e1a8ff202 /src | |
| parent | 4c234b041814be28ca26a2dd1719a48185dc95c9 (diff) | |
| download | box64-103875b4875fa3dd0b3001b6f9df38a4a0cb69c8.tar.gz box64-103875b4875fa3dd0b3001b6f9df38a4a0cb69c8.zip | |
[BOX32][WRAPPER] Added some time64 functions (for #2655)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 30 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 23 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibrttypes32.h | 3 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 8 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 4 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 51 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 21 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibrt_private.h | 2 |
8 files changed, 136 insertions, 6 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 4c79e3ec..c8976ab2 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -555,6 +555,7 @@ #() iEiip -> iEiip #() iFiip -> iFiip #() iEiiO -> iEiiO +#() iEiiN -> iEiiN #() iEiII -> iEiII #() iFiui -> iFiui #() iEiuu -> iEiuu @@ -679,6 +680,7 @@ #() dEddp -> dEddp #() lEEuV -> lEEuV #() lEili -> lEili +#() lEipi -> lEipi #() lEipL -> lEipL #() lFlll -> lFlll #() lElpi -> lElpi @@ -1426,7 +1428,6 @@ #() iFiuuuu -> iFiuuuu #() iFiuuuU -> iFiuuuU #() iFiuuup -> iFiuuup -#() iEiLLLL -> iEiLLLL #() iFipiip -> iFipiip #() iEipLLi -> iEipLLi #() iFippuu -> iFippuu @@ -1663,6 +1664,7 @@ #() vFXLiipi -> vFXLiipi #() vFXLpppi -> vFXLpppi #() iEEiippi -> iEEiippi +#() iEEiLLLL -> iEEiLLLL #() iEEipiup -> iEEipiup #() iEEuppLp -> iEEuppLp #() iEEpiipi -> iEEpiipi @@ -2340,6 +2342,8 @@ wrappedlibc: - lES: - ftell - LEL: +- LEp: + - __mktime64 - pEv: - __ctype_b_loc - __ctype_tolower_loc @@ -2359,6 +2363,8 @@ wrappedlibc: - _ZGTtnaX - _ZGTtnam - pEp: + - __ctime64 + - __gmtime64 - __localtime64 - getgrnam - getprotobyname @@ -2384,7 +2390,9 @@ wrappedlibc: - vEpu: - vEpp: - iFip: + - __fstat64_time64 - iEip: + - __futimens64 - fstatvfs - fstatvfs64 - futimens @@ -2396,6 +2404,9 @@ wrappedlibc: - backtrace - iEpL: - iEpp: + - __gettimeofday64 + - __lstat64_time64 + - __stat64_time64 - alphasort64 - statvfs - statvfs64 @@ -2435,6 +2446,9 @@ wrappedlibc: - vEppu: - iEiip: - iEiiN: + - __fcntl_time64 +- iEiLp: + - __ioctl_time64 - iEipp: - iEipV: - iEpii: @@ -2454,6 +2468,8 @@ wrappedlibc: - __isoc99_fscanf - fscanf - lEipi: + - __recvmsg64 + - __sendmsg64 - readv - recvmsg - sendmsg @@ -2497,6 +2513,7 @@ wrappedlibc: - iEipup: - __xmknod - iEippi: + - __fstatat64_time64 - utimensat - iEippL: - readlinkat @@ -2515,10 +2532,18 @@ wrappedlibc: - uEippu: - regerror - LEpBp_ii: +- iEiiipu: + - __setsockopt64 +- iEiiipp: + - __getsockopt64 - iEiippi: +- iEiLLLL: + - __prctl_time64 + - prctl - iEipiup: - statx - iEipppp: + - __select64 - getopt_long - iEuppLp: - getgrgid_r @@ -2860,6 +2885,9 @@ wrappedlibresolv: - __res_nquery - __res_nsearch wrappedlibrt: +- iEup: + - __clock_getres64 + - __clock_gettime64 - iEuBLL_: - __clock_gettime wrappedlibuuid: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index b4bd2a17..635d4441 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -28,6 +28,7 @@ typedef intptr_t (*lEi_t)(int32_t); typedef intptr_t (*lEp_t)(void*); typedef intptr_t (*lES_t)(void*); typedef uintptr_t (*LEL_t)(uintptr_t); +typedef uintptr_t (*LEp_t)(void*); typedef void* (*pEv_t)(void); typedef void* (*pFv_t)(void); typedef void* (*pEu_t)(uint32_t); @@ -72,6 +73,7 @@ typedef void (*vEpup_t)(void*, uint32_t, void*); typedef void (*vEppu_t)(void*, void*, uint32_t); typedef int32_t (*iEiip_t)(int32_t, int32_t, void*); typedef int32_t (*iEiiN_t)(int32_t, int32_t, ...); +typedef int32_t (*iEiLp_t)(int32_t, uintptr_t, void*); typedef int32_t (*iEipp_t)(int32_t, void*, void*); typedef int32_t (*iEipV_t)(int32_t, void*, ...); typedef int32_t (*iEpii_t)(void*, int32_t, int32_t); @@ -119,7 +121,10 @@ typedef int32_t (*iESipp_t)(void*, int32_t, void*, void*); typedef int32_t (*iESipV_t)(void*, int32_t, void*, ...); typedef uint32_t (*uEippu_t)(int32_t, void*, void*, uint32_t); typedef uintptr_t (*LEpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); +typedef int32_t (*iEiiipu_t)(int32_t, int32_t, int32_t, void*, uint32_t); +typedef int32_t (*iEiiipp_t)(int32_t, int32_t, int32_t, void*, void*); typedef int32_t (*iEiippi_t)(int32_t, int32_t, void*, void*, int32_t); +typedef int32_t (*iEiLLLL_t)(int32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); typedef int32_t (*iEipiup_t)(int32_t, void*, int32_t, uint32_t, void*); typedef int32_t (*iEipppp_t)(int32_t, void*, void*, void*, void*); typedef int32_t (*iEuppLp_t)(uint32_t, void*, void*, uintptr_t, void*); @@ -158,6 +163,7 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(sysconf, lEi_t) \ GO(atol, lEp_t) \ GO(ftell, lES_t) \ + GO(__mktime64, LEp_t) \ GO(__ctype_b_loc, pEv_t) \ GO(__ctype_tolower_loc, pEv_t) \ GO(__ctype_toupper_loc, pEv_t) \ @@ -170,6 +176,8 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(_ZGTtnaj, pFu_t) \ GO(_ZGTtnaX, pFL_t) \ GO(_ZGTtnam, pFL_t) \ + GO(__ctime64, pEp_t) \ + GO(__gmtime64, pEp_t) \ GO(__localtime64, pEp_t) \ GO(getgrnam, pEp_t) \ GO(getprotobyname, pEp_t) \ @@ -183,6 +191,8 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(ctime, pErl__t) \ GO(asctime, pEriiiiiiiiilt__t) \ GO(_obstack_newchunk, vEpi_t) \ + GO(__fstat64_time64, iFip_t) \ + GO(__futimens64, iEip_t) \ GO(fstatvfs, iEip_t) \ GO(fstatvfs64, iEip_t) \ GO(futimens, iEip_t) \ @@ -190,6 +200,9 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(getrlimit, iEup_t) \ GO(setrlimit, iEup_t) \ GO(backtrace, iEpi_t) \ + GO(__gettimeofday64, iEpp_t) \ + GO(__lstat64_time64, iEpp_t) \ + GO(__stat64_time64, iEpp_t) \ GO(alphasort64, iEpp_t) \ GO(statvfs, iEpp_t) \ GO(statvfs64, iEpp_t) \ @@ -209,6 +222,8 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(vsyslog, vEipp_t) \ GO(syslog, vEipV_t) \ GO(_ITM_addUserCommitAction, vEpup_t) \ + GO(__fcntl_time64, iEiiN_t) \ + GO(__ioctl_time64, iEiLp_t) \ GO(regcomp, iEppi_t) \ GO(__isoc23_vsscanf, iEppp_t) \ GO(vswscanf, iEppp_t) \ @@ -217,6 +232,8 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(__isoc23_fscanf, iESpV_t) \ GO(__isoc99_fscanf, iESpV_t) \ GO(fscanf, iESpV_t) \ + GO(__recvmsg64, lEipi_t) \ + GO(__sendmsg64, lEipi_t) \ GO(readv, lEipi_t) \ GO(recvmsg, lEipi_t) \ GO(sendmsg, lEipi_t) \ @@ -237,12 +254,18 @@ typedef int32_t (*iFpuippupp_t)(void*, uint32_t, int32_t, void*, void*, uint32_t GO(__syslog_chk, vEiipV_t) \ GO(sendmmsg, iEipuu_t) \ GO(__xmknod, iEipup_t) \ + GO(__fstatat64_time64, iEippi_t) \ GO(utimensat, iEippi_t) \ GO(readlinkat, iEippL_t) \ GO(waitid, iEuupi_t) \ GO(getaddrinfo, iEpppp_t) \ GO(regerror, uEippu_t) \ + GO(__setsockopt64, iEiiipu_t) \ + GO(__getsockopt64, iEiiipp_t) \ + GO(__prctl_time64, iEiLLLL_t) \ + GO(prctl, iEiLLLL_t) \ GO(statx, iEipiup_t) \ + GO(__select64, iEipppp_t) \ GO(getopt_long, iEipppp_t) \ GO(getgrgid_r, iEuppLp_t) \ GO(getpwuid_r, iEuppLp_t) \ diff --git a/src/wrapped32/generated/wrappedlibrttypes32.h b/src/wrapped32/generated/wrappedlibrttypes32.h index b9886aeb..9b2e8e9d 100644 --- a/src/wrapped32/generated/wrappedlibrttypes32.h +++ b/src/wrapped32/generated/wrappedlibrttypes32.h @@ -11,9 +11,12 @@ #define ADDED_FUNCTIONS() #endif +typedef int32_t (*iEup_t)(uint32_t, void*); typedef int32_t (*iEuBLL__t)(uint32_t, struct_LL_t*); #define SUPER() ADDED_FUNCTIONS() \ + GO(__clock_getres64, iEup_t) \ + GO(__clock_gettime64, iEup_t) \ GO(__clock_gettime, iEuBLL__t) #endif // __wrappedlibrtTYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 9e9e2574..569e951c 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -649,6 +649,7 @@ typedef int32_t (*iEiil_t)(int32_t, int32_t, intptr_t); typedef int32_t (*iEiip_t)(int32_t, int32_t, void*); typedef int32_t (*iFiip_t)(int32_t, int32_t, void*); typedef int32_t (*iEiiO_t)(int32_t, int32_t, int32_t); +typedef int32_t (*iEiiN_t)(int32_t, int32_t, ...); typedef int32_t (*iEiII_t)(int32_t, int64_t, int64_t); typedef int32_t (*iFiui_t)(int32_t, uint32_t, int32_t); typedef int32_t (*iEiuu_t)(int32_t, uint32_t, uint32_t); @@ -773,6 +774,7 @@ typedef double (*dEddd_t)(double, double, double); typedef double (*dEddp_t)(double, double, void*); typedef intptr_t (*lEEuV_t)(x64emu_t*, uint32_t, void*); typedef intptr_t (*lEili_t)(int32_t, intptr_t, int32_t); +typedef intptr_t (*lEipi_t)(int32_t, void*, int32_t); typedef intptr_t (*lEipL_t)(int32_t, void*, uintptr_t); typedef intptr_t (*lFlll_t)(intptr_t, intptr_t, intptr_t); typedef intptr_t (*lElpi_t)(intptr_t, void*, int32_t); @@ -1520,7 +1522,6 @@ typedef int32_t (*iEiiipp_t)(int32_t, int32_t, int32_t, void*, void*); typedef int32_t (*iFiuuuu_t)(int32_t, uint32_t, uint32_t, uint32_t, uint32_t); typedef int32_t (*iFiuuuU_t)(int32_t, uint32_t, uint32_t, uint32_t, uint64_t); typedef int32_t (*iFiuuup_t)(int32_t, uint32_t, uint32_t, uint32_t, void*); -typedef int32_t (*iEiLLLL_t)(int32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); typedef int32_t (*iFipiip_t)(int32_t, void*, int32_t, int32_t, void*); typedef int32_t (*iEipLLi_t)(int32_t, void*, uintptr_t, uintptr_t, int32_t); typedef int32_t (*iFippuu_t)(int32_t, void*, void*, uint32_t, uint32_t); @@ -1757,6 +1758,7 @@ typedef void (*vFXLiiiL_t)(void*, uintptr_t, int32_t, int32_t, int32_t, uintptr_ typedef void (*vFXLiipi_t)(void*, uintptr_t, int32_t, int32_t, void*, int32_t); 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 (*iEEiLLLL_t)(x64emu_t*, int32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_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); @@ -2796,6 +2798,7 @@ void iEiil_32(x64emu_t *emu, uintptr_t fcn) { iEiil_t fn = (iEiil_t)fcn; errno = void iEiip_32(x64emu_t *emu, uintptr_t fcn) { iEiip_t fn = (iEiip_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); emu->libc_err = errno; } void iFiip_32(x64emu_t *emu, uintptr_t fcn) { iFiip_t fn = (iFiip_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iEiiO_32(x64emu_t *emu, uintptr_t fcn) { iEiiO_t fn = (iEiiO_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), of_convert32(from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } +void iEiiN_32(x64emu_t *emu, uintptr_t fcn) { iEiiN_t fn = (iEiiN_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); emu->libc_err = errno; } void iEiII_32(x64emu_t *emu, uintptr_t fcn) { iEiII_t fn = (iEiII_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int64_t, R_ESP + 16)); emu->libc_err = errno; } void iFiui_32(x64emu_t *emu, uintptr_t fcn) { iFiui_t fn = (iFiui_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iEiuu_32(x64emu_t *emu, uintptr_t fcn) { iEiuu_t fn = (iEiuu_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); emu->libc_err = errno; } @@ -2920,6 +2923,7 @@ void dEddd_32(x64emu_t *emu, uintptr_t fcn) { dEddd_t fn = (dEddd_t)fcn; errno = void dEddp_32(x64emu_t *emu, uintptr_t fcn) { dEddp_t fn = (dEddp_t)fcn; errno = emu->libc_err; double db = fn(from_ptri(double, R_ESP + 4), from_ptri(double, R_ESP + 12), from_ptriv(R_ESP + 20)); fpu_do_push(emu); ST0val = db; emu->libc_err = errno; } void lEEuV_32(x64emu_t *emu, uintptr_t fcn) { lEEuV_t fn = (lEEuV_t)fcn; errno = emu->libc_err; R_EAX = to_long(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptrv(R_ESP + 8))); emu->libc_err = errno; } void lEili_32(x64emu_t *emu, uintptr_t fcn) { lEili_t fn = (lEili_t)fcn; errno = emu->libc_err; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_long(from_ptri(long_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } +void lEipi_32(x64emu_t *emu, uintptr_t fcn) { lEipi_t fn = (lEipi_t)fcn; errno = emu->libc_err; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } void lEipL_32(x64emu_t *emu, uintptr_t fcn) { lEipL_t fn = (lEipL_t)fcn; errno = emu->libc_err; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)))); emu->libc_err = errno; } void lFlll_32(x64emu_t *emu, uintptr_t fcn) { lFlll_t fn = (lFlll_t)fcn; R_EAX = to_long(fn(from_long(from_ptri(long_t, R_ESP + 4)), from_long(from_ptri(long_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12)))); } void lElpi_32(x64emu_t *emu, uintptr_t fcn) { lElpi_t fn = (lElpi_t)fcn; errno = emu->libc_err; R_EAX = to_long(fn(from_long(from_ptri(long_t, R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } @@ -3667,7 +3671,6 @@ void iEiiipp_32(x64emu_t *emu, uintptr_t fcn) { iEiiipp_t fn = (iEiiipp_t)fcn; e void iFiuuuu_32(x64emu_t *emu, uintptr_t fcn) { iFiuuuu_t fn = (iFiuuuu_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_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 iFiuuuU_32(x64emu_t *emu, uintptr_t fcn) { iFiuuuU_t fn = (iFiuuuU_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint64_t, R_ESP + 20)); } void iFiuuup_32(x64emu_t *emu, uintptr_t fcn) { iFiuuup_t fn = (iFiuuup_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } -void iEiLLLL_32(x64emu_t *emu, uintptr_t fcn) { iEiLLLL_t fn = (iEiLLLL_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ulong(from_ptri(ulong_t, R_ESP + 20))); emu->libc_err = errno; } void iFipiip_32(x64emu_t *emu, uintptr_t fcn) { iFipiip_t fn = (iFipiip_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } void iEipLLi_32(x64emu_t *emu, uintptr_t fcn) { iEipLLi_t fn = (iEipLLi_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; } void iFippuu_32(x64emu_t *emu, uintptr_t fcn) { iFippuu_t fn = (iFippuu_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); } @@ -3904,6 +3907,7 @@ void vFXLiiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXLiiiL_t fn = (vFXLiiiL_t)fcn void vFXLiipi_32(x64emu_t *emu, uintptr_t fcn) { vFXLiipi_t fn = (vFXLiipi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } void vFXLpppi_32(x64emu_t *emu, uintptr_t fcn) { vFXLpppi_t fn = (vFXLpppi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } 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 iEEiLLLL_32(x64emu_t *emu, uintptr_t fcn) { iEEiLLLL_t fn = (iEEiLLLL_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ulong(from_ptri(ulong_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; } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 058052a5..c2fd363d 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -596,6 +596,7 @@ void iEiil_32(x64emu_t *emu, uintptr_t fnc); void iEiip_32(x64emu_t *emu, uintptr_t fnc); void iFiip_32(x64emu_t *emu, uintptr_t fnc); void iEiiO_32(x64emu_t *emu, uintptr_t fnc); +void iEiiN_32(x64emu_t *emu, uintptr_t fnc); void iEiII_32(x64emu_t *emu, uintptr_t fnc); void iFiui_32(x64emu_t *emu, uintptr_t fnc); void iEiuu_32(x64emu_t *emu, uintptr_t fnc); @@ -720,6 +721,7 @@ void dEddd_32(x64emu_t *emu, uintptr_t fnc); void dEddp_32(x64emu_t *emu, uintptr_t fnc); void lEEuV_32(x64emu_t *emu, uintptr_t fnc); void lEili_32(x64emu_t *emu, uintptr_t fnc); +void lEipi_32(x64emu_t *emu, uintptr_t fnc); void lEipL_32(x64emu_t *emu, uintptr_t fnc); void lFlll_32(x64emu_t *emu, uintptr_t fnc); void lElpi_32(x64emu_t *emu, uintptr_t fnc); @@ -1467,7 +1469,6 @@ void iEiiipp_32(x64emu_t *emu, uintptr_t fnc); void iFiuuuu_32(x64emu_t *emu, uintptr_t fnc); void iFiuuuU_32(x64emu_t *emu, uintptr_t fnc); void iFiuuup_32(x64emu_t *emu, uintptr_t fnc); -void iEiLLLL_32(x64emu_t *emu, uintptr_t fnc); void iFipiip_32(x64emu_t *emu, uintptr_t fnc); void iEipLLi_32(x64emu_t *emu, uintptr_t fnc); void iFippuu_32(x64emu_t *emu, uintptr_t fnc); @@ -1704,6 +1705,7 @@ void vFXLiiiL_32(x64emu_t *emu, uintptr_t fnc); void vFXLiipi_32(x64emu_t *emu, uintptr_t fnc); void vFXLpppi_32(x64emu_t *emu, uintptr_t fnc); void iEEiippi_32(x64emu_t *emu, uintptr_t fnc); +void iEEiLLLL_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); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 2215028a..7da2215a 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -40,6 +40,7 @@ #include <sys/sysinfo.h> #include <sys/time.h> #include <regex.h> +#include <sys/prctl.h> #ifndef WINLATOR_GLIBC #include <sys/ipc.h> #include <sys/shm.h> @@ -2211,6 +2212,17 @@ EXPORT void* my32_gmtime(x64emu_t* emu, void* t) return NULL; } +EXPORT void* my32___gmtime64(x64emu_t* emu, void* t) +{ + static struct_iiiiiiiiilt_t res_ = {0}; + void* ret = gmtime(t); + if(ret) { + to_struct_iiiiiiiiilt(to_ptrv(&res_), ret); + return &res_; + } + return NULL; +} + EXPORT void* my32_gmtime_r(x64emu_t* emu, void* t, void* res) { struct_L_t t_ = {0}; @@ -2430,6 +2442,7 @@ EXPORT int32_t my32_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, ui int ret = fcntl(a, b, &fl); UnalignFlock_32(from_ptrv(d1), &fl); return ret; + //TODO: there might be some time related wells that need wrapping too } //TODO: check if better to use the syscall or regular fcntl? //return syscall(__NR_fcntl64, a, b, d1); // should be enough @@ -3369,6 +3382,44 @@ EXPORT int my32_waitid(x64emu_t* emu, uint32_t idtype, uint32_t id, void* siginf return ret; } +EXPORT int my32___prctl_time64(x64emu_t* emu, int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) +{ + if(option==PR_SET_NAME) { + printf_log(LOG_DEBUG, "set process name to \"%s\"\n", (char*)arg2); + ApplyEnvFileEntry((char*)arg2); + size_t l = strlen((char*)arg2); + if(l>4 && !strcasecmp((char*)arg2+l-4, ".exe")) { + printf_log(LOG_DEBUG, "hacking orig command line to \"%s\"\n", (char*)arg2); + strcpy(my_context->orig_argv[0], (char*)arg2); + } + } + if(option==PR_SET_SECCOMP) { + printf_log(LOG_INFO, "ignoring prctl(PR_SET_SECCOMP, ...)\n"); + return 0; + } + return prctl(option, arg2, arg3, arg4, arg5); +} + +EXPORT int my32_prctl(x64emu_t* emu, int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) +{ + // PR_GET_TID_ADDRESS has int** as arg2 + // is there a call that have a time arg? + if(option==PR_SET_NAME) { + printf_log(LOG_DEBUG, "set process name to \"%s\"\n", (char*)arg2); + ApplyEnvFileEntry((char*)arg2); + size_t l = strlen((char*)arg2); + if(l>4 && !strcasecmp((char*)arg2+l-4, ".exe")) { + printf_log(LOG_DEBUG, "hacking orig command line to \"%s\"\n", (char*)arg2); + strcpy(my_context->orig_argv[0], (char*)arg2); + } + } + if(option==PR_SET_SECCOMP) { + printf_log(LOG_INFO, "ignoring prctl(PR_SET_SECCOMP, ...)\n"); + return 0; + } + return prctl(option, arg2, arg3, arg4, arg5); +} + #undef HAS_MY #define PRE_INIT\ diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index b765aa42..7fbddf88 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -177,6 +177,7 @@ GO(creat64, iEpu) // create_module // Weak GO(ctermid, tEp) GOM(ctime, pErl_) //%noE +GO2(__ctime64, pEp, ctime) GO(ctime_r, pErl_p) DATAM(__ctype_b, 4) GOM(__ctype_b_loc, pEEv) @@ -314,6 +315,7 @@ GO(fclose, iES) GOW(fcloseall, iEv) GOM(fcntl, iEEiiN) //%% this also use a vararg for 3rd argument GOM(__fcntl, iEEiiN) //%% +GO2(__fcntl_time64, iEiiN, my_fcntl) GOM(fcntl64, iEEiiN) //%% //GO(fcvt, pEdipp) //GO(fcvt_r, iEdipppL) @@ -420,6 +422,8 @@ GO(__fsetlocking, iESi) //GO(fsetpos64, iEpp) GO(fsetxattr, iEippLi) GOM(fstat, iFip) //%%,noE +GO2(__fstat64_time64, iFip, fstat) +GO2(__fstatat64_time64, iEippi, fstatat) GOWM(fstatfs, iEip) //%%,noE GOWM(fstatfs64, iEip) //%%,noE GOM(fstatvfs, iEEip) @@ -442,6 +446,7 @@ GOW(ftruncate64, iEiI) GOM(ftw64, iEEppi) //%% GOW(funlockfile, vFS) GOM(futimens, iEEip) +GO2(__futimens64, iEip, futimens) GOWM(futimes, iEEip) //GO(futimesat, iEippp) // fwide @@ -594,7 +599,8 @@ GOM(getservbyname, pEEpp) //GO(getservent_r, iEppup) GO(getsid, iEi) GOW(getsockname, iEipp) -GOW(getsockopt, iEiiipp) +GOW(getsockopt, iEiiipp) // might need wrapping! +GO2(__getsockopt64, iEiiipp, getsockopt) // getsourcefilter //GO(getspent, pEv) // getspent_r @@ -605,6 +611,7 @@ GOW(gettext, pEp) GOW(gettid, iEv) GOW(gettimeofday, iEBll_p) //GO(__gettimeofday, iEpp) +GO2(__gettimeofday64, iEpp, gettimeofday) // getttyent // getttynam GOW(getuid, uEv) @@ -634,6 +641,7 @@ GO(globfree, vEp) //GO(globfree64, vEp) // glob_pattern_p // Weak GOM(gmtime, pEEp) +GOM(__gmtime64, pEEp) GO2(__gmtime_r, pEpp, my32_gmtime_r) GOWM(gmtime_r, pEEpp) GO(gnu_dev_major, uEU) @@ -728,6 +736,7 @@ GO(inotify_rm_watch, iEii) //GO(_IO_adjust_column, uEupi) // _IO_adjust_wcolumn GO(ioctl, iEiLp) //the vararg is just to have optional arg of various type, but only 1 arg +GO2(__ioctl_time64, iEiLp, ioctl) //GO(_IO_default_doallocate, iES) //GO(_IO_default_finish, vESi) //GO(_IO_default_pbackfail, iESi) @@ -1139,6 +1148,7 @@ GO(mkstemp, iEp) GO(mkstemp64, iEp) //GO(mktemp, pEp) GO(mktime, LEbiiiiiiiiilt_) +GO2(__mktime64, LEp, mktime) GO(mlock, iEpL) GO(mlockall, iEi) GOM(mmap, pEEpLiiil) //%% @@ -1294,7 +1304,8 @@ GOM(posix_spawn_file_actions_init, iEEp) //%% GOM(posix_spawnp, iEEpppppp) //%% GO(ppoll, iEpurLL_p) GO(__ppoll_chk, iEpurLL_pL) -GOW(prctl, iEiLLLL) +GOWM(prctl, iEEiLLLL) +GOWM(__prctl_time64, iEEiLLLL) GOW(pread, lEipLl) GOW(pread64, lEipLI) // __pread64 // Weak @@ -1394,6 +1405,7 @@ GOW(recvfrom, lEipLipp) // __recvfrom_chk GOM(recvmmsg, iEEipuurLL_) GOWM(recvmsg, lEEipi) +GO2(__recvmsg64, lEipi, recvmsg) // re_exec // Weak GOWM(regcomp, iEEppi) GOWM(regerror, uEEippu) @@ -1483,6 +1495,7 @@ GO(secure_getenv, tEp) //GO(seekdir, vEpi) GOW(select, iEippprLL_) GO(__select, iEippprLL_) +GO2(__select64, iEipppp, select) GO(semctl, iEiiiN) GOW(semget, iEiii) GOW(semop, iEipL) @@ -1492,6 +1505,7 @@ GOW(send, lEipLi) GO(sendfile, lEiibl_L) GO(sendfile64, lEiipL) GOWM(sendmsg, lEEipi) +GO2(__sendmsg64, lEipi, sendmsg) GOM(sendmmsg, iEEipuu) GOW(sendto, lEipLipu) // setaliasent @@ -1541,6 +1555,7 @@ GO(setrlimit64, iEup) // setservent GOW(setsid, iEv) GOW(setsockopt, iEiiipu) +GO2(__setsockopt64, iEiiipu, setsockopt) // setsourcefilter GO(setspent, vEv) // setstate // Weak @@ -1627,7 +1642,9 @@ GOM(sscanf, iEEppV) //%% // sstk GOM(__stack_chk_fail, vEEv) //%% //GOM(lstat64, iEpp) //%%,noE +GO2(__lstat64_time64, iEEpp, my_lstat64) //GOM(stat64, iEpp) //%%,noE +GO2(__stat64_time64, iEEpp, my_stat64) GOM(stat, iFpp) //%%,noE GOWM(statfs, iEpp) //%%,noE // __statfs diff --git a/src/wrapped32/wrappedlibrt_private.h b/src/wrapped32/wrappedlibrt_private.h index ddcb32a0..392f77ba 100755 --- a/src/wrapped32/wrappedlibrt_private.h +++ b/src/wrapped32/wrappedlibrt_private.h @@ -25,8 +25,10 @@ GO(aio_suspend64, iEpip) GO(aio_write64, iEp) GO(clock_getcpuclockid, iEup) GO(clock_getres, iEuBLL_) +GO2(__clock_getres64, iEup, clock_getres) GO(clock_gettime, iEuBLL_) // *timespec GO2(__clock_gettime, iEuBLL_, clock_gettime) +GO2(__clock_gettime64, iEup, clock_gettime) GO(clock_nanosleep, iEuirLL_BLL_) //GO(clock_settime, iEup) // lio_listio |