diff options
| -rwxr-xr-x | rebuild_wrappers_32.py | 10 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 1 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 3 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 1 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 2 |
5 files changed, 14 insertions, 3 deletions
diff --git a/rebuild_wrappers_32.py b/rebuild_wrappers_32.py index aa87b741..e413b914 100755 --- a/rebuild_wrappers_32.py +++ b/rebuild_wrappers_32.py @@ -626,7 +626,8 @@ class FunctionType(metaclass=FirstArgumentSingletonMeta): self.orig = CTypeNone(string, clause, filespec) - self.hasemu = 'E' in self.orig.replaced + self.hasemu = 'E' in self.orig.replaced and ( + (self.orig.recursive[1].structname != 'E') or ('E' in self.orig.recursive[0].name) or any('E' in ct.name for ct in self.orig.recursive[2:])) if self.hasemu: if ("E" in self.orig.recursive[0].name) or any("E" in ct.name for ct in self.orig.recursive[3:]): raise NotImplementedError("x64emu_t* not as the first parameter") @@ -642,7 +643,7 @@ class FunctionType(metaclass=FirstArgumentSingletonMeta): if len(chk_type) < 2: raise NotImplementedError("Type {0} too short".format(string)) - if self.orig.recursive[1].structname != "F": + if self.orig.recursive[1].structname not in ['E', 'F']: raise NotImplementedError("Bad middle letter {0}".format(self.orig.recursive[1].structname)) self.redirect = any(c not in FileSpec.values for c in chk_type) or (('v' in chk_type[1:]) and (len(chk_type) > 2)) @@ -1211,6 +1212,7 @@ def generate_files(root: str, files: Iterable[str], ver: str, gbls: SortedGlobal # Files header and guard files_header = { "wrapper32.c": """ + #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -1490,9 +1492,13 @@ def generate_files(root: str, files: Iterable[str], ver: str, gbls: SortedGlobal def assertex(v: Optional[T]) -> T: assert v is not None, "Value is None" return v + if N.orig.recursive[1].structname == 'E': + f.write("errno = emu->libc_err; ") f.write(function_args(zip(args[0], args[1]), lambda ct: assertex(ct.aspre))) f.write(assertex(N.orig.recursive[0].asret).format(function_args(zip(args[0], args[1]), lambda ct: assertex(ct.asarg))[:-2])) f.write(function_args(zip(args[0], args[1]), lambda ct: assertex(ct.aspost))) + if N.orig.recursive[1].structname == 'E': + f.write(" emu->libc_err = errno;") f.write(" }\n") # TODO: src/wrapped/generated32/converter32.c&h diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 3eeb0871..b7ca41e5 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -27,6 +27,7 @@ #() iFl -> iFl #() iFL -> iFL #() iFp -> iFp +#() iEp -> iEp #() iFh -> iFh #() iFS -> iFS #() iFX -> iFX diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 2c15e1a5..7ff0b3db 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1,6 +1,7 @@ /********************************************************************* * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) * *********************************************************************/ +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -117,6 +118,7 @@ typedef int32_t (*iFd_t)(double); typedef int32_t (*iFl_t)(intptr_t); typedef int32_t (*iFL_t)(uintptr_t); typedef int32_t (*iFp_t)(void*); +typedef int32_t (*iEp_t)(void*); typedef int32_t (*iFh_t)(uintptr_t); typedef int32_t (*iFS_t)(void*); typedef int32_t (*iFX_t)(void*); @@ -1629,6 +1631,7 @@ void iFd_32(x64emu_t *emu, uintptr_t fcn) { iFd_t fn = (iFd_t)fcn; R_EAX = fn(fr void iFl_32(x64emu_t *emu, uintptr_t fcn) { iFl_t fn = (iFl_t)fcn; R_EAX = fn(from_long(from_ptri(long_t, R_ESP + 4))); } void iFL_32(x64emu_t *emu, uintptr_t fcn) { iFL_t fn = (iFL_t)fcn; R_EAX = fn(from_ulong(from_ptri(ulong_t, R_ESP + 4))); } void iFp_32(x64emu_t *emu, uintptr_t fcn) { iFp_t fn = (iFp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4)); } +void iEp_32(x64emu_t *emu, uintptr_t fcn) { iEp_t fn = (iEp_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptriv(R_ESP + 4)); emu->libc_err = errno; } void iFh_32(x64emu_t *emu, uintptr_t fcn) { iFh_t fn = (iFh_t)fcn; R_EAX = fn(from_hash(from_ptri(ptr_t, R_ESP + 4))); } void iFS_32(x64emu_t *emu, uintptr_t fcn) { iFS_t fn = (iFS_t)fcn; R_EAX = fn(io_convert32(from_ptriv(R_ESP + 4))); } void iFX_32(x64emu_t *emu, uintptr_t fcn) { iFX_t fn = (iFX_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4))); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index a135ac8c..b58438c4 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -68,6 +68,7 @@ void iFd_32(x64emu_t *emu, uintptr_t fnc); void iFl_32(x64emu_t *emu, uintptr_t fnc); void iFL_32(x64emu_t *emu, uintptr_t fnc); void iFp_32(x64emu_t *emu, uintptr_t fnc); +void iEp_32(x64emu_t *emu, uintptr_t fnc); void iFh_32(x64emu_t *emu, uintptr_t fnc); void iFS_32(x64emu_t *emu, uintptr_t fnc); void iFX_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 593bc6cd..b9e9f273 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1918,7 +1918,7 @@ GOM(vsyslog, vFEipp) //GOM(vwprintf, iFEpp) //%% //GO2(__vwprintf_chk, iFEvpp, my_vwprintf) //GO(vwscanf, iFpp) -GOW(wait, iFp) +GOW(wait, iEp) //GOW(__wait, iFp) //GOW(wait3, iFpip) //GOW(wait4, iFipip) |