about summary refs log tree commit diff stats
path: root/src/wrapped/wrappednss3.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-12-21 14:38:56 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-12-21 14:38:56 +0100
commitb66eccedc0d08a6d545fe9c443119fb436c8b888 (patch)
treece62db120428f109ec6638862436c79cf004ed45 /src/wrapped/wrappednss3.c
parentf79e725aa38086ad7d86bea74cd2a3f90cabd3f0 (diff)
downloadbox64-b66eccedc0d08a6d545fe9c443119fb436c8b888.tar.gz
box64-b66eccedc0d08a6d545fe9c443119fb436c8b888.zip
Added more wrapped function to libnss3, libnssutils3 and libnspr4 (for GridAutosport)
Diffstat (limited to 'src/wrapped/wrappednss3.c')
-rw-r--r--src/wrapped/wrappednss3.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/wrapped/wrappednss3.c b/src/wrapped/wrappednss3.c
index e64ac396..a655bebd 100644
--- a/src/wrapped/wrappednss3.c
+++ b/src/wrapped/wrappednss3.c
@@ -141,6 +141,28 @@ static void* find_PORTCharConversionWSwapFunc_Fct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for nss3 PORTCharConversionWSwapFunc callback\n");
     return NULL;
 }
+// NSS_ShutdownFunc ...
+#define GO(A)   \
+static uintptr_t my_NSS_ShutdownFunc_fct_##A = 0;                           \
+static int my_NSS_ShutdownFunc_##A(void* a, void* b)                        \
+{                                                                           \
+    return (int)RunFunctionFmt(my_NSS_ShutdownFunc_fct_##A, "pp", a, b);    \
+}
+SUPER()
+#undef GO
+static void* find_NSS_ShutdownFunc_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_NSS_ShutdownFunc_fct_##A == (uintptr_t)fct) return my_NSS_ShutdownFunc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_NSS_ShutdownFunc_fct_##A == 0) {my_NSS_ShutdownFunc_fct_##A = (uintptr_t)fct; return my_NSS_ShutdownFunc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for nss3 NSS_ShutdownFunc callback\n");
+    return NULL;
+}
 
 #undef SUPER
 
@@ -206,6 +228,11 @@ EXPORT void my_PORT_SetUCS2_ASCIIConversionFunction(x64emu_t* emu, void* f)
     my->PORT_SetUCS2_ASCIIConversionFunction(find_PORTCharConversionWSwapFunc_Fct(f));
 }
 
+EXPORT int my_NSS_RegisterShutdown(x64emu_t* emu, void* f, void* data)
+{
+    return my->NSS_RegisterShutdown(find_NSS_ShutdownFunc_Fct(f), data);
+}
+
 #define CUSTOM_INIT \
     getMy(lib);