Jacek Caban : win32u: Move IsWindow implementation from user32.
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 14:17:22 CST 2022
Module: wine
Branch: master
Commit: bde39137cf4d8d392b8ca844b70b32d8ae922124
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bde39137cf4d8d392b8ca844b70b32d8ae922124
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Feb 25 16:25:30 2022 +0100
win32u: Move IsWindow 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/win.c | 21 +--------------------
dlls/win32u/gdiobj.c | 1 +
dlls/win32u/win32u.spec | 2 +-
dlls/win32u/win32u_private.h | 1 +
dlls/win32u/window.c | 40 ++++++++++++++++++++++++++++++++++++++++
dlls/win32u/wrappers.c | 6 ++++++
include/ntuser.h | 7 +++++++
7 files changed, 57 insertions(+), 21 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index cd36140e1aa..c580d040bf1 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3063,26 +3063,7 @@ INT WINAPI GetWindowTextLengthW( HWND hwnd )
*/
BOOL WINAPI IsWindow( HWND hwnd )
{
- WND *ptr;
- BOOL ret;
-
- if (!(ptr = WIN_GetPtr( hwnd ))) return FALSE;
- if (ptr == WND_DESKTOP) return TRUE;
-
- if (ptr != WND_OTHER_PROCESS)
- {
- WIN_ReleasePtr( ptr );
- return TRUE;
- }
-
- /* check other processes */
- SERVER_START_REQ( get_window_info )
- {
- req->handle = wine_server_user_handle( hwnd );
- ret = !wine_server_call_err( req );
- }
- SERVER_END_REQ;
- return ret;
+ return NtUserCallHwnd( hwnd, NtUserIsWindow );
}
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index fe22c1ed2fe..589143e99a6 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1150,6 +1150,7 @@ static struct unix_funcs unix_funcs =
NtGdiUpdateColors,
NtGdiWidenPath,
NtUserActivateKeyboardLayout,
+ NtUserCallHwnd,
NtUserCallHwndParam,
NtUserCallNextHookEx,
NtUserCallNoParam,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index f53c90990b5..0b63c43c6f6 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -768,7 +768,7 @@
@ stub NtUserBuildPropList
@ stub NtUserCalcMenuBar
@ stub NtUserCalculatePopupWindowPosition
-@ stub NtUserCallHwnd
+@ stdcall NtUserCallHwnd(long long)
@ stub NtUserCallHwndLock
@ stub NtUserCallHwndLockSafe
@ stub NtUserCallHwndOpt
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 168694378d2..e6a5105dcf5 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -183,6 +183,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
+ DWORD (WINAPI *pNtUserCallHwnd)( HWND hwnd, DWORD code );
DWORD (WINAPI *pNtUserCallHwndParam)( HWND hwnd, DWORD_PTR param, DWORD code );
LRESULT (WINAPI *pNtUserCallNextHookEx)( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam );
ULONG_PTR (WINAPI *pNtUserCallNoParam)( ULONG code );
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 985b68ff1c2..7725ba7bd53 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -247,6 +247,31 @@ HWND is_current_thread_window( HWND hwnd )
return ret;
}
+/* see IsWindow */
+static BOOL is_window( HWND hwnd )
+{
+ WND *win;
+ BOOL ret;
+
+ if (!(win = get_win_ptr( hwnd ))) return FALSE;
+ if (win == WND_DESKTOP) return TRUE;
+
+ if (win != WND_OTHER_PROCESS)
+ {
+ release_win_ptr( win );
+ return TRUE;
+ }
+
+ /* check other processes */
+ SERVER_START_REQ( get_window_info )
+ {
+ req->handle = wine_server_user_handle( hwnd );
+ ret = !wine_server_call_err( req );
+ }
+ SERVER_END_REQ;
+ return ret;
+}
+
/* see GetWindowThreadProcessId */
static DWORD get_window_thread( HWND hwnd, DWORD *process )
{
@@ -400,6 +425,21 @@ NTSTATUS WINAPI NtUserBuildHwndList( HDESK desktop, ULONG unk2, ULONG unk3, ULON
return STATUS_SUCCESS;
}
+/*****************************************************************************
+ * NtUserCallHwnd (win32u.@)
+ */
+DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
+{
+ switch (code)
+ {
+ case NtUserIsWindow:
+ return is_window( hwnd );
+ default:
+ FIXME( "invalid code %u\n", code );
+ return 0;
+ }
+}
+
/*****************************************************************************
* NtUserCallHwndParam (win32u.@)
*/
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index 4fd01459374..06af8cab20f 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -725,6 +725,12 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
return unix_funcs->pNtUserCallTwoParam( arg1, arg2, code );
}
+DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
+{
+ if (!unix_funcs) return 0;
+ return unix_funcs->pNtUserCallHwnd( hwnd, code );
+}
+
DWORD WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
{
if (!unix_funcs) return 0;
diff --git a/include/ntuser.h b/include/ntuser.h
index 70a1df91113..a899c03e66e 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -134,6 +134,12 @@ enum
NtUserSetHandlePtr,
};
+/* NtUserCallHwnd codes, not compatible with Windows */
+enum
+{
+ NtUserIsWindow,
+};
+
/* NtUserCallHwndParam codes, not compatible with Windows */
enum
{
@@ -198,6 +204,7 @@ BOOL WINAPI NtUserAddClipboardFormatListener( HWND hwnd );
BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach );
NTSTATUS WINAPI NtUserBuildHwndList( HDESK desktop, ULONG unk2, ULONG unk3, ULONG unk4,
ULONG thread_id, ULONG count, HWND *buffer, ULONG *size );
+DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code );
DWORD WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code );
LRESULT WINAPI NtUserCallNextHookEx( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam );
ULONG_PTR WINAPI NtUserCallNoParam( ULONG code );
More information about the wine-cvs
mailing list