Jacek Caban : win32u: Move NtUserRemoveProp implementation from user32.

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


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

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

win32u: Move NtUserRemoveProp 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     | 13 +------------
 dlls/win32u/syscall.c      |  1 +
 dlls/win32u/tests/win32u.c |  6 ++++++
 dlls/win32u/win32u.spec    |  2 +-
 dlls/win32u/window.c       | 24 ++++++++++++++++++++++++
 dlls/wow64win/syscall.h    |  1 +
 dlls/wow64win/user.c       |  8 ++++++++
 7 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/dlls/user32/property.c b/dlls/user32/property.c
index b31169120d7..4d55c4dfac8 100644
--- a/dlls/user32/property.c
+++ b/dlls/user32/property.c
@@ -170,18 +170,7 @@ HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
  */
 HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
 {
-    ULONG_PTR ret = 0;
-
-    SERVER_START_REQ( remove_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 NtUserRemoveProp( hwnd, str );
 }
 
 
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index ac4a880ee63..762729f815e 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -113,6 +113,7 @@ static void * const syscalls[] =
     NtUserOpenDesktop,
     NtUserOpenInputDesktop,
     NtUserOpenWindowStation,
+    NtUserRemoveProp,
     NtUserSetObjectInformation,
     NtUserSetProcessWindowStation,
     NtUserSetProp,
diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c
index 60e0085a913..a7c2e5ef029 100644
--- a/dlls/win32u/tests/win32u.c
+++ b/dlls/win32u/tests/win32u.c
@@ -52,6 +52,12 @@ static void test_window_props(void)
     prop = NtUserGetProp( hwnd, UlongToPtr(atom) );
     ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
 
+    prop = NtUserRemoveProp( hwnd, UlongToPtr(atom) );
+    ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
+
+    prop = GetPropW(hwnd, L"test");
+    ok(!prop, "prop = %p\n", prop);
+
     GlobalDeleteAtom( atom );
     DestroyWindow( hwnd );
 }
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index eb01a5299fe..8327e588b77 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1148,7 +1148,7 @@
 @ stub NtUserRemoveClipboardFormatListener
 @ stub NtUserRemoveInjectionDevice
 @ stub NtUserRemoveMenu
-@ stub NtUserRemoveProp
+@ stdcall -syscall NtUserRemoveProp(long wstr)
 @ stub NtUserRemoveVisualIdentifier
 @ stub NtUserReportInertia
 @ stub NtUserRequestMoveSizeOperation
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index dcf71b12c32..a84ceeefaf5 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -70,6 +70,30 @@ BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle )
     return ret;
 }
 
+
+/***********************************************************************
+ *           NtUserRemoveProp   (win32u.@)
+ *
+ * NOTE Native allows only ATOMs as the second argument. We allow strings
+ *      to save extra server call in RemovePropW.
+ */
+HANDLE WINAPI NtUserRemoveProp( HWND hwnd, const WCHAR *str )
+{
+    ULONG_PTR ret = 0;
+
+    SERVER_START_REQ( remove_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;
+}
+
+
 /*****************************************************************************
  *           NtUserGetLayeredWindowAttributes (win32u.@)
  */
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index d3a02181e64..8430d0b1527 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -100,6 +100,7 @@
     SYSCALL_ENTRY( NtUserOpenDesktop ) \
     SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
     SYSCALL_ENTRY( NtUserOpenWindowStation ) \
+    SYSCALL_ENTRY( NtUserRemoveProp ) \
     SYSCALL_ENTRY( NtUserSetObjectInformation ) \
     SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
     SYSCALL_ENTRY( NtUserSetProp ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index 48dc9d465df..2686d75a094 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -173,6 +173,14 @@ NTSTATUS WINAPI wow64_NtUserSetProp( UINT *args )
     return NtUserSetProp( hwnd, str, handle );
 }
 
+NTSTATUS WINAPI wow64_NtUserRemoveProp( UINT *args )
+{
+    HWND hwnd = get_handle( &args );
+    const WCHAR *str = get_ptr( &args );
+
+    return HandleToUlong( NtUserRemoveProp( hwnd, str ));
+}
+
 NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
 {
     HWND hwnd = get_handle( &args );




More information about the wine-cvs mailing list