Paul Gofman : ntdll: Allocate TEB FLS data in LdrInitializeThunk().
Alexandre Julliard
julliard at winehq.org
Thu Oct 8 15:20:05 CDT 2020
Module: wine
Branch: master
Commit: 87ea7698ab8c859f0b7e4f363339b0b15c31abd5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=87ea7698ab8c859f0b7e4f363339b0b15c31abd5
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Tue Oct 6 13:04:49 2020 +0300
ntdll: Allocate TEB FLS data in LdrInitializeThunk().
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/loader.c | 3 +--
dlls/ntdll/loader.c | 2 ++
dlls/ntdll/ntdll_misc.h | 1 +
dlls/ntdll/thread.c | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index fecbee3ba1..8e8834239b 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -2629,8 +2629,7 @@ todo_wine
SetLastError(0xdeadbeef);
value = pFlsGetValue(fls_index);
ok(!value, "FlsGetValue returned %p, expected NULL\n", value);
- todo_wine
- ok(GetLastError() == ERROR_SUCCESS, "FlsGetValue failed with error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_SUCCESS, "FlsGetValue failed with error %u\n", GetLastError());
ret = pFlsSetValue(fls_index, (void*) 0x31415);
ok(ret, "FlsSetValue failed\n");
fls_count++;
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1d5ffc33f5..8374dd9732 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3511,6 +3511,8 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
InsertHeadList( &tls_links, &NtCurrentTeb()->TlsLinks );
RtlReleasePebLock();
+ NtCurrentTeb()->FlsSlots = fls_alloc_data();
+
if (!attach_done) /* first time around */
{
attach_done = 1;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 19bf574a44..41e8666a25 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -129,5 +129,6 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
/* FLS data */
extern void init_global_fls_data(void) DECLSPEC_HIDDEN;
+extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN;
#endif
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 6b88d0ed8e..822dc21fbb 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -294,7 +294,7 @@ static unsigned int fls_chunk_index_from_index( unsigned int index, unsigned int
return chunk_index;
}
-static TEB_FLS_DATA * fls_alloc_data(void)
+TEB_FLS_DATA *fls_alloc_data(void)
{
TEB_FLS_DATA *fls;
More information about the wine-cvs
mailing list