Jacek Caban : win32u: Move NtUserGetLayeredWindowAttributes implementation from user32.

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


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

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

win32u: Move NtUserGetLayeredWindowAttributes 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/win.c            | 25 +---------------------
 dlls/user32/winpos.c         |  2 +-
 dlls/win32u/Makefile.in      |  1 +
 dlls/win32u/ntgdi_private.h  |  4 ----
 dlls/win32u/syscall.c        |  1 +
 dlls/win32u/win32u.spec      |  2 +-
 dlls/win32u/win32u_private.h |  7 ++++++-
 dlls/win32u/window.c         | 50 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/wow64win/syscall.h      |  1 +
 dlls/wow64win/user.c         | 10 +++++++++
 include/ntuser.h             |  1 +
 12 files changed, 74 insertions(+), 32 deletions(-)

diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 306f955b2a2..82cbfaa4be6 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -325,7 +325,7 @@
 @ stdcall GetKeyboardType(long)
 @ stdcall GetLastActivePopup(long)
 @ stdcall GetLastInputInfo(ptr)
-@ stdcall GetLayeredWindowAttributes(long ptr ptr ptr)
+@ stdcall GetLayeredWindowAttributes(long ptr ptr ptr) NtUserGetLayeredWindowAttributes
 @ stdcall GetListBoxInfo(long)
 @ stdcall GetMenu(long)
 @ stdcall GetMenuBarInfo(long long long ptr)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 3c6810f4200..42a89badbe6 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -4064,29 +4064,6 @@ BOOL WINAPI SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO
 }
 
 
-/*****************************************************************************
- *              GetLayeredWindowAttributes (USER32.@)
- */
-BOOL WINAPI GetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags )
-{
-    BOOL ret;
-
-    SERVER_START_REQ( get_window_layered_info )
-    {
-        req->handle = wine_server_user_handle( hwnd );
-        if ((ret = !wine_server_call_err( req )))
-        {
-            if (key) *key = reply->color_key;
-            if (alpha) *alpha = reply->alpha;
-            if (flags) *flags = reply->flags;
-        }
-    }
-    SERVER_END_REQ;
-
-    return ret;
-}
-
-
 /*****************************************************************************
  *              UpdateLayeredWindowIndirect  (USER32.@)
  */
@@ -4100,7 +4077,7 @@ BOOL WINAPI UpdateLayeredWindowIndirect( HWND hwnd, const UPDATELAYEREDWINDOWINF
         info->cbSize != sizeof(*info) ||
         info->dwFlags & ~(ULW_COLORKEY | ULW_ALPHA | ULW_OPAQUE | ULW_EX_NORESIZE) ||
         !(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) ||
-        GetLayeredWindowAttributes( hwnd, NULL, NULL, NULL ))
+        NtUserGetLayeredWindowAttributes( hwnd, NULL, NULL, NULL ))
     {
         SetLastError( ERROR_INVALID_PARAMETER );
         return FALSE;
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index fa2f7e6fede..6bbd6f34756 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2199,7 +2199,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
     /* create or update window surface for top-level windows if the driver doesn't implement WindowPosChanging */
     if (!ret && new_surface && !IsRectEmpty( &visible_rect ) &&
         (!(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) ||
-           GetLayeredWindowAttributes( hwnd, NULL, NULL, NULL )))
+           NtUserGetLayeredWindowAttributes( hwnd, NULL, NULL, NULL )))
     {
         window_surface_release( new_surface );
         if ((new_surface = win->surface)) window_surface_add_ref( new_surface );
diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in
index feb1e6a3eb2..92e1858b9bc 100644
--- a/dlls/win32u/Makefile.in
+++ b/dlls/win32u/Makefile.in
@@ -37,6 +37,7 @@ C_SRCS = \
 	syscall.c \
 	vertical.c \
 	vulkan.c \
+	window.c \
 	winstation.c \
 	wrappers.c
 
diff --git a/dlls/win32u/ntgdi_private.h b/dlls/win32u/ntgdi_private.h
index b678cd14539..36839cc206f 100644
--- a/dlls/win32u/ntgdi_private.h
+++ b/dlls/win32u/ntgdi_private.h
@@ -24,10 +24,6 @@
 #include <limits.h>
 #include <math.h>
 #include <stdlib.h>
-#include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
-#include "ntgdi.h"
 #include "win32u_private.h"
 
 /* extra stock object: default 1x1 bitmap for memory DCs */
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index 77fe84d074a..8b74deb0be7 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -105,6 +105,7 @@ static void * const syscalls[] =
     NtUserCloseWindowStation,
     NtUserCreateDesktopEx,
     NtUserCreateWindowStation,
+    NtUserGetLayeredWindowAttributes,
     NtUserGetObjectInformation,
     NtUserGetProcessWindowStation,
     NtUserGetThreadDesktop,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index c7cf34ea1ff..5c31b9017ee 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -950,7 +950,7 @@
 @ stub NtUserGetKeyboardLayoutList
 @ stub NtUserGetKeyboardLayoutName
 @ stub NtUserGetKeyboardState
-@ stub NtUserGetLayeredWindowAttributes
+@ stdcall -syscall NtUserGetLayeredWindowAttributes(long ptr ptr ptr)
 @ stub NtUserGetListBoxInfo
 @ stub NtUserGetMenuBarInfo
 @ stub NtUserGetMenuIndex
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 9a0a16c1f22..a76bd6f0c16 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -21,9 +21,14 @@
 #ifndef __WINE_WIN32U_PRIVATE
 #define __WINE_WIN32U_PRIVATE
 
-#include "winuser.h"
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "ntgdi.h"
+#include "ntuser.h"
 #include "wine/gdi_driver.h"
 #include "wine/unixlib.h"
+#include "wine/debug.h"
 
 struct user_callbacks
 {
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
new file mode 100644
index 00000000000..03065c1a00a
--- /dev/null
+++ b/dlls/win32u/window.c
@@ -0,0 +1,50 @@
+/*
+ * Window related functions
+ *
+ * Copyright 1993, 1994 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#if 0
+#pragma makedep unix
+#endif
+
+#include "win32u_private.h"
+#include "wine/server.h"
+
+
+/*****************************************************************************
+ *           NtUserGetLayeredWindowAttributes (win32u.@)
+ */
+BOOL WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags )
+{
+    BOOL ret;
+
+    SERVER_START_REQ( get_window_layered_info )
+    {
+        req->handle = wine_server_user_handle( hwnd );
+        if ((ret = !wine_server_call_err( req )))
+        {
+            if (key) *key = reply->color_key;
+            if (alpha) *alpha = reply->alpha;
+            if (flags) *flags = reply->flags;
+        }
+    }
+    SERVER_END_REQ;
+
+    return ret;
+}
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index 8cf27d47aad..7c6f00afe66 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -92,6 +92,7 @@
     SYSCALL_ENTRY( NtUserCloseWindowStation ) \
     SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
     SYSCALL_ENTRY( NtUserCreateWindowStation ) \
+    SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
     SYSCALL_ENTRY( NtUserGetObjectInformation ) \
     SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
     SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index b497b0edbdf..c33ab4e4dff 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -155,3 +155,13 @@ NTSTATUS WINAPI wow64_NtUserSetObjectInformation( UINT *args )
 
     return NtUserSetObjectInformation( handle, index, info, len );
 }
+
+NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
+{
+    HWND hwnd = get_handle( &args );
+    COLORREF *key = get_ptr( &args );
+    BYTE *alpha = get_ptr( &args );
+    DWORD *flags = get_ptr( &args );
+
+    return NtUserGetLayeredWindowAttributes( hwnd, key, alpha, flags );
+}
diff --git a/include/ntuser.h b/include/ntuser.h
index daac994c84d..a9b2ae65dad 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -30,6 +30,7 @@ HDESK   WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d
                                       ULONG heap_size );
 HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
                                           ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
+BOOL    WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags );
 BOOL    WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info,
                                            DWORD len, DWORD *needed );
 HWINSTA WINAPI NtUserGetProcessWindowStation(void);




More information about the wine-cvs mailing list