Jacek Caban : ucrtbase: Added _register_thread_local_exe_atexit_callback implementation.

Alexandre Julliard julliard at winehq.org
Wed Sep 20 15:10:23 CDT 2017


Module: wine
Branch: master
Commit: 32c38dc4b27d314f5c367549c7016aaef7f425d6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=32c38dc4b27d314f5c367549c7016aaef7f425d6

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 20 16:06:13 2017 +0200

ucrtbase: Added _register_thread_local_exe_atexit_callback implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 .../api-ms-win-crt-runtime-l1-1-0.spec                      |  2 +-
 dlls/msvcrt/exit.c                                          | 13 +++++++++++++
 dlls/ucrtbase/ucrtbase.spec                                 |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
index caf0193..50856a5 100644
--- a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
@@ -61,7 +61,7 @@
 @ stub _invoke_watson
 @ stub _query_app_type
 @ cdecl _register_onexit_function(ptr ptr) ucrtbase._register_onexit_function
-@ stub _register_thread_local_exe_atexit_callback
+@ cdecl _register_thread_local_exe_atexit_callback(ptr) ucrtbase._register_thread_local_exe_atexit_callback
 @ cdecl _resetstkoflw() ucrtbase._resetstkoflw
 @ cdecl -arch=i386,x86_64,arm,arm64 _seh_filter_dll(long ptr) ucrtbase._seh_filter_dll
 @ cdecl _seh_filter_exe(long ptr) ucrtbase._seh_filter_exe
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 4eff073..1d19081 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -41,6 +41,9 @@ typedef struct MSVCRT__onexit_table_t
     MSVCRT__onexit_t *_end;
 } MSVCRT__onexit_table_t;
 
+typedef void (__stdcall *_tls_callback_type)(void*,ULONG,void*);
+static _tls_callback_type tls_atexit_callback;
+
 static CRITICAL_SECTION MSVCRT_onexit_cs;
 static CRITICAL_SECTION_DEBUG MSVCRT_onexit_cs_debug =
 {
@@ -63,6 +66,7 @@ static void __MSVCRT__call_atexit(void)
 {
   /* Note: should only be called with the exit lock held */
   TRACE("%d atext functions to call\n", MSVCRT_atexit_registered);
+  if (tls_atexit_callback) tls_atexit_callback(NULL, DLL_PROCESS_DETACH, NULL);
   /* Last registered gets executed first */
   while (MSVCRT_atexit_registered > 0)
   {
@@ -450,6 +454,15 @@ int CDECL MSVCRT__execute_onexit_table(MSVCRT__onexit_table_t *table)
 }
 
 /*********************************************************************
+ *		_register_thread_local_exe_atexit_callback (UCRTBASE.@)
+ */
+void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
+{
+    TRACE("(%p)\n", callback);
+    tls_atexit_callback = callback;
+}
+
+/*********************************************************************
  *		_set_purecall_handler (MSVCR71.@)
  */
 MSVCRT_purecall_handler CDECL _set_purecall_handler(MSVCRT_purecall_handler function)
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index e48c2ed..9512a22 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -1862,7 +1862,7 @@
 @ cdecl _realloc_base(ptr long)
 @ cdecl _recalloc(ptr long long)
 @ cdecl _register_onexit_function(ptr ptr) MSVCRT__register_onexit_function
-@ stub _register_thread_local_exe_atexit_callback
+@ cdecl _register_thread_local_exe_atexit_callback(ptr)
 @ cdecl _resetstkoflw() MSVCRT__resetstkoflw
 @ cdecl _rmdir(str) MSVCRT__rmdir
 @ cdecl _rmtmp() MSVCRT__rmtmp




More information about the wine-cvs mailing list