Piotr Caban : ucrtbase: Change ptd fields offsets to match with native.

Alexandre Julliard julliard at winehq.org
Tue Apr 21 15:59:47 CDT 2020


Module: wine
Branch: master
Commit: 9b94e4c80580325e62097ed6c08cc37c28575470
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9b94e4c80580325e62097ed6c08cc37c28575470

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Apr 21 13:11:56 2020 +0200

ucrtbase: Change ptd fields offsets to match with native.

Makes it possible to use native vcruntime140_1.dll.

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

---

 dlls/msvcr90/tests/msvcr90.c |  3 +--
 dlls/msvcrt/msvcrt.h         |  5 ++---
 dlls/ucrtbase/tests/misc.c   | 26 ++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index eb0970f4c1..630b56f8a6 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -1139,8 +1139,7 @@ struct __thread_data {
     void*                           terminate_handler;
     void*                           unexpected_handler;
     void*                           se_translator;
-    void                            *unk6[3];
-    int                             unk7;
+    void                            *unk6;
     EXCEPTION_RECORD                *exc_record;
 };
 
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 244df7d23c..a45b82a944 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -285,9 +285,8 @@ struct __thread_data {
     int                             unk5[1];
     MSVCRT_terminate_function       terminate_handler;
     MSVCRT_unexpected_function      unexpected_handler;
-    MSVCRT__se_translator_function  se_translator;
-    void                           *unk6[3];
-    int                             unk7;
+    MSVCRT__se_translator_function  se_translator;      /* preserve offset to exc_record and processing_throw */
+    void                           *unk6;
     EXCEPTION_RECORD               *exc_record;
     CONTEXT                        *ctx_record;
     int                             processing_throw;
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index dfbe0256ca..eb0c79be2b 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -100,12 +100,17 @@ typedef struct {
     const wchar_t *locnameW;
 } __lc_time_data;
 
+typedef void (__cdecl *_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
+
 static LONGLONG crt_init_end;
 
 _ACRTIMP int __cdecl _o__initialize_onexit_table(_onexit_table_t *table);
 _ACRTIMP int __cdecl _o__register_onexit_function(_onexit_table_t *table, _onexit_t func);
 _ACRTIMP int __cdecl _o__execute_onexit_table(_onexit_table_t *table);
 _ACRTIMP void *__cdecl _o_malloc(size_t);
+_se_translator_function __cdecl _set_se_translator(_se_translator_function func);
+void** __cdecl __current_exception(void);
+int* __cdecl __processing_throw(void);
 
 static void test__initialize_onexit_table(void)
 {
@@ -1297,6 +1302,26 @@ static void test_clock(void)
             c, expect_min - thresh, expect_min + max_load_delay);
 }
 
+static void __cdecl se_translator(unsigned int u, EXCEPTION_POINTERS *ep)
+{
+}
+
+static void test_thread_storage(void)
+{
+    void **current_exception;
+    void *processing_throw;
+
+    _set_se_translator(se_translator);
+    current_exception = __current_exception();
+    processing_throw = __processing_throw();
+
+    ok(current_exception+2 == processing_throw,
+            "current_exception = %p, processing_throw = %p\n",
+            current_exception, processing_throw);
+    ok(current_exception[-2] == se_translator,
+            "can't find se_translator in thread storage\n");
+}
+
 START_TEST(misc)
 {
     int arg_c;
@@ -1335,4 +1360,5 @@ START_TEST(misc)
     test__stat32();
     test__o_malloc();
     test_clock();
+    test_thread_storage();
 }




More information about the wine-cvs mailing list