Jacek Caban : win32u: Move NtUserGetClipboardOwner implementation from user32.

Alexandre Julliard julliard at winehq.org
Mon Nov 15 16:01:27 CST 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Nov 12 12:53:50 2021 +0100

win32u: Move NtUserGetClipboardOwner implementation from user32.

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/clipboard.c | 21 +--------------------
 dlls/user32/user32.spec |  2 +-
 dlls/user32/win.c       |  2 +-
 dlls/win32u/clipboard.c | 17 +++++++++++++++++
 dlls/win32u/syscall.c   |  1 +
 dlls/win32u/win32u.spec |  2 +-
 dlls/wow64win/syscall.h |  1 +
 dlls/wow64win/user.c    |  5 +++++
 include/ntuser.h        |  1 +
 9 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 8023eee4944..a1fe923ffb3 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -729,7 +729,7 @@ BOOL WINAPI CloseClipboard(void)
 BOOL WINAPI EmptyClipboard(void)
 {
     BOOL ret;
-    HWND owner = GetClipboardOwner();
+    HWND owner = NtUserGetClipboardOwner();
 
     TRACE( "owner %p\n", owner );
 
@@ -750,25 +750,6 @@ BOOL WINAPI EmptyClipboard(void)
 }
 
 
-/**************************************************************************
- *		GetClipboardOwner (USER32.@)
- */
-HWND WINAPI GetClipboardOwner(void)
-{
-    HWND hWndOwner = 0;
-
-    SERVER_START_REQ( get_clipboard_info )
-    {
-        if (!wine_server_call_err( req )) hWndOwner = wine_server_ptr_handle( reply->owner );
-    }
-    SERVER_END_REQ;
-
-    TRACE( "returning %p\n", hWndOwner );
-
-    return hWndOwner;
-}
-
-
 /**************************************************************************
  *		GetOpenClipboardWindow (USER32.@)
  */
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 3a46765c038..7592b477b6b 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -277,7 +277,7 @@
 @ stdcall GetClipboardData(long)
 @ stdcall GetClipboardFormatNameA(long ptr long)
 @ stdcall GetClipboardFormatNameW(long ptr long) NtUserGetClipboardFormatName
-@ stdcall GetClipboardOwner()
+@ stdcall GetClipboardOwner() NtUserGetClipboardOwner
 @ stdcall GetClipboardSequenceNumber ()
 @ stdcall GetClipboardViewer()
 @ stdcall GetComboBoxInfo(long ptr)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 55d12a6d62c..bc0b06c3f94 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1949,7 +1949,7 @@ static void WIN_SendDestroyMsg( HWND hwnd )
         if (hwnd == info.hwndActive) WINPOS_ActivateOtherWindow( hwnd );
     }
 
-    if (hwnd == GetClipboardOwner()) CLIPBOARD_ReleaseOwner( hwnd );
+    if (hwnd == NtUserGetClipboardOwner()) CLIPBOARD_ReleaseOwner( hwnd );
 
     /*
      * Send the WM_DESTROY to the window.
diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c
index 4c64655b69e..4e584ceb71c 100644
--- a/dlls/win32u/clipboard.c
+++ b/dlls/win32u/clipboard.c
@@ -140,3 +140,20 @@ INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen
     buffer[length] = 0;
     return length;
 }
+
+/**************************************************************************
+ *	     NtUserGetClipboardOwner    (win32u.@)
+ */
+HWND WINAPI NtUserGetClipboardOwner(void)
+{
+    HWND owner = 0;
+
+    SERVER_START_REQ( get_clipboard_info )
+    {
+        if (!wine_server_call_err( req )) owner = wine_server_ptr_handle( reply->owner );
+    }
+    SERVER_END_REQ;
+
+    TRACE( "returning %p\n", owner );
+    return owner;
+}
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index a84633b2215..9bc6265e79b 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -106,6 +106,7 @@ static void * const syscalls[] =
     NtUserCreateDesktopEx,
     NtUserCreateWindowStation,
     NtUserGetClipboardFormatName,
+    NtUserGetClipboardOwner,
     NtUserGetLayeredWindowAttributes,
     NtUserGetObjectInformation,
     NtUserGetProcessWindowStation,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index dbfe196dbcf..34a1caf6bcd 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -904,7 +904,7 @@
 @ stub NtUserGetClipboardAccessToken
 @ stub NtUserGetClipboardData
 @ stdcall -syscall NtUserGetClipboardFormatName(long ptr long)
-@ stub NtUserGetClipboardOwner
+@ stdcall -syscall NtUserGetClipboardOwner()
 @ stub NtUserGetClipboardSequenceNumber
 @ stub NtUserGetClipboardViewer
 @ stub NtUserGetComboBoxInfo
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index b78b4697e6c..62375014010 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -93,6 +93,7 @@
     SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
     SYSCALL_ENTRY( NtUserCreateWindowStation ) \
     SYSCALL_ENTRY( NtUserGetClipboardFormatName ) \
+    SYSCALL_ENTRY( NtUserGetClipboardOwner ) \
     SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
     SYSCALL_ENTRY( NtUserGetObjectInformation ) \
     SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index f12516843fb..f0d520bfaa4 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -199,3 +199,8 @@ NTSTATUS WINAPI wow64_NtUserGetClipboardFormatName( UINT *args )
 
     return NtUserGetClipboardFormatName( format, buffer, maxlen );
 }
+
+NTSTATUS WINAPI wow64_NtUserGetClipboardOwner( UINT *args )
+{
+    return HandleToUlong( NtUserGetClipboardOwner() );
+}
diff --git a/include/ntuser.h b/include/ntuser.h
index 083d6cb4a1b..27fb6b60bc3 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -32,6 +32,7 @@ HDESK   WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d
 HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
                                           ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
 INT     WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen );
+HWND    WINAPI NtUserGetClipboardOwner(void);
 BOOL    WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags );
 BOOL    WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info,
                                            DWORD len, DWORD *needed );




More information about the wine-cvs mailing list