Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
82572350
Commit
82572350
authored
Feb 08, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Don't allow orphaned windows in set_parent request.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ce3abc22
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
win.c
dlls/user32/tests/win.c
+0
-3
win.c
dlls/user32/win.c
+1
-1
window.c
server/window.c
+9
-1
No files found.
dlls/user32/tests/win.c
View file @
82572350
...
...
@@ -865,16 +865,13 @@ static void test_thread_exit_destroy(void)
SetLastError
(
0xdeadbeef
);
tmp
=
SetParent
(
child1
,
adopter
);
ok
(
tmp
==
0
,
"SetParent returned %p
\n
"
,
tmp
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
tmp
=
SetParent
(
child3
,
adopter
);
ok
(
tmp
==
0
,
"SetParent returned %p
\n
"
,
tmp
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
tmp
=
GetParent
(
child1
);
todo_wine
ok
(
tmp
==
params
.
hwnd
,
"GetParent returned %p, error %u
\n
"
,
tmp
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"GetWindowLongW error %u
\n
"
,
GetLastError
()
);
...
...
dlls/user32/win.c
View file @
82572350
...
...
@@ -3374,7 +3374,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
{
req
->
handle
=
wine_server_user_handle
(
hwnd
);
req
->
parent
=
wine_server_user_handle
(
parent
);
if
((
ret
=
!
wine_server_call
(
req
)))
if
((
ret
=
!
wine_server_call
_err
(
req
)))
{
old_parent
=
wine_server_ptr_handle
(
reply
->
old_parent
);
wndPtr
->
parent
=
parent
=
wine_server_ptr_handle
(
reply
->
full_parent
);
...
...
server/window.c
View file @
82572350
...
...
@@ -200,6 +200,14 @@ static inline int is_desktop_window( const struct window *win )
return
!
win
->
parent
;
/* only desktop windows have no parent */
}
/* check if window is orphaned */
static
int
is_orphan_window
(
struct
window
*
win
)
{
do
if
(
!
win
->
handle
)
return
1
;
while
((
win
=
win
->
parent
));
return
0
;
}
/* get next window in Z-order list */
static
inline
struct
window
*
get_next_window
(
struct
window
*
win
)
{
...
...
@@ -2066,7 +2074,7 @@ DECL_HANDLER(set_parent)
if
(
!
(
win
=
get_window
(
req
->
handle
)))
return
;
if
(
req
->
parent
&&
!
(
parent
=
get_window
(
req
->
parent
)))
return
;
if
(
is_desktop_window
(
win
))
if
(
is_desktop_window
(
win
)
||
is_orphan_window
(
win
)
||
(
parent
&&
is_orphan_window
(
parent
))
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment