Jacek Caban : win32u: Store thread info in 64-bit TEB on wow64.

Alexandre Julliard julliard at winehq.org
Tue Aug 9 15:19:54 CDT 2022


Module: wine
Branch: master
Commit: 8bb71922a555d6346f1652b52866ed02025f9f01
URL:    https://gitlab.winehq.org/wine/wine/-/commit/8bb71922a555d6346f1652b52866ed02025f9f01

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Jul 30 12:49:51 2022 +0200

win32u: Store thread info in 64-bit TEB on wow64.

---

 dlls/win32u/ntuser_private.h | 5 +++++
 dlls/win32u/win32u_private.h | 5 -----
 include/ntuser.h             | 7 +++++++
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 3b74a2ae83a..1be8eed3020 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -138,6 +138,11 @@ struct user_thread_info
 
 C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
 
+static inline struct user_thread_info *get_user_thread_info(void)
+{
+    return CONTAINING_RECORD( NtUserGetThreadInfo(), struct user_thread_info, client_info );
+}
+
 struct user_key_state_info
 {
     UINT  time;          /* Time of last key state refresh */
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 6d492f2e73b..eb215519643 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -432,11 +432,6 @@ extern void reg_delete_value( HKEY hkey, const WCHAR *name ) DECLSPEC_HIDDEN;
 
 extern HKEY hkcu_key DECLSPEC_HIDDEN;
 
-static inline struct user_thread_info *get_user_thread_info(void)
-{
-    return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
-}
-
 extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
 
 static inline BOOL set_ntstatus( NTSTATUS status )
diff --git a/include/ntuser.h b/include/ntuser.h
index 84cb7fdb9b8..f15ba1f135e 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -78,6 +78,13 @@ struct ntuser_thread_info
 
 static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)
 {
+#ifndef _WIN64
+    if (NtCurrentTeb()->GdiBatchCount)
+    {
+        TEB64 *teb64 = (TEB64 *)(UINT_PTR)NtCurrentTeb()->GdiBatchCount;
+        return (struct ntuser_thread_info *)teb64->Win32ClientInfo;
+    }
+#endif
     return (struct ntuser_thread_info *)NtCurrentTeb()->Win32ClientInfo;
 }
 




More information about the wine-cvs mailing list