From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index e6b2ab298f9..a696ce9cd08 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -327,26 +327,19 @@ HWND is_current_process_window( HWND hwnd ) /* see IsWindow */ BOOL is_window( HWND hwnd ) { - WND *win; - BOOL ret; + struct object_lock lock = OBJECT_LOCK_INIT; + const session_shm_t *session_shm; + BOOL ret = FALSE; + UINT status;
- if (!(win = get_win_ptr( hwnd ))) return FALSE; - if (win == WND_DESKTOP) return TRUE; + if (!hwnd) return FALSE;
- 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 );
- /* 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; + if (status) RtlSetLastWin32Error( RtlNtStatusToDosError( status ) ); + else if (!ret) RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); + return !status && ret; }
/* see GetWindowThreadProcessId */