Jacek Caban : user32: Store current spy indent in user_thread_info struct.

Alexandre Julliard julliard at winehq.org
Mon Mar 21 17:20:25 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Mar 21 14:14:39 2022 +0100

user32: Store current spy indent in user_thread_info struct.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/spy.c            | 13 ++-----------
 dlls/win32u/ntuser_private.h |  1 +
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/dlls/user32/spy.c b/dlls/user32/spy.c
index 4d22acb43c2..141843e15bb 100644
--- a/dlls/user32/spy.c
+++ b/dlls/user32/spy.c
@@ -2028,14 +2028,12 @@ typedef struct
     WCHAR      wnd_name[16];     /* window name for message            */
 } SPY_INSTANCE;
 
-static LONG indent_tls_index = TLS_OUT_OF_INDEXES;
-
 /***********************************************************************
  *           get_indent_level
  */
 static inline INT_PTR get_indent_level(void)
 {
-    return (INT_PTR)TlsGetValue( indent_tls_index );
+    return get_user_thread_info()->spy_indent;
 }
 
 
@@ -2044,7 +2042,7 @@ static inline INT_PTR get_indent_level(void)
  */
 static inline void set_indent_level( INT_PTR level )
 {
-    TlsSetValue( indent_tls_index, (void *)level );
+    get_user_thread_info()->spy_indent = level;
 }
 
 
@@ -2539,13 +2537,6 @@ static BOOL spy_init(void)
 
     if (!TRACE_ON(message)) return FALSE;
 
-    if (indent_tls_index == TLS_OUT_OF_INDEXES)
-    {
-        DWORD index = TlsAlloc();
-        if (InterlockedCompareExchange( &indent_tls_index, index, TLS_OUT_OF_INDEXES ) != TLS_OUT_OF_INDEXES)
-            TlsFree( index );
-    }
-
     if (spy_exclude) return TRUE;
     exclude = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, SPY_MAX_MSGNUM + 2 );
 
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 03017af9882..4710c45ebc0 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -159,6 +159,7 @@ struct user_thread_info
     HWND                          top_window;             /* Desktop window */
     HWND                          msg_window;             /* HWND_MESSAGE parent window */
     struct rawinput_thread_data  *rawinput;               /* RawInput thread local data / buffer */
+    UINT                          spy_indent;             /* Current spy indent */
 };
 
 C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );




More information about the wine-cvs mailing list