about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-07-11 19:59:24 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-07-11 19:59:24 +0200
commitbf79be222cbe73d25b2d90232467f61f4f85a88d (patch)
treedf598271735c8cc32e39665d546666393817eafe /src
parent1bb27f2b807c3a9b67a0fdaf52f7390c6551acdd (diff)
downloadbox64-bf79be222cbe73d25b2d90232467f61f4f85a88d.tar.gz
box64-bf79be222cbe73d25b2d90232467f61f4f85a88d.zip
Added __fwprintf_chk wrapped function (for KSP)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrappedlibctypes.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc.c8
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
4 files changed, 9 insertions, 3 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index a9a84315..daaed18c 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2857,6 +2857,7 @@ wrappedlibc:
 - iFpipV:
   - __asprintf_chk
   - __fprintf_chk
+  - __fwprintf_chk
 - iFpLpp:
   - __vsnprintf_chk
 - iFpLpV:
diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h
index 989cdf64..74166f2c 100644
--- a/src/wrapped/generated/wrappedlibctypes.h
+++ b/src/wrapped/generated/wrappedlibctypes.h
@@ -213,6 +213,7 @@ typedef int64_t (*iFppipppp_t)(void*, void*, int64_t, void*, void*, void*, void*
 	GO(glob64, iFpipp_t) \
 	GO(__asprintf_chk, iFpipV_t) \
 	GO(__fprintf_chk, iFpipV_t) \
+	GO(__fwprintf_chk, iFpipV_t) \
 	GO(__vsnprintf_chk, iFpLpp_t) \
 	GO(__snprintf, iFpLpV_t) \
 	GO(snprintf, iFpLpV_t) \
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 6c407414..252e9b13 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -640,9 +640,13 @@ EXPORT int my_fwprintf(x64emu_t *emu, void* F, void* fmt, void* b)  {
     return vfwprintf(F, fmt, VARARGS);
 }
 
-#if 0
-EXPORT int my___fwprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b, va_list V) __attribute__((alias("my_fwprintf")));
+EXPORT int my___fwprintf_chk(x64emu_t *emu, void* F, int flag, void* fmt, void* b) {
+    myStackAlignW(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3);
+    PREPARE_VALIST;
+    return vfwprintf(F, fmt, VARARGS);
+}
 
+#if 0
 EXPORT int my_vfwprintf(x64emu_t *emu, void* F, void* fmt, void* b) {
     #ifndef NOALIGN
     myStackAlignW((const char*)fmt, b, emu->scratch);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 9e8b110e..012caaa9 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -462,7 +462,7 @@ GOW(futimes, iFip)
 GO(futimesat, iFipp)
 GO(fwide, iFpi)
 GOWM(fwprintf, iFEppV)
-//GO(__fwprintf_chk, 
+GOM(__fwprintf_chk, iFEpipV)
 GO(__fwritable, iFp)
 GOW(fwrite, LFpLLp)
 GO(fwrite_unlocked, LFpLLp)