Jacek Caban : win32u: Move NtUserGetThreadDesktop implementation from user32.

Alexandre Julliard julliard at winehq.org
Wed Oct 13 15:59:27 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct 13 14:54:00 2021 +0200

win32u: Move NtUserGetThreadDesktop implementation from user32.

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

---

 dlls/user32/user32.spec  |  2 +-
 dlls/user32/user_main.c  |  2 +-
 dlls/user32/win.c        |  2 +-
 dlls/user32/winstation.c | 17 -----------------
 dlls/win32u/syscall.c    |  1 +
 dlls/win32u/win32u.spec  |  2 +-
 dlls/win32u/winstation.c | 16 ++++++++++++++++
 dlls/wow64win/syscall.h  |  1 +
 dlls/wow64win/user.c     |  7 +++++++
 include/ntuser.h         |  1 +
 10 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 7686e4ed14d..ecc7675403c 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -387,7 +387,7 @@
 @ stdcall GetTabbedTextExtentA(long str long long ptr)
 @ stdcall GetTabbedTextExtentW(long wstr long long ptr)
 @ stdcall GetTaskmanWindow ()
-@ stdcall GetThreadDesktop(long)
+@ stdcall GetThreadDesktop(long) NtUserGetThreadDesktop
 @ stdcall GetThreadDpiAwarenessContext()
 @ stdcall GetTitleBarInfo(long ptr)
 @ stdcall GetTopWindow(long)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index d7f320575cb..0bf9eac434f 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -307,7 +307,7 @@ static void winstation_init(void)
             }
         }
     }
-    if (buffer || !GetThreadDesktop( GetCurrentThreadId() ))
+    if (buffer || !NtUserGetThreadDesktop( GetCurrentThreadId() ))
     {
         handle = CreateDesktopW( desktop ? desktop : get_default_desktop(),
                                  NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 5e89f4c2c97..e07b7d39e4b 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2231,7 +2231,7 @@ HWND WINAPI GetDesktopWindow(void)
 
         SERVER_START_REQ( set_user_object_info )
         {
-            req->handle = wine_server_obj_handle( GetThreadDesktop(GetCurrentThreadId()) );
+            req->handle = wine_server_obj_handle( NtUserGetThreadDesktop(GetCurrentThreadId()) );
             req->flags  = SET_USER_OBJECT_GET_FULL_NAME;
             wine_server_set_reply( req, desktop, sizeof(desktop) - sizeof(WCHAR) );
             if (!wine_server_call( req ))
diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c
index 1f847ca8b8f..8150a7c87ec 100644
--- a/dlls/user32/winstation.c
+++ b/dlls/user32/winstation.c
@@ -357,23 +357,6 @@ HDESK WINAPI OpenDesktopW( LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK
 }
 
 
-/******************************************************************************
- *              GetThreadDesktop   (USER32.@)
- */
-HDESK WINAPI GetThreadDesktop( DWORD thread )
-{
-    HDESK ret = 0;
-
-    SERVER_START_REQ( get_thread_desktop )
-    {
-        req->tid = thread;
-        if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
-    }
-    SERVER_END_REQ;
-    return ret;
-}
-
-
 /******************************************************************************
  *              SetThreadDesktop   (USER32.@)
  */
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index 2f4269104dd..a6e5be579fc 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -97,6 +97,7 @@ static void * const syscalls[] =
     NtUserCloseDesktop,
     NtUserCloseWindowStation,
     NtUserGetProcessWindowStation,
+    NtUserGetThreadDesktop,
     NtUserSetProcessWindowStation,
 };
 
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 69a48236d84..88b30cfae28 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -995,7 +995,7 @@
 @ stub NtUserGetSharedWindowData
 @ stub NtUserGetSystemDpiForProcess
 @ stub NtUserGetSystemMenu
-@ stub NtUserGetThreadDesktop
+@ stdcall -syscall NtUserGetThreadDesktop(long)
 @ stub NtUserGetThreadState
 @ stub NtUserGetTitleBarInfo
 @ stub NtUserGetTopLevelWindow
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c
index 3b0df303821..54046c646c0 100644
--- a/dlls/win32u/winstation.c
+++ b/dlls/win32u/winstation.c
@@ -90,3 +90,19 @@ BOOL WINAPI NtUserCloseDesktop( HDESK handle )
     SERVER_END_REQ;
     return ret;
 }
+
+/***********************************************************************
+ *           NtUserGetThreadDesktop   (win32u.@)
+ */
+HDESK WINAPI NtUserGetThreadDesktop( DWORD thread )
+{
+    HDESK ret = 0;
+
+    SERVER_START_REQ( get_thread_desktop )
+    {
+        req->tid = thread;
+        if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
+    }
+    SERVER_END_REQ;
+    return ret;
+}
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index ebb88f7013d..3f01ce4f192 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -84,6 +84,7 @@
     SYSCALL_ENTRY( NtUserCloseDesktop ) \
     SYSCALL_ENTRY( NtUserCloseWindowStation ) \
     SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
+    SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
     SYSCALL_ENTRY( NtUserSetProcessWindowStation )
 
 #endif /* __WOW64WIN_SYSCALL_H */
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index 60fd8921b81..93e31ad89a1 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -52,3 +52,10 @@ NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
 
     return NtUserCloseDesktop( handle );
 }
+
+NTSTATUS WINAPI wow64_NtUserGetThreadDesktop( UINT *args )
+{
+    DWORD thread = get_ulong( &args );
+
+    return HandleToUlong( NtUserGetThreadDesktop( thread ));
+}
diff --git a/include/ntuser.h b/include/ntuser.h
index f791af40232..5d7f22c47d6 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -25,6 +25,7 @@
 BOOL    WINAPI NtUserCloseDesktop( HDESK handle );
 BOOL    WINAPI NtUserCloseWindowStation( HWINSTA handle );
 HWINSTA WINAPI NtUserGetProcessWindowStation(void);
+HDESK   WINAPI NtUserGetThreadDesktop( DWORD thread );
 BOOL    WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
 
 #endif /* _NTUSER_ */




More information about the wine-cvs mailing list