diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-23 19:45:13 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-23 19:45:13 +0200 |
| commit | 7317472b5f62316e5817f9e89ae2ddf99862412d (patch) | |
| tree | fa07f9df10da8400097c372289ec58094de5f6e2 /src | |
| parent | 9271684e5a9f356056a6038f652ec1c15ed16ed2 (diff) | |
| download | box64-7317472b5f62316e5817f9e89ae2ddf99862412d.tar.gz box64-7317472b5f62316e5817f9e89ae2ddf99862412d.zip | |
[BOX32][WRAPPER] More 32bits wrapped functions, and a few fixes on threads handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/x64emu_private.h | 6 | ||||
| -rwxr-xr-x | src/include/myalign32.h | 9 | ||||
| -rw-r--r-- | src/include/threads.h | 1 | ||||
| -rw-r--r-- | src/libtools/libc_net32.c | 30 | ||||
| -rw-r--r-- | src/libtools/threads.c | 15 | ||||
| -rwxr-xr-x | src/libtools/threads32.c | 68 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibc_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/converter32.c | 62 | ||||
| -rw-r--r-- | src/wrapped32/generated/converter32.h | 30 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 38 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 13 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibpthreadtypes32.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibx11types32.h | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 33 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 17 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 104 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 48 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibpthread.c | 31 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibpthread_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibx11.c | 242 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibx11_private.h | 20 |
21 files changed, 670 insertions, 109 deletions
diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h index f07f100e..6b6c75e7 100644 --- a/src/emu/x64emu_private.h +++ b/src/emu/x64emu_private.h @@ -136,13 +136,13 @@ typedef struct x64emu_s { int libc_err; // copy of errno from libc int libc_herr; // copy of h_errno from libc unsigned short libctype[384]; // copy from __ctype_b address might be too high - const unsigned short** ref_ctype; + const unsigned short* ref_ctype; const unsigned short* ctype; int libctolower[384]; // copy from __ctype_b_tolower address might be too high - const int** ref_tolower; + const int* ref_tolower; const int* tolower; int libctoupper[384]; // copy from __ctype_b_toupper address might be too high - const int** ref_toupper; + const int* ref_toupper; const int* toupper; #endif } x64emu_t; diff --git a/src/include/myalign32.h b/src/include/myalign32.h index dbbb0c9a..93844ad7 100755 --- a/src/include/myalign32.h +++ b/src/include/myalign32.h @@ -510,4 +510,13 @@ struct i386_passwd ptr_t pw_dir; // char* ptr_t pw_shell; // char* }; + +struct i386_group +{ + ptr_t gr_name; // char * + ptr_t gr_passwd; // char * + __gid_t gr_gid; + ptr_t gr_mem; // char ** +}; + #endif//__MY_ALIGN32__H_ \ No newline at end of file diff --git a/src/include/threads.h b/src/include/threads.h index fcceff33..7a77657f 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -9,6 +9,7 @@ typedef struct emuthread_s { void* arg; x64emu_t* emu; int join; + int is32bits; uintptr_t self; ulong_t hself; int cancel_cap, cancel_size; diff --git a/src/libtools/libc_net32.c b/src/libtools/libc_net32.c index 14101aea..6bdbce82 100644 --- a/src/libtools/libc_net32.c +++ b/src/libtools/libc_net32.c @@ -174,3 +174,33 @@ EXPORT void* my32___h_errno_location(x64emu_t* emu) emu->libc_herr = h_errno; return &emu->libc_herr; } + +struct protoent_32 +{ + ptr_t p_name; //char* + ptr_t p_aliases;// char** + int p_proto; +}; + +EXPORT void* my32_getprotobyname(x64emu_t* emu, void* name) +{ + static struct protoent_32 my_protoent = {0}; + static ptr_t strings[256]; + struct protoent *ret = getprotobyname(name); + if(!ret) + return NULL; + my_protoent.p_name = to_cstring(ret->p_name); + my_protoent.p_proto = ret->p_proto; + if(ret->p_aliases) { + my_protoent.p_aliases = to_ptrv(&strings); + int i = 0; + while(ret->p_aliases[i]) { + strings[i] = to_cstring(ret->p_aliases[i]); + ++i; + } + strings[i] = 0; + } else + my_protoent.p_aliases = 0; + + return &my_protoent; +} \ No newline at end of file diff --git a/src/libtools/threads.c b/src/libtools/threads.c index f0632154..6ca80bba 100644 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -129,13 +129,13 @@ void my_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t static pthread_key_t thread_key; -static void emuthread_destroy(void* p) +void emuthread_destroy(void* p) { emuthread_t *et = (emuthread_t*)p; if(!et) return; #ifdef BOX32 - if(!et->join && et->fnc) + if(et->is32bits && !et->join && et->fnc) to_hash_d(et->self); #endif FreeX64Emu(&et->emu); @@ -180,6 +180,7 @@ void thread_set_emu(x64emu_t* emu) et->emu->type = EMUTYPE_MAIN; #ifdef BOX32 if(box64_is32bits) { + et->is32bits = 1; et->self = (uintptr_t)pthread_self(); et->hself = to_hash(et->self); } @@ -213,6 +214,16 @@ x64emu_t* thread_get_emu() return et->emu; } +emuthread_t* thread_get_et() +{ + return (emuthread_t*)pthread_getspecific(thread_key); +} + +void thread_set_et(emuthread_t* et) +{ + pthread_setspecific(thread_key, et); +} + static void* pthread_routine(void* p) { // free current emuthread if it exist diff --git a/src/libtools/threads32.c b/src/libtools/threads32.c index 5cc808a0..4d2f8cfb 100755 --- a/src/libtools/threads32.c +++ b/src/libtools/threads32.c @@ -69,14 +69,19 @@ typedef struct __jmp_buf_tag_s { sigset_t __saved_mask; } __jmp_buf_tag_t; -typedef struct x64_unwind_buff_s { +typedef struct i386_unwind_buff_s { struct { jump_buff_i386_t __cancel_jmp_buf; int __mask_was_saved; } __cancel_jmp_buf[1]; ptr_t __pad[2]; void* __pad3; -} x64_unwind_buff_t __attribute__((__aligned__)); +} i386_unwind_buff_t __attribute__((__aligned__)); + +// those are define in thread.c +emuthread_t* thread_get_et(); +void thread_set_et(emuthread_t* et); +void emuthread_destroy(void* p); static pthread_attr_t* get_attr(void* attr); static void del_attr(void* attr); @@ -93,22 +98,8 @@ void FreeStackSize(kh_threadstack_t* map, uintptr_t attr); void AddStackSize(kh_threadstack_t* map, uintptr_t attr, void* stack, size_t stacksize); int GetStackSize(x64emu_t* emu, uintptr_t attr, void** stack, size_t* stacksize); -static pthread_key_t thread_key; - void my32_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val); -static void emuthread_destroy(void* p) -{ - emuthread_t *et = (emuthread_t*)p; - if(!et) - return; - // destroy thread emu and all - if(!et->join && et->fnc) // if there is no function, that this thread was not built from a create_thread, don't touch the hash... - to_hash_d(et->self); - FreeX64Emu(&et->emu); - free(et); -} - static void emuthread_cancel(void* p) { emuthread_t *et = (emuthread_t*)p; @@ -117,7 +108,7 @@ static void emuthread_cancel(void* p) // check cancels threads for(int i=et->cancel_size-1; i>=0; --i) { et->emu->flags.quitonlongjmp = 0; - my32_longjmp(et->emu, ((x64_unwind_buff_t*)et->cancels[i])->__cancel_jmp_buf, 1); + my32_longjmp(et->emu, ((i386_unwind_buff_t*)et->cancels[i])->__cancel_jmp_buf, 1); DynaRun(et->emu); // will return after a __pthread_unwind_next() } free(et->cancels); @@ -129,16 +120,16 @@ static void* pthread_routine(void* p) { // free current emuthread if it exist { - void* t = pthread_getspecific(thread_key); + void* t = thread_get_et(); if(t) { // not sure how this could happens printf_log(LOG_INFO, "Clean of an existing ET for Thread %04d\n", GetTID()); emuthread_destroy(t); } } - pthread_setspecific(thread_key, p); // call the function emuthread_t *et = (emuthread_t*)p; + thread_set_et(et); et->emu->type = EMUTYPE_MAIN; et->self = (uintptr_t)pthread_self(); et->hself = to_hash(et->self); @@ -244,7 +235,7 @@ EXPORT int my32_pthread_create(x64emu_t *emu, void* t, void* attr, void* start_r EXPORT int my32_pthread_detach(x64emu_t* emu, pthread_t p) { if(pthread_equal(p ,pthread_self())) { - emuthread_t *et = (emuthread_t*)pthread_getspecific(thread_key); + emuthread_t *et = (emuthread_t*)thread_get_et(); et->join = 0; } return pthread_detach(p); @@ -274,24 +265,24 @@ void* my32_prepare_thread(x64emu_t *emu, void* f, void* arg, int ssize, void** p void my32_longjmp(x64emu_t* emu, /*struct __jmp_buf_tag __env[1]*/void *p, int32_t __val); -EXPORT void my32___pthread_register_cancel(x64emu_t* emu, x64_unwind_buff_t* buff) +EXPORT void my32___pthread_register_cancel(x64emu_t* emu, i386_unwind_buff_t* buff) { - buff = (x64_unwind_buff_t*)from_ptr(R_EAX); // param is in fact on register - emuthread_t *et = (emuthread_t*)pthread_getspecific(thread_key); + buff = (i386_unwind_buff_t*)from_ptr(R_EAX); // param is in fact on register + emuthread_t *et = (emuthread_t*)thread_get_et(); if(et->cancel_cap == et->cancel_size) { et->cancel_cap+=8; - et->cancels = realloc(et->cancels, sizeof(x64_unwind_buff_t*)*et->cancel_cap); + et->cancels = realloc(et->cancels, sizeof(i386_unwind_buff_t*)*et->cancel_cap); } et->cancels[et->cancel_size++] = buff; } -EXPORT void my32___pthread_unregister_cancel(x64emu_t* emu, x64_unwind_buff_t* buff) +EXPORT void my32___pthread_unregister_cancel(x64emu_t* emu, i386_unwind_buff_t* buff) { - emuthread_t *et = (emuthread_t*)pthread_getspecific(thread_key); + emuthread_t *et = (emuthread_t*)thread_get_et(); for (int i=et->cancel_size-1; i>=0; --i) { if(et->cancels[i] == buff) { if(i!=et->cancel_size-1) - memmove(et->cancels+i, et->cancels+i+1, sizeof(x64_unwind_buff_t*)*(et->cancel_size-i-1)); + memmove(et->cancels+i, et->cancels+i+1, sizeof(i386_unwind_buff_t*)*(et->cancel_size-i-1)); et->cancel_size--; } } @@ -364,9 +355,9 @@ GO(29) // cleanup_routine #define GO(A) \ -static uintptr_t my32_cleanup_routine_fct_##A = 0; \ -static void my32_cleanup_routine_##A(void* a) \ -{ \ +static uintptr_t my32_cleanup_routine_fct_##A = 0; \ +static void my32_cleanup_routine_##A(void* a) \ +{ \ RunFunctionFmt(my32_cleanup_routine_fct_##A, "p", to_ptrv(a)); \ } SUPER() @@ -387,9 +378,9 @@ static void* findcleanup_routineFct(void* fct) // key_destructor #define GO(A) \ -static uintptr_t my32_key_destructor_fct_##A = 0; \ -static void my32_key_destructor_##A(void* a) \ -{ \ +static uintptr_t my32_key_destructor_fct_##A = 0; \ +static void my32_key_destructor_##A(void* a) \ +{ \ RunFunctionFmt(my32_key_destructor_fct_##A, "p", to_ptrv(a)); \ } SUPER() @@ -639,6 +630,11 @@ EXPORT int my32_pthread_attr_init(x64emu_t* emu, void* attr) return pthread_attr_init(get_attr(attr)); } +EXPORT int my32_pthread_getattr_np(x64emu_t* emu, uintptr_t th, void* attr) +{ + return pthread_getattr_np(th, get_attr(attr)); +} + EXPORT int my32_pthread_attr_getdetachstate(x64emu_t* emu, void* attr, void* p) { return pthread_attr_getdetachstate(get_attr(attr), p); @@ -920,16 +916,14 @@ void init_pthread_helper_32() mapcond = kh_init(mapcond); unaligned_mutex = kh_init(mutex); - pthread_key_create(&thread_key, emuthread_destroy); - pthread_setspecific(thread_key, NULL); } void clean_current_emuthread_32() { - emuthread_t *et = (emuthread_t*)pthread_getspecific(thread_key); + emuthread_t *et = (emuthread_t*)thread_get_et(); if(et) { emuthread_destroy(et); - pthread_setspecific(thread_key, NULL); + thread_set_et(NULL); } } diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index b4339643..ad937bf1 100644 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1357,7 +1357,7 @@ GOW(ngettext, pFppL) GO(nice, iFi) //DATAB(_nl_domain_bindings, GO(nl_langinfo, pFi) -GO(__nl_langinfo_l, pFup) +GO(__nl_langinfo_l, pFip) GOW(nl_langinfo_l, pFip) //DATAB(_nl_msg_cat_cntr, GO(nrand48, lFp) diff --git a/src/wrapped32/generated/converter32.c b/src/wrapped32/generated/converter32.c index 89d52604..08395ec3 100644 --- a/src/wrapped32/generated/converter32.c +++ b/src/wrapped32/generated/converter32.c @@ -35,6 +35,68 @@ void to_struct_LL(ptr_t d, const struct_LL_t *src) { *(ulong_t*)dest = to_ulong(src->L1); dest += 4; } +void from_struct_LLLL(struct_LLLL_t *dest, ptr_t s) { + if(!s) return; + uint8_t* src = (uint8_t*)from_ptrv(s); + dest->L0 = from_ulong(*(ulong_t*)src); src += 4; + dest->L1 = from_ulong(*(ulong_t*)src); src += 4; + dest->L2 = from_ulong(*(ulong_t*)src); src += 4; + dest->L3 = from_ulong(*(ulong_t*)src); src += 4; +} +void to_struct_LLLL(ptr_t d, const struct_LLLL_t *src) { + if (!src) return; + uint8_t* dest = (uint8_t*)from_ptrv(d); + *(ulong_t*)dest = to_ulong(src->L0); dest += 4; + *(ulong_t*)dest = to_ulong(src->L1); dest += 4; + *(ulong_t*)dest = to_ulong(src->L2); dest += 4; + *(ulong_t*)dest = to_ulong(src->L3); dest += 4; +} + +void from_struct_LLLLLLLLLLLLLLLLLL(struct_LLLLLLLLLLLLLLLLLL_t *dest, ptr_t s) { + if(!s) return; + uint8_t* src = (uint8_t*)from_ptrv(s); + dest->L0 = from_ulong(*(ulong_t*)src); src += 4; + dest->L1 = from_ulong(*(ulong_t*)src); src += 4; + dest->L2 = from_ulong(*(ulong_t*)src); src += 4; + dest->L3 = from_ulong(*(ulong_t*)src); src += 4; + dest->L4 = from_ulong(*(ulong_t*)src); src += 4; + dest->L5 = from_ulong(*(ulong_t*)src); src += 4; + dest->L6 = from_ulong(*(ulong_t*)src); src += 4; + dest->L7 = from_ulong(*(ulong_t*)src); src += 4; + dest->L8 = from_ulong(*(ulong_t*)src); src += 4; + dest->L9 = from_ulong(*(ulong_t*)src); src += 4; + dest->L10 = from_ulong(*(ulong_t*)src); src += 4; + dest->L11 = from_ulong(*(ulong_t*)src); src += 4; + dest->L12 = from_ulong(*(ulong_t*)src); src += 4; + dest->L13 = from_ulong(*(ulong_t*)src); src += 4; + dest->L14 = from_ulong(*(ulong_t*)src); src += 4; + dest->L15 = from_ulong(*(ulong_t*)src); src += 4; + dest->L16 = from_ulong(*(ulong_t*)src); src += 4; + dest->L17 = from_ulong(*(ulong_t*)src); src += 4; +} +void to_struct_LLLLLLLLLLLLLLLLLL(ptr_t d, const struct_LLLLLLLLLLLLLLLLLL_t *src) { + if (!src) return; + uint8_t* dest = (uint8_t*)from_ptrv(d); + *(ulong_t*)dest = to_ulong(src->L0); dest += 4; + *(ulong_t*)dest = to_ulong(src->L1); dest += 4; + *(ulong_t*)dest = to_ulong(src->L2); dest += 4; + *(ulong_t*)dest = to_ulong(src->L3); dest += 4; + *(ulong_t*)dest = to_ulong(src->L4); dest += 4; + *(ulong_t*)dest = to_ulong(src->L5); dest += 4; + *(ulong_t*)dest = to_ulong(src->L6); dest += 4; + *(ulong_t*)dest = to_ulong(src->L7); dest += 4; + *(ulong_t*)dest = to_ulong(src->L8); dest += 4; + *(ulong_t*)dest = to_ulong(src->L9); dest += 4; + *(ulong_t*)dest = to_ulong(src->L10); dest += 4; + *(ulong_t*)dest = to_ulong(src->L11); dest += 4; + *(ulong_t*)dest = to_ulong(src->L12); dest += 4; + *(ulong_t*)dest = to_ulong(src->L13); dest += 4; + *(ulong_t*)dest = to_ulong(src->L14); dest += 4; + *(ulong_t*)dest = to_ulong(src->L15); dest += 4; + *(ulong_t*)dest = to_ulong(src->L16); dest += 4; + *(ulong_t*)dest = to_ulong(src->L17); dest += 4; +} + void from_struct_h(struct_h_t *dest, ptr_t s) { uint8_t* src = (uint8_t*)from_ptrv(s); dest->h0 = from_hash(*(ulong_t*)src); src += 4; diff --git a/src/wrapped32/generated/converter32.h b/src/wrapped32/generated/converter32.h index b8596480..c643afc3 100644 --- a/src/wrapped32/generated/converter32.h +++ b/src/wrapped32/generated/converter32.h @@ -20,6 +20,36 @@ typedef struct struct_LL_s { } struct_LL_t; void from_struct_LL(struct_LL_t *dest, ptr_t src); void to_struct_LL(ptr_t dest, const struct_LL_t *src); +typedef struct struct_LLLL_s { + unsigned long L0; + unsigned long L1; + unsigned long L2; + unsigned long L3; +} struct_LLLL_t; +void from_struct_LLLL(struct_LLLL_t *dest, ptr_t src); +void to_struct_LLLL(ptr_t dest, const struct_LLLL_t *src); +typedef struct struct_LLLLLLLLLLLLLLLLLL_s { + unsigned long L0; + unsigned long L1; + unsigned long L2; + unsigned long L3; + unsigned long L4; + unsigned long L5; + unsigned long L6; + unsigned long L7; + unsigned long L8; + unsigned long L9; + unsigned long L10; + unsigned long L11; + unsigned long L12; + unsigned long L13; + unsigned long L14; + unsigned long L15; + unsigned long L16; + unsigned long L17; +} struct_LLLLLLLLLLLLLLLLLL_t; +void from_struct_LLLLLLLLLLLLLLLLLL(struct_LLLLLLLLLLLLLLLLLL_t *dest, ptr_t src); +void to_struct_LLLLLLLLLLLLLLLLLL(ptr_t dest, const struct_LLLLLLLLLLLLLLLLLL_t *src); typedef struct struct_h_s { uintptr_t h0; } struct_h_t; diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 25cf3ae9..0d4fd9d0 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -210,6 +210,7 @@ #() iFBLL_p -> iFBp #() iFrLL_BLL_ -> iFBB #() pFriiiiiiiiilt_p -> pFBp +#() iFiBLLLLLLLLLLLLLLLLLL_ -> iFiB #() vFEip -> vFEip #() vFEpi -> vFEpi #() vFEpu -> vFEpu @@ -275,6 +276,7 @@ #() vFppi -> vFppi #() vFppu -> vFppu #() vFppp -> vFppp +#() vFXLp -> vFXLp #() vFXpi -> vFXpi #() iFEip -> iFEip #() iFEpi -> iFEpi @@ -282,6 +284,7 @@ #() iFEpp -> iFEpp #() iFEpV -> iFEpV #() iFEhi -> iFEhi +#() iFEhp -> iFEhp #() iFESp -> iFESp #() iFEXp -> iFEXp #() iFiii -> iFiii @@ -291,6 +294,7 @@ #() iFiiO -> iFiiO #() iFiII -> iFiII #() iFiuu -> iFiuu +#() iFiup -> iFiup #() iFiLN -> iFiLN #() iFipu -> iFipu #() iFipL -> iFipL @@ -383,7 +387,9 @@ #() dFpBp_a -> dFpBa #() lFpBp_i -> lFpBi #() LFpBp_i -> LFpBi +#() pFppbp_ -> pFppB #() iFXLbLWWWcc_ -> iFXLB +#() iFirLLLL_BLLLL_ -> iFiBB #() pFppriiiiiiiiilt_ -> pFppB #() vFEipp -> vFEipp #() vFEipV -> vFEipV @@ -471,6 +477,7 @@ #() vFppip -> vFppip #() vFpppp -> vFpppp #() vFXiiL -> vFXiiL +#() vFXLpL -> vFXLpL #() vFXpip -> vFXpip #() cFpiii -> cFpiii #() iFEiip -> iFEiip @@ -528,10 +535,12 @@ #() pFEppp -> pFEppp #() pFiiiu -> pFiiiu #() pFillu -> pFillu +#() pFippu -> pFippu #() pFullu -> pFullu #() pFlfff -> pFlfff #() pFpiLL -> pFpiLL #() pFpuii -> pFpuii +#() pFpLiS -> pFpLiS #() pFppLL -> pFppLL #() pFpppp -> pFpppp #() pFXiii -> pFXiii @@ -743,6 +752,12 @@ #() vFpipipV -> vFpipipV #() vFpdddii -> vFpdddii #() vFppupii -> vFppupii +#() iFEuppup -> iFEuppup +#() iFEuppLp -> iFEuppLp +#() iFEpiLpp -> iFEpiLpp +#() iFEpppup -> iFEpppup +#() iFEXLilp -> iFEXLilp +#() iFEXpiup -> iFEXpiup #() iFuiiuup -> iFuiiuup #() iFpiippp -> iFpiippp #() iFppiiii -> iFppiiii @@ -753,6 +768,7 @@ #() lFipLipp -> lFipLipp #() pFEpiiuu -> pFEpiiuu #() pFEpLLiN -> pFEpLLiN +#() pFEppLLp -> pFEppLLp #() vFiiiiiip -> vFiiiiiip #() vFiiiiuup -> vFiiiiuup #() vFiiuilil -> vFiiuilil @@ -949,6 +965,7 @@ #!defined(HAVE_LD80BITS) KFKK -> KFKK #!defined(HAVE_LD80BITS) KFKp -> KFKp #!defined(HAVE_LD80BITS) KFpBp_a -> KFpBa +#() iFEvpp -> iFEpp #() iFEvpV -> iFEpV #() UFsvvs -> UFss #() pFEppv -> pFEpp @@ -984,6 +1001,8 @@ wrappedlibc: - uFp: - uFV: - UFp: +- lFp: + - atol - lFS: - ftell - LFL: @@ -999,6 +1018,7 @@ wrappedlibc: - pFL: - pFp: - gethostbyname + - getprotobyname - getpwnam - gmtime - localtime @@ -1038,6 +1058,7 @@ wrappedlibc: - vFpup: - _ITM_addUserCommitAction - vFppu: +- iFvpp: - iFvpV: - iFiip: - iFiiN: @@ -1085,8 +1106,17 @@ wrappedlibc: - iFSvpp: - iFSvpV: - LFppiv: +- iFuppup: + - getgrgid_r +- iFuppLp: + - getpwuid_r - iFpvvpV: +- iFpiLpp: +- iFpppup: + - getgrnam_r + - getpwnam_r - pFpLLiN: +- pFppLLp: - iFpLvvpp: - iFpLiipV: - pFpLiiii: @@ -1290,6 +1320,8 @@ wrappedlibpthread: - sem_getvalue - iFhi: - pthread_kill@GLIBC_2.0 +- iFhp: + - pthread_getattr_np - vFppp: - _pthread_cleanup_push - _pthread_cleanup_push_defer @@ -1331,6 +1363,8 @@ wrappedlibx11: - XCreateIC - vFXLp: - XSetWMNormalHints +- iFpip: + - XStringListToTextProperty - iFXip: - XCheckTypedEvent - iFXLp: @@ -1339,6 +1373,10 @@ wrappedlibx11: - XGetPixel - iFXLpi: - XSetWMProtocols +- iFXLilp: + - XSendEvent +- iFXpiup: + - Xutf8TextListToTextProperty - pFpiiuu: - XSubImage - pFXLiiuuLi: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index 84db2acd..b3c7f7ae 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -23,6 +23,7 @@ typedef uint32_t (*uFu_t)(uint32_t); typedef uint32_t (*uFp_t)(void*); typedef uint32_t (*uFV_t)(...); typedef uint64_t (*UFp_t)(void*); +typedef intptr_t (*lFp_t)(void*); typedef intptr_t (*lFS_t)(void*); typedef uintptr_t (*LFL_t)(uintptr_t); typedef void* (*pFv_t)(void); @@ -48,6 +49,7 @@ typedef void* (*SFpp_t)(void*, void*); typedef void (*vFipV_t)(int32_t, void*, ...); typedef void (*vFpup_t)(void*, uint32_t, void*); typedef void (*vFppu_t)(void*, void*, uint32_t); +typedef int32_t (*iFvpp_t)(void, void*, void*); typedef int32_t (*iFvpV_t)(void, void*, ...); typedef int32_t (*iFiip_t)(int32_t, int32_t, void*); typedef int32_t (*iFiiN_t)(int32_t, int32_t, ...); @@ -82,8 +84,13 @@ typedef int32_t (*iFpppp_t)(void*, void*, void*, void*); typedef int32_t (*iFSvpp_t)(void*, void, void*, void*); typedef int32_t (*iFSvpV_t)(void*, void, void*, ...); typedef uintptr_t (*LFppiv_t)(void*, void*, int32_t, void); +typedef int32_t (*iFuppup_t)(uint32_t, void*, void*, uint32_t, void*); +typedef int32_t (*iFuppLp_t)(uint32_t, void*, void*, uintptr_t, void*); typedef int32_t (*iFpvvpV_t)(void*, void, void, void*, ...); +typedef int32_t (*iFpiLpp_t)(void*, int32_t, uintptr_t, void*, void*); +typedef int32_t (*iFpppup_t)(void*, void*, void*, uint32_t, void*); typedef void* (*pFpLLiN_t)(void*, uintptr_t, uintptr_t, int32_t, ...); +typedef void* (*pFppLLp_t)(void*, void*, uintptr_t, uintptr_t, void*); typedef int32_t (*iFpLvvpp_t)(void*, uintptr_t, void, void, void*, void*); typedef int32_t (*iFpLiipV_t)(void*, uintptr_t, int32_t, int32_t, void*, ...); typedef void* (*pFpLiiii_t)(void*, uintptr_t, int32_t, int32_t, int32_t, int32_t); @@ -96,6 +103,7 @@ typedef void* (*pFiiiiiiiiilt_t)(int32_t, int32_t, int32_t, int32_t, int32_t, in GO(__close_nocancel, iFi_t) \ GO(getifaddrs, iFp_t) \ GO(getwc, iFh_t) \ + GO(atol, lFp_t) \ GO(ftell, lFS_t) \ GO(__ctype_b_loc, pFv_t) \ GO(__ctype_tolower_loc, pFv_t) \ @@ -105,6 +113,7 @@ typedef void* (*pFiiiiiiiiilt_t)(int32_t, int32_t, int32_t, int32_t, int32_t, in GO(localeconv, pFv_t) \ GO(getpwuid, pFu_t) \ GO(gethostbyname, pFp_t) \ + GO(getprotobyname, pFp_t) \ GO(getpwnam, pFp_t) \ GO(gmtime, pFp_t) \ GO(localtime, pFp_t) \ @@ -138,6 +147,10 @@ typedef void* (*pFiiiiiiiiilt_t)(int32_t, int32_t, int32_t, int32_t, int32_t, in GO(__realpath_chk, pFppv_t) \ GO(__libc_init, vFpppp_t) \ GO(getaddrinfo, iFpppp_t) \ + GO(getgrgid_r, iFuppup_t) \ + GO(getpwuid_r, iFuppLp_t) \ + GO(getgrnam_r, iFpppup_t) \ + GO(getpwnam_r, iFpppup_t) \ GO(asctime, pFiiiiiiiiilt_t) #endif // __wrappedlibcTYPES32_H_ diff --git a/src/wrapped32/generated/wrappedlibpthreadtypes32.h b/src/wrapped32/generated/wrappedlibpthreadtypes32.h index 0ddcd826..337454d7 100644 --- a/src/wrapped32/generated/wrappedlibpthreadtypes32.h +++ b/src/wrapped32/generated/wrappedlibpthreadtypes32.h @@ -20,6 +20,7 @@ typedef int32_t (*iFpi_t)(void*, int32_t); typedef int32_t (*iFpL_t)(void*, uintptr_t); typedef int32_t (*iFpp_t)(void*, void*); typedef int32_t (*iFhi_t)(uintptr_t, int32_t); +typedef int32_t (*iFhp_t)(uintptr_t, void*); typedef void (*vFppp_t)(void*, void*, void*); typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t); typedef int32_t (*iFpup_t)(void*, uint32_t, void*); @@ -97,6 +98,7 @@ typedef int32_t (*iFhppp_t)(uintptr_t, void*, void*, void*); GO(pthread_rwlock_init, iFpp_t) \ GO(sem_getvalue, iFpp_t) \ GO(pthread_kill@GLIBC_2.0, iFhi_t) \ + GO(pthread_getattr_np, iFhp_t) \ GO(_pthread_cleanup_push, vFppp_t) \ GO(_pthread_cleanup_push_defer, vFppp_t) \ GO(sem_init, iFpiu_t) \ diff --git a/src/wrapped32/generated/wrappedlibx11types32.h b/src/wrapped32/generated/wrappedlibx11types32.h index bb91baa0..a292f24c 100644 --- a/src/wrapped32/generated/wrappedlibx11types32.h +++ b/src/wrapped32/generated/wrappedlibx11types32.h @@ -17,10 +17,13 @@ typedef void* (*pFp_t)(void*); typedef int32_t (*iFXp_t)(void*, void*); typedef void* (*pFpV_t)(void*, ...); typedef void (*vFXLp_t)(void*, uintptr_t, void*); +typedef int32_t (*iFpip_t)(void*, int32_t, void*); typedef int32_t (*iFXip_t)(void*, int32_t, void*); typedef int32_t (*iFXLp_t)(void*, uintptr_t, void*); typedef uintptr_t (*LFXii_t)(void*, int32_t, int32_t); typedef int32_t (*iFXLpi_t)(void*, uintptr_t, void*, int32_t); +typedef int32_t (*iFXLilp_t)(void*, uintptr_t, int32_t, intptr_t, void*); +typedef int32_t (*iFXpiup_t)(void*, void*, int32_t, uint32_t, void*); typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t); typedef void* (*pFXLiiuuLi_t)(void*, uintptr_t, int32_t, int32_t, uint32_t, uint32_t, uintptr_t, int32_t); typedef int32_t (*iFXLppiiiiuu_t)(void*, uintptr_t, void*, void*, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t); @@ -37,10 +40,13 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32 GO(XNextEvent, iFXp_t) \ GO(XCreateIC, pFpV_t) \ GO(XSetWMNormalHints, vFXLp_t) \ + GO(XStringListToTextProperty, iFpip_t) \ GO(XCheckTypedEvent, iFXip_t) \ GO(XSetWMHints, iFXLp_t) \ GO(XGetPixel, LFXii_t) \ GO(XSetWMProtocols, iFXLpi_t) \ + GO(XSendEvent, iFXLilp_t) \ + GO(Xutf8TextListToTextProperty, iFXpiup_t) \ GO(XSubImage, pFpiiuu_t) \ GO(XGetImage, pFXLiiuuLi_t) \ GO(XPutImage, iFXLppiiiiuu_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 93887fe9..02987ce5 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -299,6 +299,7 @@ typedef int32_t (*iFpbup__t)(void*, struct_up_t*); typedef int32_t (*iFBLL_p_t)(struct_LL_t*, void*); typedef int32_t (*iFrLL_BLL__t)(struct_LL_t*, struct_LL_t*); typedef void* (*pFriiiiiiiiilt_p_t)(struct_iiiiiiiiilt_t*, void*); +typedef int32_t (*iFiBLLLLLLLLLLLLLLLLLL__t)(int32_t, struct_LLLLLLLLLLLLLLLLLL_t*); typedef void (*vFEip_t)(x64emu_t*, int32_t, void*); typedef void (*vFEpi_t)(x64emu_t*, void*, int32_t); typedef void (*vFEpu_t)(x64emu_t*, void*, uint32_t); @@ -364,6 +365,7 @@ typedef void (*vFplp_t)(void*, intptr_t, void*); typedef void (*vFppi_t)(void*, void*, int32_t); typedef void (*vFppu_t)(void*, void*, uint32_t); typedef void (*vFppp_t)(void*, void*, void*); +typedef void (*vFXLp_t)(void*, uintptr_t, void*); typedef void (*vFXpi_t)(void*, void*, int32_t); typedef int32_t (*iFEip_t)(x64emu_t*, int32_t, void*); typedef int32_t (*iFEpi_t)(x64emu_t*, void*, int32_t); @@ -371,6 +373,7 @@ typedef int32_t (*iFEpL_t)(x64emu_t*, void*, uintptr_t); typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*); typedef int32_t (*iFEpV_t)(x64emu_t*, void*, void*); typedef int32_t (*iFEhi_t)(x64emu_t*, uintptr_t, int32_t); +typedef int32_t (*iFEhp_t)(x64emu_t*, uintptr_t, void*); typedef int32_t (*iFESp_t)(x64emu_t*, void*, void*); typedef int32_t (*iFEXp_t)(x64emu_t*, void*, void*); typedef int32_t (*iFiii_t)(int32_t, int32_t, int32_t); @@ -380,6 +383,7 @@ typedef int32_t (*iFiip_t)(int32_t, int32_t, void*); typedef int32_t (*iFiiO_t)(int32_t, int32_t, int32_t); typedef int32_t (*iFiII_t)(int32_t, int64_t, int64_t); typedef int32_t (*iFiuu_t)(int32_t, uint32_t, uint32_t); +typedef int32_t (*iFiup_t)(int32_t, uint32_t, void*); typedef int32_t (*iFiLN_t)(int32_t, uintptr_t, ...); typedef int32_t (*iFipu_t)(int32_t, void*, uint32_t); typedef int32_t (*iFipL_t)(int32_t, void*, uintptr_t); @@ -472,7 +476,9 @@ typedef double (*dFpBp_i_t)(void*, struct_p_t*, int32_t); typedef double (*dFpBp_a_t)(void*, struct_p_t*, void*); typedef intptr_t (*lFpBp_i_t)(void*, struct_p_t*, int32_t); typedef uintptr_t (*LFpBp_i_t)(void*, struct_p_t*, int32_t); +typedef void* (*pFppbp__t)(void*, void*, struct_p_t*); typedef int32_t (*iFXLbLWWWcc__t)(void*, uintptr_t, struct_LWWWcc_t*); +typedef int32_t (*iFirLLLL_BLLLL__t)(int32_t, struct_LLLL_t*, struct_LLLL_t*); typedef void* (*pFppriiiiiiiiilt__t)(void*, void*, struct_iiiiiiiiilt_t*); typedef void (*vFEipp_t)(x64emu_t*, int32_t, void*, void*); typedef void (*vFEipV_t)(x64emu_t*, int32_t, void*, void*); @@ -560,6 +566,7 @@ typedef void (*vFplpp_t)(void*, intptr_t, void*, void*); typedef void (*vFppip_t)(void*, void*, int32_t, void*); typedef void (*vFpppp_t)(void*, void*, void*, void*); typedef void (*vFXiiL_t)(void*, int32_t, int32_t, uintptr_t); +typedef void (*vFXLpL_t)(void*, uintptr_t, void*, uintptr_t); typedef void (*vFXpip_t)(void*, void*, int32_t, void*); typedef int8_t (*cFpiii_t)(void*, int32_t, int32_t, int32_t); typedef int32_t (*iFEiip_t)(x64emu_t*, int32_t, int32_t, void*); @@ -617,10 +624,12 @@ typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t); typedef void* (*pFEppp_t)(x64emu_t*, void*, void*, void*); typedef void* (*pFiiiu_t)(int32_t, int32_t, int32_t, uint32_t); typedef void* (*pFillu_t)(int32_t, intptr_t, intptr_t, uint32_t); +typedef void* (*pFippu_t)(int32_t, void*, void*, uint32_t); typedef void* (*pFullu_t)(uint32_t, intptr_t, intptr_t, uint32_t); typedef void* (*pFlfff_t)(intptr_t, float, float, float); typedef void* (*pFpiLL_t)(void*, int32_t, uintptr_t, uintptr_t); typedef void* (*pFpuii_t)(void*, uint32_t, int32_t, int32_t); +typedef void* (*pFpLiS_t)(void*, uintptr_t, int32_t, void*); typedef void* (*pFppLL_t)(void*, void*, uintptr_t, uintptr_t); typedef void* (*pFpppp_t)(void*, void*, void*, void*); typedef void* (*pFXiii_t)(void*, int32_t, int32_t, int32_t); @@ -832,6 +841,12 @@ typedef void (*vFdddddd_t)(double, double, double, double, double, double); typedef void (*vFpipipV_t)(void*, int32_t, void*, int32_t, void*, void*); typedef void (*vFpdddii_t)(void*, double, double, double, int32_t, int32_t); typedef void (*vFppupii_t)(void*, void*, uint32_t, void*, int32_t, int32_t); +typedef int32_t (*iFEuppup_t)(x64emu_t*, uint32_t, void*, void*, uint32_t, void*); +typedef int32_t (*iFEuppLp_t)(x64emu_t*, uint32_t, void*, void*, uintptr_t, void*); +typedef int32_t (*iFEpiLpp_t)(x64emu_t*, void*, int32_t, uintptr_t, void*, void*); +typedef int32_t (*iFEpppup_t)(x64emu_t*, void*, void*, void*, uint32_t, void*); +typedef int32_t (*iFEXLilp_t)(x64emu_t*, void*, uintptr_t, int32_t, intptr_t, void*); +typedef int32_t (*iFEXpiup_t)(x64emu_t*, void*, void*, int32_t, uint32_t, void*); typedef int32_t (*iFuiiuup_t)(uint32_t, int32_t, int32_t, uint32_t, uint32_t, void*); typedef int32_t (*iFpiippp_t)(void*, int32_t, int32_t, void*, void*, void*); typedef int32_t (*iFppiiii_t)(void*, void*, int32_t, int32_t, int32_t, int32_t); @@ -842,6 +857,7 @@ typedef intptr_t (*lFipLipu_t)(int32_t, void*, uintptr_t, int32_t, void*, uint32 typedef intptr_t (*lFipLipp_t)(int32_t, void*, uintptr_t, int32_t, void*, void*); typedef void* (*pFEpiiuu_t)(x64emu_t*, void*, int32_t, int32_t, uint32_t, uint32_t); typedef void* (*pFEpLLiN_t)(x64emu_t*, void*, uintptr_t, uintptr_t, int32_t, ...); +typedef void* (*pFEppLLp_t)(x64emu_t*, void*, void*, uintptr_t, uintptr_t, void*); typedef void (*vFiiiiiip_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*); typedef void (*vFiiiiuup_t)(int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, void*); typedef void (*vFiiuilil_t)(int32_t, int32_t, uint32_t, int32_t, intptr_t, int32_t, intptr_t); @@ -1260,6 +1276,7 @@ void iFpbup__32(x64emu_t *emu, uintptr_t fcn) { iFpbup__t fn = (iFpbup__t)fcn; s void iFBLL_p_32(x64emu_t *emu, uintptr_t fcn) { iFBLL_p_t fn = (iFBLL_p_t)fcn; struct_LL_t arg_4={0}; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); } void iFrLL_BLL__32(x64emu_t *emu, uintptr_t fcn) { iFrLL_BLL__t fn = (iFrLL_BLL__t)fcn; struct_LL_t arg_4={0}; from_struct_LL(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_LL_t arg_8={0}; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void pFriiiiiiiiilt_p_32(x64emu_t *emu, uintptr_t fcn) { pFriiiiiiiiilt_p_t fn = (pFriiiiiiiiilt_p_t)fcn; struct_iiiiiiiiilt_t arg_4={0}; from_struct_iiiiiiiiilt(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = to_ptrv(fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8))); } +void iFiBLLLLLLLLLLLLLLLLLL__32(x64emu_t *emu, uintptr_t fcn) { iFiBLLLLLLLLLLLLLLLLLL__t fn = (iFiBLLLLLLLLLLLLLLLLLL__t)fcn; struct_LLLLLLLLLLLLLLLLLL_t arg_8={0}; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_LLLLLLLLLLLLLLLLLL(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void vFEip_32(x64emu_t *emu, uintptr_t fcn) { vFEip_t fn = (vFEip_t)fcn; fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8)); } void vFEpi_32(x64emu_t *emu, uintptr_t fcn) { vFEpi_t fn = (vFEpi_t)fcn; fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); } void vFEpu_32(x64emu_t *emu, uintptr_t fcn) { vFEpu_t fn = (vFEpu_t)fcn; fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); } @@ -1325,6 +1342,7 @@ void vFplp_32(x64emu_t *emu, uintptr_t fcn) { vFplp_t fn = (vFplp_t)fcn; fn(from void vFppi_32(x64emu_t *emu, uintptr_t fcn) { vFppi_t fn = (vFppi_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void vFppu_32(x64emu_t *emu, uintptr_t fcn) { vFppu_t fn = (vFppu_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void vFppp_32(x64emu_t *emu, uintptr_t fcn) { vFppp_t fn = (vFppp_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } +void vFXLp_32(x64emu_t *emu, uintptr_t fcn) { vFXLp_t fn = (vFXLp_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } void vFXpi_32(x64emu_t *emu, uintptr_t fcn) { vFXpi_t fn = (vFXpi_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iFEip_32(x64emu_t *emu, uintptr_t fcn) { iFEip_t fn = (iFEip_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8)); } void iFEpi_32(x64emu_t *emu, uintptr_t fcn) { iFEpi_t fn = (iFEpi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); } @@ -1332,6 +1350,7 @@ void iFEpL_32(x64emu_t *emu, uintptr_t fcn) { iFEpL_t fn = (iFEpL_t)fcn; R_EAX = void iFEpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); } void iFEpV_32(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptrv(R_ESP + 8)); } void iFEhi_32(x64emu_t *emu, uintptr_t fcn) { iFEhi_t fn = (iFEhi_t)fcn; R_EAX = fn(emu, from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptri(int32_t, R_ESP + 8)); } +void iFEhp_32(x64emu_t *emu, uintptr_t fcn) { iFEhp_t fn = (iFEhp_t)fcn; R_EAX = fn(emu, from_hash(from_ptri(ptr_t, R_ESP + 4)), from_ptriv(R_ESP + 8)); } void iFESp_32(x64emu_t *emu, uintptr_t fcn) { iFESp_t fn = (iFESp_t)fcn; R_EAX = fn(emu, io_convert32(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8)); } void iFEXp_32(x64emu_t *emu, uintptr_t fcn) { iFEXp_t fn = (iFEXp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8)); } void iFiii_32(x64emu_t *emu, uintptr_t fcn) { iFiii_t fn = (iFiii_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } @@ -1341,6 +1360,7 @@ void iFiip_32(x64emu_t *emu, uintptr_t fcn) { iFiip_t fn = (iFiip_t)fcn; R_EAX = void iFiiO_32(x64emu_t *emu, uintptr_t fcn) { iFiiO_t fn = (iFiiO_t)fcn; 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))); } void iFiII_32(x64emu_t *emu, uintptr_t fcn) { iFiII_t fn = (iFiII_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int64_t, R_ESP + 16)); } void iFiuu_32(x64emu_t *emu, uintptr_t fcn) { iFiuu_t fn = (iFiuu_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)); } +void iFiup_32(x64emu_t *emu, uintptr_t fcn) { iFiup_t fn = (iFiup_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFiLN_32(x64emu_t *emu, uintptr_t fcn) { iFiLN_t fn = (iFiLN_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } void iFipu_32(x64emu_t *emu, uintptr_t fcn) { iFipu_t fn = (iFipu_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFipL_32(x64emu_t *emu, uintptr_t fcn) { iFipL_t fn = (iFipL_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12))); } @@ -1433,7 +1453,9 @@ void dFpBp_i_32(x64emu_t *emu, uintptr_t fcn) { dFpBp_i_t fn = (dFpBp_i_t)fcn; s void dFpBp_a_32(x64emu_t *emu, uintptr_t fcn) { dFpBp_a_t fn = (dFpBp_a_t)fcn; struct_p_t arg_8={0}; double db = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_locale(from_ptri(ptr_t, R_ESP + 12))); fpu_do_push(emu); ST0val = db; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void lFpBp_i_32(x64emu_t *emu, uintptr_t fcn) { lFpBp_i_t fn = (lFpBp_i_t)fcn; struct_p_t arg_8={0}; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void LFpBp_i_32(x64emu_t *emu, uintptr_t fcn) { LFpBp_i_t fn = (LFpBp_i_t)fcn; struct_p_t arg_8={0}; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } +void pFppbp__32(x64emu_t *emu, uintptr_t fcn) { pFppbp__t fn = (pFppbp__t)fcn; struct_p_t arg_12={0}; from_struct_p(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFXLbLWWWcc__32(x64emu_t *emu, uintptr_t fcn) { iFXLbLWWWcc__t fn = (iFXLbLWWWcc__t)fcn; struct_LWWWcc_t arg_12={0}; from_struct_LWWWcc(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } +void iFirLLLL_BLLLL__32(x64emu_t *emu, uintptr_t fcn) { iFirLLLL_BLLLL__t fn = (iFirLLLL_BLLLL__t)fcn; struct_LLLL_t arg_8={0}; from_struct_LLLL(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_LLLL_t arg_12={0}; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void pFppriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fcn) { pFppriiiiiiiiilt__t fn = (pFppriiiiiiiiilt__t)fcn; struct_iiiiiiiiilt_t arg_12={0}; from_struct_iiiiiiiiilt(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL)); } void vFEipp_32(x64emu_t *emu, uintptr_t fcn) { vFEipp_t fn = (vFEipp_t)fcn; fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void vFEipV_32(x64emu_t *emu, uintptr_t fcn) { vFEipV_t fn = (vFEipV_t)fcn; fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); } @@ -1521,6 +1543,7 @@ void vFplpp_32(x64emu_t *emu, uintptr_t fcn) { vFplpp_t fn = (vFplpp_t)fcn; fn(f void vFppip_32(x64emu_t *emu, uintptr_t fcn) { vFppip_t fn = (vFppip_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); } void vFpppp_32(x64emu_t *emu, uintptr_t fcn) { vFpppp_t fn = (vFpppp_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } void vFXiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXiiL_t fn = (vFXiiL_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16))); } +void vFXLpL_32(x64emu_t *emu, uintptr_t fcn) { vFXLpL_t fn = (vFXLpL_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16))); } void vFXpip_32(x64emu_t *emu, uintptr_t fcn) { vFXpip_t fn = (vFXpip_t)fcn; fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); } void cFpiii_32(x64emu_t *emu, uintptr_t fcn) { cFpiii_t fn = (cFpiii_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(int32_t, R_ESP + 16)); } void iFEiip_32(x64emu_t *emu, uintptr_t fcn) { iFEiip_t fn = (iFEiip_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } @@ -1578,10 +1601,12 @@ void pFEppi_32(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_EA void pFEppp_32(x64emu_t *emu, uintptr_t fcn) { pFEppp_t fn = (pFEppp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); } void pFiiiu_32(x64emu_t *emu, uintptr_t fcn) { pFiiiu_t fn = (pFiiiu_t)fcn; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16))); } void pFillu_32(x64emu_t *emu, uintptr_t fcn) { pFillu_t fn = (pFillu_t)fcn; R_EAX = to_ptrv(fn(from_ptri(int32_t, R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)), to_long(from_ptri(long_t, R_ESP + 12)), from_ptri(uint32_t, R_ESP + 16))); } +void pFippu_32(x64emu_t *emu, uintptr_t fcn) { pFippu_t fn = (pFippu_t)fcn; R_EAX = to_ptrv(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))); } void pFullu_32(x64emu_t *emu, uintptr_t fcn) { pFullu_t fn = (pFullu_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)), to_long(from_ptri(long_t, R_ESP + 12)), from_ptri(uint32_t, R_ESP + 16))); } void pFlfff_32(x64emu_t *emu, uintptr_t fcn) { pFlfff_t fn = (pFlfff_t)fcn; R_EAX = to_ptrv(fn(to_long(from_ptri(long_t, R_ESP + 4)), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12), from_ptri(float, R_ESP + 16))); } void pFpiLL_32(x64emu_t *emu, uintptr_t fcn) { pFpiLL_t fn = (pFpiLL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)))); } void pFpuii_32(x64emu_t *emu, uintptr_t fcn) { pFpuii_t fn = (pFpuii_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); } +void pFpLiS_32(x64emu_t *emu, uintptr_t fcn) { pFpLiS_t fn = (pFpLiS_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), io_convert32(from_ptriv(R_ESP + 16)))); } void pFppLL_32(x64emu_t *emu, uintptr_t fcn) { pFppLL_t fn = (pFppLL_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)))); } void pFpppp_32(x64emu_t *emu, uintptr_t fcn) { pFpppp_t fn = (pFpppp_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); } void pFXiii_32(x64emu_t *emu, uintptr_t fcn) { pFXiii_t fn = (pFXiii_t)fcn; R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); } @@ -1793,6 +1818,12 @@ void vFdddddd_32(x64emu_t *emu, uintptr_t fcn) { vFdddddd_t fn = (vFdddddd_t)fcn void vFpipipV_32(x64emu_t *emu, uintptr_t fcn) { vFpipipV_t fn = (vFpipipV_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptrv(R_ESP + 24)); } void vFpdddii_32(x64emu_t *emu, uintptr_t fcn) { vFpdddii_t fn = (vFpdddii_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptri(double, R_ESP + 8), from_ptri(double, R_ESP + 16), from_ptri(double, R_ESP + 24), from_ptri(int32_t, R_ESP + 32), from_ptri(int32_t, R_ESP + 36)); } void vFppupii_32(x64emu_t *emu, uintptr_t fcn) { vFppupii_t fn = (vFppupii_t)fcn; fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } +void iFEuppup_32(x64emu_t *emu, uintptr_t fcn) { iFEuppup_t fn = (iFEuppup_t)fcn; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } +void iFEuppLp_32(x64emu_t *emu, uintptr_t fcn) { iFEuppLp_t fn = (iFEuppLp_t)fcn; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } +void iFEpiLpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpiLpp_t fn = (iFEpiLpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); } +void iFEpppup_32(x64emu_t *emu, uintptr_t fcn) { iFEpppup_t fn = (iFEpppup_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } +void iFEXLilp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLilp_t fn = (iFEXLilp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), to_long(from_ptri(long_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } +void iFEXpiup_32(x64emu_t *emu, uintptr_t fcn) { iFEXpiup_t fn = (iFEXpiup_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(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)); } void iFuiiuup_32(x64emu_t *emu, uintptr_t fcn) { iFuiiuup_t fn = (iFuiiuup_t)fcn; R_EAX = fn(from_ptri(uint32_t, 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), from_ptriv(R_ESP + 24)); } void iFpiippp_32(x64emu_t *emu, uintptr_t fcn) { iFpiippp_t fn = (iFpiippp_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_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); } void iFppiiii_32(x64emu_t *emu, uintptr_t fcn) { iFppiiii_t fn = (iFppiiii_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); } @@ -1803,6 +1834,7 @@ void lFipLipu_32(x64emu_t *emu, uintptr_t fcn) { lFipLipu_t fn = (lFipLipu_t)fcn void lFipLipp_32(x64emu_t *emu, uintptr_t fcn) { lFipLipp_t fn = (lFipLipp_t)fcn; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24))); } void pFEpiiuu_32(x64emu_t *emu, uintptr_t fcn) { pFEpiiuu_t fn = (pFEpiiuu_t)fcn; R_EAX = to_ptrv(fn(emu, 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 pFEpLLiN_32(x64emu_t *emu, uintptr_t fcn) { pFEpLLiN_t fn = (pFEpLLiN_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20))); } +void pFEppLLp_32(x64emu_t *emu, uintptr_t fcn) { pFEppLLp_t fn = (pFEppLLp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20))); } void vFiiiiiip_32(x64emu_t *emu, uintptr_t fcn) { vFiiiiiip_t fn = (vFiiiiiip_t)fcn; fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptriv(R_ESP + 28)); } void vFiiiiuup_32(x64emu_t *emu, uintptr_t fcn) { vFiiiiuup_t fn = (vFiiiiuup_t)fcn; fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptriv(R_ESP + 28)); } void vFiiuilil_32(x64emu_t *emu, uintptr_t fcn) { vFiiuilil_t fn = (vFiiuilil_t)fcn; fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), to_long(from_ptri(long_t, R_ESP + 20)), from_ptri(int32_t, R_ESP + 24), to_long(from_ptri(long_t, R_ESP + 28))); } @@ -2009,6 +2041,7 @@ void KFKp_32(x64emu_t *emu, uintptr_t fcn) { KFKp_t fn = (KFKp_t)fcn; double db void KFpBp_a_32(x64emu_t *emu, uintptr_t fcn) { KFpBp_a_t fn = (KFpBp_a_t)fcn; struct_p_t arg_8={0}; double db = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_locale(from_ptri(ptr_t, R_ESP + 12))); fpu_do_push(emu); ST0val = db; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } #endif +void iFEvpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEvpV_32(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); } void UFsvvs_32(x64emu_t *emu, uintptr_t fcn) { UFss_t fn = (UFss_t)fcn; ui64_t r; r.u = (uint64_t)fn(from_ptrv(R_ESP + 4), from_ptrv(R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void pFEppv_32(x64emu_t *emu, uintptr_t fcn) { pFEpp_t fn = (pFEpp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8))); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 389e2c6c..279fd693 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -251,6 +251,7 @@ void iFpbup__32(x64emu_t *emu, uintptr_t fnc); void iFBLL_p_32(x64emu_t *emu, uintptr_t fnc); void iFrLL_BLL__32(x64emu_t *emu, uintptr_t fnc); void pFriiiiiiiiilt_p_32(x64emu_t *emu, uintptr_t fnc); +void iFiBLLLLLLLLLLLLLLLLLL__32(x64emu_t *emu, uintptr_t fnc); void vFEip_32(x64emu_t *emu, uintptr_t fnc); void vFEpi_32(x64emu_t *emu, uintptr_t fnc); void vFEpu_32(x64emu_t *emu, uintptr_t fnc); @@ -316,6 +317,7 @@ void vFplp_32(x64emu_t *emu, uintptr_t fnc); void vFppi_32(x64emu_t *emu, uintptr_t fnc); void vFppu_32(x64emu_t *emu, uintptr_t fnc); void vFppp_32(x64emu_t *emu, uintptr_t fnc); +void vFXLp_32(x64emu_t *emu, uintptr_t fnc); void vFXpi_32(x64emu_t *emu, uintptr_t fnc); void iFEip_32(x64emu_t *emu, uintptr_t fnc); void iFEpi_32(x64emu_t *emu, uintptr_t fnc); @@ -323,6 +325,7 @@ void iFEpL_32(x64emu_t *emu, uintptr_t fnc); void iFEpp_32(x64emu_t *emu, uintptr_t fnc); void iFEpV_32(x64emu_t *emu, uintptr_t fnc); void iFEhi_32(x64emu_t *emu, uintptr_t fnc); +void iFEhp_32(x64emu_t *emu, uintptr_t fnc); void iFESp_32(x64emu_t *emu, uintptr_t fnc); void iFEXp_32(x64emu_t *emu, uintptr_t fnc); void iFiii_32(x64emu_t *emu, uintptr_t fnc); @@ -332,6 +335,7 @@ void iFiip_32(x64emu_t *emu, uintptr_t fnc); void iFiiO_32(x64emu_t *emu, uintptr_t fnc); void iFiII_32(x64emu_t *emu, uintptr_t fnc); void iFiuu_32(x64emu_t *emu, uintptr_t fnc); +void iFiup_32(x64emu_t *emu, uintptr_t fnc); void iFiLN_32(x64emu_t *emu, uintptr_t fnc); void iFipu_32(x64emu_t *emu, uintptr_t fnc); void iFipL_32(x64emu_t *emu, uintptr_t fnc); @@ -424,7 +428,9 @@ void dFpBp_i_32(x64emu_t *emu, uintptr_t fnc); void dFpBp_a_32(x64emu_t *emu, uintptr_t fnc); void lFpBp_i_32(x64emu_t *emu, uintptr_t fnc); void LFpBp_i_32(x64emu_t *emu, uintptr_t fnc); +void pFppbp__32(x64emu_t *emu, uintptr_t fnc); void iFXLbLWWWcc__32(x64emu_t *emu, uintptr_t fnc); +void iFirLLLL_BLLLL__32(x64emu_t *emu, uintptr_t fnc); void pFppriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc); void vFEipp_32(x64emu_t *emu, uintptr_t fnc); void vFEipV_32(x64emu_t *emu, uintptr_t fnc); @@ -512,6 +518,7 @@ void vFplpp_32(x64emu_t *emu, uintptr_t fnc); void vFppip_32(x64emu_t *emu, uintptr_t fnc); void vFpppp_32(x64emu_t *emu, uintptr_t fnc); void vFXiiL_32(x64emu_t *emu, uintptr_t fnc); +void vFXLpL_32(x64emu_t *emu, uintptr_t fnc); void vFXpip_32(x64emu_t *emu, uintptr_t fnc); void cFpiii_32(x64emu_t *emu, uintptr_t fnc); void iFEiip_32(x64emu_t *emu, uintptr_t fnc); @@ -569,10 +576,12 @@ void pFEppi_32(x64emu_t *emu, uintptr_t fnc); void pFEppp_32(x64emu_t *emu, uintptr_t fnc); void pFiiiu_32(x64emu_t *emu, uintptr_t fnc); void pFillu_32(x64emu_t *emu, uintptr_t fnc); +void pFippu_32(x64emu_t *emu, uintptr_t fnc); void pFullu_32(x64emu_t *emu, uintptr_t fnc); void pFlfff_32(x64emu_t *emu, uintptr_t fnc); void pFpiLL_32(x64emu_t *emu, uintptr_t fnc); void pFpuii_32(x64emu_t *emu, uintptr_t fnc); +void pFpLiS_32(x64emu_t *emu, uintptr_t fnc); void pFppLL_32(x64emu_t *emu, uintptr_t fnc); void pFpppp_32(x64emu_t *emu, uintptr_t fnc); void pFXiii_32(x64emu_t *emu, uintptr_t fnc); @@ -784,6 +793,12 @@ void vFdddddd_32(x64emu_t *emu, uintptr_t fnc); void vFpipipV_32(x64emu_t *emu, uintptr_t fnc); void vFpdddii_32(x64emu_t *emu, uintptr_t fnc); void vFppupii_32(x64emu_t *emu, uintptr_t fnc); +void iFEuppup_32(x64emu_t *emu, uintptr_t fnc); +void iFEuppLp_32(x64emu_t *emu, uintptr_t fnc); +void iFEpiLpp_32(x64emu_t *emu, uintptr_t fnc); +void iFEpppup_32(x64emu_t *emu, uintptr_t fnc); +void iFEXLilp_32(x64emu_t *emu, uintptr_t fnc); +void iFEXpiup_32(x64emu_t *emu, uintptr_t fnc); void iFuiiuup_32(x64emu_t *emu, uintptr_t fnc); void iFpiippp_32(x64emu_t *emu, uintptr_t fnc); void iFppiiii_32(x64emu_t *emu, uintptr_t fnc); @@ -794,6 +809,7 @@ void lFipLipu_32(x64emu_t *emu, uintptr_t fnc); void lFipLipp_32(x64emu_t *emu, uintptr_t fnc); void pFEpiiuu_32(x64emu_t *emu, uintptr_t fnc); void pFEpLLiN_32(x64emu_t *emu, uintptr_t fnc); +void pFEppLLp_32(x64emu_t *emu, uintptr_t fnc); void vFiiiiiip_32(x64emu_t *emu, uintptr_t fnc); void vFiiiiuup_32(x64emu_t *emu, uintptr_t fnc); void vFiiuilil_32(x64emu_t *emu, uintptr_t fnc); @@ -1000,6 +1016,7 @@ void KFKp_32(x64emu_t *emu, uintptr_t fnc); void KFpBp_a_32(x64emu_t *emu, uintptr_t fnc); #endif +void iFEvpp_32(x64emu_t *emu, uintptr_t fnc); void iFEvpV_32(x64emu_t *emu, uintptr_t fnc); void UFsvvs_32(x64emu_t *emu, uintptr_t fnc); void pFEppv_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index babe5a85..e19ff09e 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -36,6 +36,7 @@ #include <sys/statvfs.h> #include <mntent.h> #include <sys/uio.h> +#include <grp.h> #include "wrappedlibs.h" @@ -471,10 +472,12 @@ uint32_t my32_syscall(x64emu_t *emu); // implemented in x64syscall.c void EXPORT my32___stack_chk_fail(x64emu_t* emu) { char buff[200]; + void* addr = from_ptrv(*(ptr_t*)from_ptrv(R_ESP)); + const char* name = getAddrFunctionName((uintptr_t)addr); #ifdef HAVE_TRACE - sprintf(buff, "%p: Stack is corrupted, aborting (prev IP=%p)\n", (void*)emu->old_ip, (void*)emu->prev2_ip); + sprintf(buff, "%p: Stack is corrupted, aborting (prev IP=%p) ESP=0x%x %s\n", addr, (void*)emu->prev2_ip, R_ESP, name); #else - sprintf(buff, "%p: Stack is corrupted, aborting\n", (void*)emu->old_ip); + sprintf(buff, "%p: Stack is corrupted, aborting ESP=0x%x %s\n", addr, R_ESP, name); #endif StopEmu(emu, buff, 1); } @@ -2106,6 +2109,64 @@ EXPORT void* my32_getpwuid(x64emu_t* emu, uint32_t uid) } return NULL; } + +EXPORT int my32_getpwuid_r(x64emu_t* emu, uint32_t uid, struct i386_passwd* pwd, char *buf, size_t buflen, ptr_t* result) +{ + struct passwd _result = {0}; + struct passwd *r = NULL; + int ret = getpwuid_r(uid, &_result, buf, buflen, &r); + if(!r) { + *result = 0; + return ret; + } + *result = to_ptrv(pwd); + struct i386_passwd *res = pwd; + res->pw_name = to_ptrv(r->pw_name); + res->pw_passwd = to_ptrv(r->pw_passwd); + res->pw_uid = r->pw_uid; + res->pw_gid = r->pw_gid; + res->pw_gecos = to_ptrv(r->pw_gecos); + res->pw_dir = to_ptrv(r->pw_dir); + res->pw_shell = to_ptrv(r->pw_shell); + return ret; +} + +EXPORT int my32_getgrnam_r(x64emu_t* emu, const char* name, struct i386_group *grp, char *buf, size_t buflen, ptr_t* result) +{ + struct group _result = {0}; + struct group *r = NULL; + int ret = getgrnam_r(name, &_result, buf, buflen, &r); + if(!r) { + *result = 0; + return ret; + } + *result = to_ptrv(grp); + struct i386_group *res = grp; + res->gr_name = to_ptrv(r->gr_name); + res->gr_passwd = to_ptrv(r->gr_passwd); + res->gr_gid = r->gr_gid; + res->gr_mem = to_ptrv(r->gr_mem); + return ret; +} + +EXPORT int my32_getgrgid_r(x64emu_t* emu, gid_t gid, struct i386_group *grp, char *buf, size_t buflen, ptr_t* result) +{ + struct group _result = {0}; + struct group *r = NULL; + int ret = getgrgid_r(gid, &_result, buf, buflen, &r); + if(!r) { + *result = 0; + return ret; + } + *result = to_ptrv(grp); + struct i386_group *res = grp; + res->gr_name = to_ptrv(r->gr_name); + res->gr_passwd = to_ptrv(r->gr_passwd); + res->gr_gid = r->gr_gid; + res->gr_mem = to_ptrv(r->gr_mem); + return ret; +} + #if 0 EXPORT int32_t my32_recvmmsg(x64emu_t* emu, int32_t fd, void* msgvec, uint32_t vlen, uint32_t flags, void* timeout) { @@ -2288,11 +2349,9 @@ EXPORT int my32_alphasort64(x64emu_t* emu, ptr_t* d1_, ptr_t* d2_) EXPORT void* my32___ctype_b_loc(x64emu_t* emu) { const unsigned short** src =__ctype_b_loc(); - if((uintptr_t)src<0x100000000LL) - return src; - if(src != emu->ref_ctype) { + if(*src != emu->ref_ctype) { memcpy(emu->libctype, &((*src)[-128]), 384*sizeof(short)); - emu->ref_ctype = src; + emu->ref_ctype = *src; emu->ctype = emu->libctype+128; } return &emu->ctype; @@ -2300,11 +2359,9 @@ EXPORT void* my32___ctype_b_loc(x64emu_t* emu) EXPORT void* my32___ctype_tolower_loc(x64emu_t* emu) { const int** src =__ctype_tolower_loc(); - if((uintptr_t)src<0x100000000LL) - return src; - if(src != emu->ref_tolower) { + if(*src != emu->ref_tolower) { memcpy(emu->libctolower, &((*src)[-128]), 384*sizeof(int)); - emu->ref_tolower = src; + emu->ref_tolower = *src; emu->tolower = emu->libctolower+128; } return &emu->tolower; @@ -2312,11 +2369,9 @@ EXPORT void* my32___ctype_tolower_loc(x64emu_t* emu) EXPORT void* my32___ctype_toupper_loc(x64emu_t* emu) { const int** src =__ctype_toupper_loc(); - if((uintptr_t)src<0x100000000LL) - return src; - if(src != emu->ref_toupper) { + if(*src != emu->ref_toupper) { memcpy(emu->libctoupper, &((*src)[-128]), 384*sizeof(int)); - emu->ref_toupper = src; + emu->ref_toupper = *src; emu->toupper = emu->libctoupper+128; } return &emu->toupper; @@ -2575,6 +2630,27 @@ EXPORT void* my32_getpwnam(x64emu_t* emu, const char* name) return &ret; } +EXPORT int my32_getpwnam_r(x64emu_t* emu, const char *name, struct i386_passwd *pwd, char *buf, size_t buflen, ptr_t *result) +{ + struct passwd _result = {0}; + struct passwd *r = NULL; + int ret = getpwnam_r(name, &_result, buf, buflen, &r); + if(!r) { + *result = 0; + return ret; + } + *result = to_ptrv(pwd); + struct i386_passwd *res = pwd; + res->pw_name = to_ptrv(r->pw_name); + res->pw_passwd = to_ptrv(r->pw_passwd); + res->pw_uid = r->pw_uid; + res->pw_gid = r->pw_gid; + res->pw_gecos = to_ptrv(r->pw_gecos); + res->pw_dir = to_ptrv(r->pw_dir); + res->pw_shell = to_ptrv(r->pw_shell); + return ret; +} + EXPORT void* my32_realpath(x64emu_t* emu, void* path, void* resolved_path) { diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 7de0ec08..3f86affd 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -7,7 +7,9 @@ // struct utimbuf is: LL // struct timespec is: LL // struct timeval is: LL +// struct itimerval is LLLL // struct tm is: iiiiiiiiilt +// struct rusage is LLLLLLLLLLLLLLLLLL (2 timeval + 14 longs) // time_t is: L // socklen_t is u // struct sockaddr is fine, no wrap needed @@ -82,7 +84,7 @@ GO(__assert_fail, vFppip) //GO(__assert_perror_fail, vFipup) GO(atof, dFp) GO(atoi, iFp) -//GO(atol, lFp) +GO2(atol, lFp, atoi) GO(atoll, IFp) // authdes_create // authdes_getucred @@ -108,7 +110,7 @@ GOW(bind_textdomain_codeset, pFpp) //GOW(brk, iFp) // __bsd_getpgrp // bsd_signal // Weak -//GOM(bsearch, pFEppLLp) //%% +GOM(bsearch, pFEppLLp) //%% GOW(btowc, iFi) GOW(bzero, vFpL) GO(__bzero, vFpL) @@ -334,7 +336,7 @@ GOW(fgetc_unlocked, iFS) // fgetpwent // fgetpwent_r // Weak GOW(fgets, pFpiS) -//GO(__fgets_chk, pFpuip) +GO(__fgets_chk, pFpLiS) // fgetspent // fgetspent_r // Weak //GO(fgets_unlocked, pFpip) @@ -417,7 +419,7 @@ GOWM(ftell, lFES) GO(ftello, lFS) GO(ftello64, IFS) //GO(ftime, iFp) -//GO(ftok, iFpi) +GO(ftok, iFpi) GOW(ftruncate, iFiu) GOW(ftruncate64, iFiI) //GOW(ftrylockfile, iFp) @@ -484,9 +486,9 @@ GOW(getgid, iFv) //GO(getgrent, pFv) // getgrent_r //GO(getgrgid, pFu) -//GO(getgrgid_r, iFuppup) +GOM(getgrgid_r, iFEuppup) //GO(getgrnam, pFp) -//GO(getgrnam_r, iFpppup) +GOM(getgrnam_r, iFEpppup) //GO(getgrouplist, iFpipp) GOW(getgroups, iFiu) // __getgroups_chk @@ -544,7 +546,7 @@ GO(__getpid, uFv) GOW(getppid, uFv) GO(getpriority, iFii) //GOM(getrandom, iFEpuu) //%% -//GO(getprotobyname, pFp) +GOM(getprotobyname, pFEp) //GO(getprotobyname_r, iFpppup) //GO(getprotobynumber, pFi) //GO(getprotobynumber_r, iFippup) @@ -556,11 +558,11 @@ GOW(getpt, iFv) //GO(getpwent, pFv) // getpwent_r GOM(getpwnam, pFEp) -//GO(getpwnam_r, iFpppup) +GOM(getpwnam_r, iFEpppup) GOM(getpwuid, pFEu) -//GO(getpwuid_r, iFuppup) +GOM(getpwuid_r, iFEuppLp) //GOW(getresgid, iFppp) -//GOW(getresuid, iFppp) +GOW(getresuid, iFppp) GOM(getrlimit, iFEip) GO(getrlimit64, iFip) // getrpcbyname @@ -570,7 +572,7 @@ GO(getrlimit64, iFip) // getrpcent // getrpcent_r // getrpcport -//GOW(getrusage, iFip) +GOW(getrusage, iFiBLLLLLLLLLLLLLLLLLL_) //GOW(gets, pFp) // __gets_chk // getsecretkey @@ -692,8 +694,8 @@ GOW(inet_aton, iFpp) // inet_nsap_addr //GO(inet_nsap_ntoa, pFipp) GO(inet_ntoa, tFu) -//GO(inet_ntop, pFippu) -//GO(inet_pton, iFipp) +GO(inet_ntop, pFippu) +GO(inet_pton, iFipp) //GO(initgroups, iFpi) // init_module // initstate // Weak @@ -1050,7 +1052,7 @@ GOW(lseek64, IFiIi) //GO(lutimes, iFpp) GOM(__lxstat, iFEipp) //%% GOM(__lxstat64, iFEipp) //%% -//GO(madvise, iFpLi) +GO(madvise, iFpLi) GOM(makecontext, iFEppiV) //%% //GOW(mallinfo, pFv) GOM(malloc, pFL) //%%,noE @@ -1152,7 +1154,7 @@ GO(__newlocale, aFipa) GO(nice, iFi) // _nl_default_dirname // type R // _nl_domain_bindings // type B -//GO(nl_langinfo, pFu) +GO(nl_langinfo, pFi) GO(__nl_langinfo_l, pFia) //GOW(nl_langinfo_l, pFup) //DATAB(_nl_msg_cat_cntr, 4) // type B @@ -1443,7 +1445,7 @@ GOW(sched_get_priority_min, iFi) GO(__sched_getscheduler, iFi) GOW(sched_getscheduler, iFi) //GOW(sched_rr_get_interval, iFip) -//GO(sched_setaffinity, iFiup) +GO(sched_setaffinity, iFiup) //GOW(sched_setparam, iFip) GO(__sched_setscheduler, iFiip) GOW(sched_setscheduler, iFiip) @@ -1486,7 +1488,7 @@ GO(sethostent, vFi) // sethostid //GO(sethostname, iFpu) // setipv4sourcefilter -//GOW(setitimer, iFipp) +GOW(setitimer, iFirLLLL_BLLLL_) GOM(setjmp, iFEp) //%% GOM(_setjmp, iFEp) //%% //GO(setlinebuf, vFp) @@ -1539,7 +1541,7 @@ GO(sigaddset, iFpi) GOWM(sigaltstack, iFEpp) //%% // sigandset GOW(sigblock, iFi) -//GO(sigdelset, iFpi) +GO(sigdelset, iFpi) // __sigdelset GO(sigemptyset, iFp) GO(sigfillset, iFp) @@ -1567,7 +1569,7 @@ GOM(sigset, pFEip) //%% GOM(__sigsetjmp, iFEp) //%% GOW(sigsetmask, iFi) // sigstack -//GOW(sigsuspend, iFp) +GOW(sigsuspend, iFp) // __sigsuspend //GOW(sigtimedwait, iFppp) //GOW(sigvec, iFipp) @@ -1685,8 +1687,8 @@ GO(__strtof_l, fFppa) //GOW(strtof_l, fFppu) //GO(strtoimax, IFppi) GO(strtok, pFpp) -//GO(__strtok_r, pFppp) -//GOW(strtok_r, pFppp) +GO(__strtok_r, pFppbp_) +GOW(strtok_r, pFppbp_) // __strtok_r_1c GOM(strtol, lFpBp_i) //%%,noE #ifdef HAVE_LD80BITS @@ -1894,13 +1896,13 @@ GOM(__vfprintf_chk, iFESvpp) //%% // vlimit // vmsplice GOM(vprintf, iFEpp) //%% -//GOM(__vprintf_chk, iFEvpp) //%% +GOM(__vprintf_chk, iFEvpp) //%% // vscanf // Weak GOWM(vsnprintf, iFEpLpp) //%% GOWM(__vsnprintf, iFEpLpp) //%% GOM(__vsnprintf_chk, iFEpLvvpp) //%% GOWM(vsprintf, iFEppp) //%% -//GOM(__vsprintf_chk, iFEpiLpp) //%% +GOM(__vsprintf_chk, iFEpiLpp) //%% //GOM(vsscanf, iFEppp) //%% // __vsscanf // Weak GOWM(vswprintf, iFEpLpp) //%% diff --git a/src/wrapped32/wrappedlibpthread.c b/src/wrapped32/wrappedlibpthread.c index 72a3f5c4..dbeee699 100755 --- a/src/wrapped32/wrappedlibpthread.c +++ b/src/wrapped32/wrappedlibpthread.c @@ -62,6 +62,7 @@ typedef struct my_sem_32_s { sem_t *sem; } my_sem_32_t; +#define GET_SEM(sem) sem_t* _sem = (sem->sign != SEM_SIGN)?((sem_t*)sem):(sem->sem) EXPORT int my32_sem_close(sem_t* sem) { return sem_close(sem); @@ -78,11 +79,8 @@ EXPORT int my32_sem_destroy(my_sem_32_t* sem) } EXPORT int my32_sem_getvalue(my_sem_32_t* sem, int* val) { - if(sem->sign != SEM_SIGN) - return sem_getvalue((sem_t*)sem, val); - int ret = 0; - ret = sem_getvalue(sem->sem, val); - return ret; + GET_SEM(sem); + return sem_getvalue(_sem, val); } EXPORT int my32_sem_init(my_sem_32_t* sem, int pshared, uint32_t val) { @@ -98,32 +96,31 @@ EXPORT void* my32_sem_open(const char* name, int flags) } EXPORT int my32_sem_post(my_sem_32_t* sem) { - if(sem->sign != SEM_SIGN) - return sem_post((sem_t*)sem); - return sem_post(sem->sem); + GET_SEM(sem); + return sem_post(_sem); } EXPORT int my32_sem_timedwait(my_sem_32_t* sem, struct timespec * t) { + GET_SEM(sem); + // Not sure it's usefull + //if(!sem_trywait(_sem))) + // return 0; // some x86 game are not computing timeout correctly (ex: Anomaly Warzone Earth linux version) while(t->tv_nsec>=1000000000) { t->tv_nsec-=1000000000; t->tv_sec+=1; } - if(sem->sign != SEM_SIGN) - return sem_timedwait((sem_t*)sem, t); - return sem_timedwait(sem->sem, t); + return sem_timedwait(_sem, t); } EXPORT int my32_sem_trywait(my_sem_32_t* sem) { - if(sem->sign != SEM_SIGN) - return sem_trywait((sem_t*)sem); - return sem_trywait(sem->sem); + GET_SEM(sem); + return sem_trywait(_sem); } EXPORT int my32_sem_wait(my_sem_32_t* sem) { - if(sem->sign != SEM_SIGN) - return sem_wait((sem_t*)sem); - return sem_wait(sem->sem); + GET_SEM(sem); + return sem_wait(_sem); } diff --git a/src/wrapped32/wrappedlibpthread_private.h b/src/wrapped32/wrappedlibpthread_private.h index 83ba3bd0..6eccde86 100755 --- a/src/wrapped32/wrappedlibpthread_private.h +++ b/src/wrapped32/wrappedlibpthread_private.h @@ -75,7 +75,7 @@ GOM(pthread_detach, iFEh) GO(pthread_equal, iFhh) GO(pthread_exit, vFp) GOM(pthread_getaffinity_np, iFEhup) -GO(pthread_getattr_np, iFhp) +GOM(pthread_getattr_np, iFEhp) GO(pthread_getconcurrency, iFv) GO(pthread_getcpuclockid, iFhp) GO(pthread_getschedparam, iFhpp) diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c index eeb8e0fd..d493f502 100644 --- a/src/wrapped32/wrappedlibx11.c +++ b/src/wrapped32/wrappedlibx11.c @@ -1539,15 +1539,17 @@ my_XDisplay_32_t my32_Displays_32[N_DISPLAY] = {0}; void* getDisplay(void* d) { + if(!d) return d; for(int i=0; i<N_DISPLAY; ++i) if(&my32_Displays_32[i]==d) return my32_Displays_64[i]; - printf_log(LOG_INFO, "BOX32: Warning, 32bits Display not found"); + printf_log(LOG_INFO, "BOX32: Warning, 32bits Display %p not found\n", d); return d; } void* FindDisplay(void* d) { + if(!d) return d; for(int i=0; i<N_DISPLAY; ++i) if(my32_Displays_64[i]==d) return &my32_Displays_32[i]; @@ -1922,6 +1924,216 @@ void convertXEvent(my_XEvent_32_t* dst, my_XEvent_t* src) printf_log(LOG_INFO, "Warning, unsupported 32bits XEvent type=%d\n", src->type); } } +void unconvertXEvent(my_XEvent_t* dst, my_XEvent_32_t* src) +{ + // convert the XAnyEvent first, as it's a common set + dst->type = src->type; + dst->xany.display = getDisplay(from_ptrv(src->xany.display)); + dst->xany.window = from_ulong(src->xany.window); + dst->xany.send_event = src->xany.serial; + dst->xany.serial = from_ulong(src->xany.serial); + switch(src->type) { + case XEVT_KeyPress: + case XEVT_KeyRelease: + dst->xkey.root = from_ulong(src->xkey.root); + dst->xkey.subwindow = from_ulong(src->xkey.subwindow); + dst->xkey.time = from_ulong(src->xkey.time); + dst->xkey.x = src->xkey.x; + dst->xkey.y = src->xkey.y; + dst->xkey.x_root = src->xkey.x_root; + dst->xkey.y_root = src->xkey.y_root; + dst->xkey.state = src->xkey.state; + dst->xkey.keycode = src->xkey.keycode; + dst->xkey.same_screen = src->xkey.same_screen; + break; + case XEVT_ButtonPress: + case XEVT_ButtonRelease: + dst->xbutton.root = from_ulong(src->xbutton.root); + dst->xbutton.subwindow = from_ulong(src->xbutton.subwindow); + dst->xbutton.time = from_ulong(src->xbutton.time); + dst->xbutton.x = src->xbutton.x; + dst->xbutton.y = src->xbutton.y; + dst->xbutton.x_root = src->xbutton.x_root; + dst->xbutton.y_root = src->xbutton.y_root; + dst->xbutton.state = src->xbutton.state; + dst->xbutton.button = src->xbutton.button; + dst->xbutton.same_screen = src->xbutton.same_screen; + break; + case XEVT_MotionNotify: + dst->xmotion.root = from_ulong(src->xmotion.root); + dst->xmotion.subwindow = from_ulong(src->xmotion.subwindow); + dst->xmotion.time = from_ulong(src->xmotion.time); + dst->xmotion.x = src->xmotion.x; + dst->xmotion.y = src->xmotion.y; + dst->xmotion.x_root = src->xmotion.x_root; + dst->xmotion.y_root = src->xmotion.y_root; + dst->xmotion.state = src->xmotion.state; + dst->xmotion.is_hint = src->xmotion.is_hint; + dst->xmotion.same_screen = src->xmotion.same_screen; + break; + case XEVT_EnterNotify: + case XEVT_LeaveNotify: + dst->xcrossing.root = from_ulong(src->xcrossing.root); + dst->xcrossing.subwindow = from_ulong(src->xcrossing.subwindow); + dst->xcrossing.time = from_ulong(src->xcrossing.time); + dst->xcrossing.x = src->xcrossing.x; + dst->xcrossing.y = src->xcrossing.y; + dst->xcrossing.x_root = src->xcrossing.x_root; + dst->xcrossing.y_root = src->xcrossing.y_root; + dst->xcrossing.mode = src->xcrossing.mode; + dst->xcrossing.detail = src->xcrossing.detail; + dst->xcrossing.same_screen = src->xcrossing.same_screen; + dst->xcrossing.focus = src->xcrossing.focus; + dst->xcrossing.state = src->xcrossing.state; + break; + case XEVT_FocusIn: + case XEVT_FocusOut: + dst->xfocus.mode = src->xfocus.mode; + dst->xfocus.detail = src->xfocus.detail; + break; + case XEVT_KeymapNotify: + memcpy(dst->xkeymap.key_vector, src->xkeymap.key_vector, 32); + break; + case XEVT_Expose: + dst->xexpose.x = src->xexpose.x; + dst->xexpose.y = src->xexpose.y; + dst->xexpose.width = src->xexpose.width; + dst->xexpose.height = src->xexpose.height; + dst->xexpose.count = src->xexpose.count; + break; + case XEVT_GraphicsExpose: + dst->xgraphicsexpose.x = src->xgraphicsexpose.x; + dst->xgraphicsexpose.y = src->xgraphicsexpose.y; + dst->xgraphicsexpose.width = src->xgraphicsexpose.width; + dst->xgraphicsexpose.height = src->xgraphicsexpose.height; + dst->xgraphicsexpose.count = src->xgraphicsexpose.count; + dst->xgraphicsexpose.major_code = src->xgraphicsexpose.major_code; + dst->xgraphicsexpose.minor_code = src->xgraphicsexpose.minor_code; + break; + case XEVT_NoExpose: + dst->xnoexpose.major_code = src->xnoexpose.major_code; + dst->xnoexpose.minor_code = src->xnoexpose.minor_code; + break; + case XEVT_VisibilityNotify: + dst->xvisibility.state = src->xvisibility.state; + break; + case XEVT_CreateNotify: + dst->xcreatewindow.window = from_ulong(src->xcreatewindow.window); + dst->xcreatewindow.x = src->xcreatewindow.x; + dst->xcreatewindow.y = src->xcreatewindow.y; + dst->xcreatewindow.width = src->xcreatewindow.width; + dst->xcreatewindow.height = src->xcreatewindow.height; + dst->xcreatewindow.border_width = src->xcreatewindow.border_width; + dst->xcreatewindow.override_redirect = src->xcreatewindow.override_redirect; + break; + case XEVT_DestroyNotify: + dst->xdestroywindow.window = from_ulong(src->xdestroywindow.window); + break; + case XEVT_UnmapNotify: + dst->xunmap.window = from_ulong(src->xunmap.window); + dst->xunmap.from_configure = src->xunmap.from_configure; + break; + case XEVT_MapNotify: + dst->xmap.window = from_ulong(src->xmap.window); + dst->xmap.override_redirect = src->xmap.override_redirect; + break; + case XEVT_MapRequest: + dst->xmaprequest.window = from_ulong(src->xmaprequest.window); + break; + case XEVT_ReparentNotify: + dst->xreparent.window = from_ulong(src->xreparent.window); + dst->xreparent.parent = from_ulong(src->xreparent.parent); + dst->xreparent.x = src->xreparent.x; + dst->xreparent.y = src->xreparent.y; + dst->xreparent.override_redirect = src->xreparent.override_redirect; + break; + case XEVT_ConfigureNotify: + dst->xconfigure.window = from_ulong(src->xconfigure.window); + dst->xconfigure.x = src->xconfigure.x; + dst->xconfigure.y = src->xconfigure.y; + dst->xconfigure.width = src->xconfigure.width; + dst->xconfigure.height = src->xconfigure.height; + dst->xconfigure.border_width = src->xconfigure.border_width; + dst->xconfigure.above = from_ulong(src->xconfigure.above); + dst->xconfigure.override_redirect = src->xconfigure.override_redirect; + break; + case XEVT_ConfigureRequest: + dst->xconfigurerequest.window = from_ulong(src->xconfigurerequest.window); + dst->xconfigurerequest.x = src->xconfigurerequest.x; + dst->xconfigurerequest.y = src->xconfigurerequest.y; + dst->xconfigurerequest.width = src->xconfigurerequest.width; + dst->xconfigurerequest.height = src->xconfigurerequest.height; + dst->xconfigurerequest.border_width = src->xconfigurerequest.border_width; + dst->xconfigurerequest.above = from_ulong(src->xconfigurerequest.above); + dst->xconfigurerequest.detail = src->xconfigurerequest.detail; + dst->xconfigurerequest.value_mask = from_ulong(src->xconfigurerequest.value_mask); + break; + case XEVT_GravityNotify: + dst->xgravity.window = from_ulong(src->xgravity.window); + dst->xgravity.x = src->xgravity.x; + dst->xgravity.y = src->xgravity.y; + break; + case XEVT_ResizeRequest: + dst->xresizerequest.width = src->xresizerequest.width; + dst->xresizerequest.height = src->xresizerequest.height; + break; + case XEVT_CirculateNotify: + dst->xcirculate.window = from_ulong(src->xcirculate.window); + dst->xcirculate.place = src->xcirculate.place; + break; + case XEVT_CirculateRequest: + dst->xcirculaterequest.window = from_ulong(src->xcirculaterequest.window); + dst->xcirculaterequest.place = src->xcirculaterequest.place; + break; + case XEVT_PropertyNotify: + dst->xproperty.atom = from_ulong(src->xproperty.atom); + dst->xproperty.time = from_ulong(src->xproperty.time); + dst->xproperty.state = src->xproperty.state; + break; + case XEVT_SelectionClear: + dst->xselectionclear.selection = from_ulong(src->xselectionclear.selection); + dst->xselectionclear.time = from_ulong(src->xselectionclear.time); + break; + case XEVT_SelectionRequest: + dst->xselectionrequest.requestor = from_ulong(src->xselectionrequest.requestor); + dst->xselectionrequest.selection = from_ulong(src->xselectionrequest.selection); + dst->xselectionrequest.target = from_ulong(src->xselectionrequest.target); + dst->xselectionrequest.property = from_ulong(src->xselectionrequest.property); + dst->xselectionrequest.time = from_ulong(src->xselectionrequest.time); + break; + case XEVT_SelectionNotify: + dst->xselection.selection = from_ulong(src->xselection.selection); + dst->xselection.target = from_ulong(src->xselection.target); + dst->xselection.property = from_ulong(src->xselection.property); + dst->xselection.time = from_ulong(src->xselection.time); + break; + case XEVT_ColormapNotify: + dst->xcolormap.colormap = from_ulong(src->xcolormap.colormap); + dst->xcolormap.c_new = src->xcolormap.c_new; + dst->xcolormap.state = src->xcolormap.state; + break; + case XEVT_ClientMessage: + dst->xclient.message_type = from_ulong(src->xclient.message_type); + dst->xclient.format = src->xclient.format; + if(src->xclient.format==32) + for(int i=0; i<5; ++i) dst->xclient.data.l[i] = from_ulong(src->xclient.data.l[i]); + else + memcpy(dst->xclient.data.b, src->xclient.data.b, 20); + break; + case XEVT_MappingNotify: + dst->xmapping.request = src->xmapping.request; + dst->xmapping.first_keycode = src->xmapping.first_keycode; + dst->xmapping.count = src->xmapping.count; + break; + case XEVT_GenericEvent: + dst->xgeneric.extension = src->xgeneric.extension; + dst->xgeneric.evtype = src->xgeneric.evtype; + break; + + default: + printf_log(LOG_INFO, "Warning, unsupported 32bits (un)XEvent type=%d\n", src->type); + } +} EXPORT int my32_XNextEvent(x64emu_t* emu, void* dpy, my_XEvent_32_t* evt) { @@ -1939,6 +2151,13 @@ EXPORT int my32_XCheckTypedEvent(x64emu_t* emu, void* dpy, int type, my_XEvent_3 return ret; } +EXPORT int my32_XSendEvent(x64emu_t* emu, void* dpy, XID window, int propagate, long mask, my_XEvent_32_t* evt) +{ + my_XEvent_t event = {0}; + if(evt) unconvertXEvent(&event, evt); + return my->XSendEvent(dpy, window, propagate, mask, evt?(&event):NULL); +} + EXPORT int my32_XSetWMProtocols(x64emu_t* emu, void* dpy, XID window, XID_32* protocol, int count) { XID list[count]; @@ -2030,6 +2249,27 @@ EXPORT void* my32__XGetRequest(x64emu_t* emu, my_XDisplay_t* dpy, uint8_t type, return my->_XGetRequest(dpy, type, len); } #endif + +EXPORT int my32_XStringListToTextProperty(x64emu_t* emu, ptr_t* list, int count, void* text) +{ + char* l_list[count]; + if(list) + for(int i=0; i<count; ++i) + l_list[i] = from_ptrv(list[i]); + //TODO: Need to wrap the XTextProperty produced? + return my->XStringListToTextProperty(list?(&l_list):NULL, count, text); +} + +EXPORT int my32_Xutf8TextListToTextProperty(x64emu_t* emu, void* dpy, ptr_t* list, int count, uint32_t style, void* text) +{ + char* l_list[count]; + if(list) + for(int i=0; i<count; ++i) + l_list[i] = from_ptrv(list[i]); + //TODO: Need to wrap the XTextProperty produced? + return my->Xutf8TextListToTextProperty(dpy, list?(&l_list):NULL, count, style, text); +} + #define CUSTOM_INIT \ AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XLockMutex_fn"), 0, "_XLockMutex_fn"); \ AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XUnlockMutex_fn"), 0, "_XUnlockMutex_fn"); \ diff --git a/src/wrapped32/wrappedlibx11_private.h b/src/wrapped32/wrappedlibx11_private.h index 199ac87a..b3e0f665 100644 --- a/src/wrapped32/wrappedlibx11_private.h +++ b/src/wrapped32/wrappedlibx11_private.h @@ -313,8 +313,8 @@ GO(XDisplayWidthMM, iFXi) //GOM(XESetWireToEvent, pFEpip) //GOM(XESetWireToEventCookie, pFEpip) //GO(XEventMaskOfScreen, lFp) -//GO(_XEventsQueued, iFpi) -//GO(XEventsQueued, iFpi) +GO(_XEventsQueued, iFXi) +GO(XEventsQueued, iFXi) //DATA(_Xevent_to_mask, //GO(_XEventToWire, iFppp) //GO(XExtendedMaxRequestSize, lFp) @@ -885,7 +885,7 @@ GO(XLookupColor, iFXLpBLWWWcc_BLWWWcc_) GO(XLowerWindow, iFXL) GO(XMapRaised, iFXL) GO(XMapSubwindows, iFXL) -//GO(XMapWindow, iFpL) +GO(XMapWindow, iFXL) //GO(XMaskEvent, iFplp) //GO(XMatchVisualInfo, iFpiiip) //GO(XMaxCmapsOfScreen, iFp) @@ -1044,7 +1044,7 @@ GO(XPutPixel, vFXiiL) //GO(XScreenResourceString, pFp) //GO(XSelectInput, iFpLl) //GO(_XSend, vFppl) -//GO(XSendEvent, iFpLilp) +GOM(XSendEvent, iFEXLilp) //GO(XServerVendor, pFp) //GO(XSetAccessControl, iFpi) //GOM(XSetAfterFunction, pFEpp) @@ -1095,7 +1095,7 @@ GO(XPutPixel, vFXiiL) //GO(XSetState, iFppLLiL) //GO(XSetStipple, iFppL) //GO(XSetSubwindowMode, iFppi) -//GO(XSetTextProperty, vFpLpL) +GO(XSetTextProperty, vFXLpL) // use XTextProperty as last arg //GO(XSetTile, iFppL) //GO(XSetTransientForHint, iFpLL) //GO(XSetTSOrigin, iFppii) @@ -1108,8 +1108,8 @@ GO(XPutPixel, vFXiiL) //GO(XSetWMClientMachine, vFpLp) //GO(XSetWMColormapWindows, iFpLpi) GOM(XSetWMHints, iFEXLp) -//GO(XSetWMIconName, vFpLp) -//GO(XSetWMName, vFpLp) +GO(XSetWMIconName, vFXLp) // use XTextProperty as last arg +GO(XSetWMName, vFXLp) // use XTextProperty as last arg GOM(XSetWMNormalHints, vFEXLp) //GO(XSetWMProperties, vFpLpppippp) GOM(XSetWMProtocols, iFEXLpi) @@ -1123,13 +1123,13 @@ GOM(XSetWMProtocols, iFEXLpi) //GO(_XStoreEventCookie, vFpp) GO(XStoreName, iFXLp) //GO(XStoreNamedColor, iFpLpLi) -//GO(XStringListToTextProperty, iFpip) +GOM(XStringListToTextProperty, iFEpip) //GO(XStringToKeysym, LFp) GOM(XSubImage, pFEpiiuu) // need unbridging GO(dummy_XSubImage, pFpiiuu) // for the wrapper //GO(XSubtractRegion, iFppp) //GO(XSupportsLocale, iFv) -//GO(XSync, iFpi) +GO(XSync, iFXi) //GOM(XSynchronize, pFEpi) //GO(XTextExtents, iFppipppp) //GO(XTextExtents16, iFppipppp) @@ -1187,7 +1187,7 @@ DATA(_XUnlockMutex_fn, 4) //GO(Xutf8TextEscapement, iFppi) //GO(Xutf8TextExtents, iFppipp) //GO(_Xutf8TextListToTextProperty, -//GO(Xutf8TextListToTextProperty, iFppiup) +GOM(Xutf8TextListToTextProperty, iFEXpiup) //GO(Xutf8TextPerCharExtents, iFppippippp) //GO(_Xutf8TextPropertyToTextList, //GO(Xutf8TextPropertyToTextList, iFpppp) |