Jacek Caban : win32u: Move NtUserGetProp implementation from user32.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 15:45:06 CST 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov  8 14:48:45 2021 +0100

win32u: Move NtUserGetProp implementation from user32.

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

---

 dlls/user32/property.c     | 12 +-----------
 dlls/win32u/syscall.c      |  1 +
 dlls/win32u/tests/win32u.c |  3 +++
 dlls/win32u/win32u.spec    |  2 +-
 dlls/win32u/window.c       | 21 +++++++++++++++++++++
 dlls/wow64win/syscall.h    |  1 +
 dlls/wow64win/user.c       |  8 ++++++++
 7 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/dlls/user32/property.c b/dlls/user32/property.c
index e6877a3b3e0..b31169120d7 100644
--- a/dlls/user32/property.c
+++ b/dlls/user32/property.c
@@ -126,17 +126,7 @@ HANDLE WINAPI GetPropA( HWND hwnd, LPCSTR str )
  */
 HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
 {
-    ULONG_PTR ret = 0;
-
-    SERVER_START_REQ( get_window_property )
-    {
-        req->window = wine_server_user_handle( hwnd );
-        if (IS_INTRESOURCE(str)) req->atom = LOWORD(str);
-        else wine_server_add_data( req, str, lstrlenW(str) * sizeof(WCHAR) );
-        if (!wine_server_call_err( req )) ret = reply->data;
-    }
-    SERVER_END_REQ;
-    return (HANDLE)ret;
+    return NtUserGetProp( hwnd, str );
 }
 
 
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index c718510bbc7..ac4a880ee63 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -108,6 +108,7 @@ static void * const syscalls[] =
     NtUserGetLayeredWindowAttributes,
     NtUserGetObjectInformation,
     NtUserGetProcessWindowStation,
+    NtUserGetProp,
     NtUserGetThreadDesktop,
     NtUserOpenDesktop,
     NtUserOpenInputDesktop,
diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c
index 079c4eead23..60e0085a913 100644
--- a/dlls/win32u/tests/win32u.c
+++ b/dlls/win32u/tests/win32u.c
@@ -49,6 +49,9 @@ static void test_window_props(void)
     prop = GetPropW( hwnd, L"test" );
     ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
 
+    prop = NtUserGetProp( hwnd, UlongToPtr(atom) );
+    ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
+
     GlobalDeleteAtom( atom );
     DestroyWindow( hwnd );
 }
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 97df44f3215..eb01a5299fe 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -980,7 +980,7 @@
 @ stub NtUserGetProcessDpiAwarenessContext
 @ stub NtUserGetProcessUIContextInformation
 @ stdcall -syscall NtUserGetProcessWindowStation()
-@ stub NtUserGetProp
+@ stdcall -syscall NtUserGetProp(long wstr)
 @ stub NtUserGetQueueStatus
 @ stub NtUserGetQueueStatusReadonly
 @ stub NtUserGetRawInputBuffer
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 9543d4c4a54..dcf71b12c32 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -27,6 +27,27 @@
 #include "wine/server.h"
 
 
+/***********************************************************************
+ *           NtUserGetProp   (win32u.@)
+ *
+ * NOTE Native allows only ATOMs as the second argument. We allow strings
+ *      to save extra server call in GetPropW.
+ */
+HANDLE WINAPI NtUserGetProp( HWND hwnd, const WCHAR *str )
+{
+    ULONG_PTR ret = 0;
+
+    SERVER_START_REQ( get_window_property )
+    {
+        req->window = wine_server_user_handle( hwnd );
+        if (IS_INTRESOURCE(str)) req->atom = LOWORD(str);
+        else wine_server_add_data( req, str, lstrlenW(str) * sizeof(WCHAR) );
+        if (!wine_server_call_err( req )) ret = reply->data;
+    }
+    SERVER_END_REQ;
+    return (HANDLE)ret;
+}
+
 /*****************************************************************************
  *           NtUserSetProp    (win32u.@)
  *
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index fb265638750..d3a02181e64 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -95,6 +95,7 @@
     SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
     SYSCALL_ENTRY( NtUserGetObjectInformation ) \
     SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
+    SYSCALL_ENTRY( NtUserGetProp ) \
     SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
     SYSCALL_ENTRY( NtUserOpenDesktop ) \
     SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index d25f2271012..48dc9d465df 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -156,6 +156,14 @@ NTSTATUS WINAPI wow64_NtUserSetObjectInformation( UINT *args )
     return NtUserSetObjectInformation( handle, index, info, len );
 }
 
+NTSTATUS WINAPI wow64_NtUserGetProp( UINT *args )
+{
+    HWND hwnd = get_handle( &args );
+    const WCHAR *str = get_ptr( &args );
+
+    return HandleToUlong( NtUserGetProp( hwnd, str ));
+}
+
 NTSTATUS WINAPI wow64_NtUserSetProp( UINT *args )
 {
     HWND hwnd = get_handle( &args );




More information about the wine-cvs mailing list