From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 6c29cda990c..b8585367313 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -325,25 +325,16 @@ HWND is_current_process_window( HWND hwnd ) /* see IsWindow */ BOOL is_window( HWND hwnd ) { - WND *win; - BOOL ret; - - if (!(win = get_win_ptr( hwnd ))) return FALSE; - if (win == WND_DESKTOP) return TRUE; + struct object_lock lock = OBJECT_LOCK_INIT; + const session_shm_t *session_shm; + BOOL ret = FALSE; + UINT status;
- if (win != WND_OTHER_PROCESS) - { - release_win_ptr( win ); - return TRUE; - } + while ((status = get_shared_session( &lock, &session_shm )) == STATUS_PENDING) + ret = !!get_session_entry( session_shm, hwnd, NTUSER_OBJ_WINDOW ); + if (status) ret = FALSE;
- /* 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; + if (!ret) RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return ret; }