From 9b94e4c80580325e62097ed6c08cc37c28575470 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 21 Apr 2020 13:11:56 +0200 Subject: [PATCH] ucrtbase: Change ptd fields offsets to match with native. Makes it possible to use native vcruntime140_1.dll. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- 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 eb0970f4c15..630b56f8a6e 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 244df7d23cc..a45b82a944c 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 dfbe0256ca5..eb0c79be2b8 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(); }