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
70dd64cf
Commit
70dd64cf
authored
Aug 30, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add a helper function to validate a window handle.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c6f12bd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
37 deletions
+19
-37
clipboard.c
server/clipboard.c
+9
-33
queue.c
server/queue.c
+2
-4
user.h
server/user.h
+8
-0
No files found.
server/clipboard.c
View file @
70dd64cf
...
...
@@ -258,15 +258,11 @@ static int get_seqno( struct clipboard *clipboard )
DECL_HANDLER
(
open_clipboard
)
{
struct
clipboard
*
clipboard
=
get_process_clipboard
();
user_handle_t
win
=
req
->
window
;
user_handle_t
win
=
0
;
if
(
!
clipboard
)
return
;
if
(
req
->
window
&&
!
(
win
=
get_valid_window_handle
(
req
->
window
)))
return
;
if
(
win
&&
!
get_user_object_handle
(
&
win
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
clipboard
->
open_thread
&&
clipboard
->
open_win
!=
win
)
{
set_error
(
STATUS_INVALID_LOCK_SEQUENCE
);
...
...
@@ -363,21 +359,11 @@ DECL_HANDLER(get_clipboard_info)
DECL_HANDLER
(
set_clipboard_viewer
)
{
struct
clipboard
*
clipboard
=
get_process_clipboard
();
user_handle_t
viewer
=
req
->
viewer
;
user_handle_t
previous
=
req
->
previous
;
user_handle_t
viewer
=
0
,
previous
=
0
;
if
(
!
clipboard
)
return
;
if
(
viewer
&&
!
get_user_object_handle
(
&
viewer
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
previous
&&
!
get_user_object_handle
(
&
previous
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
req
->
viewer
&&
!
(
viewer
=
get_valid_window_handle
(
req
->
viewer
)))
return
;
if
(
req
->
previous
&&
!
(
previous
=
get_valid_window_handle
(
req
->
previous
)))
return
;
reply
->
old_viewer
=
clipboard
->
viewer
;
reply
->
owner
=
clipboard
->
owner_win
;
...
...
@@ -393,15 +379,10 @@ DECL_HANDLER(set_clipboard_viewer)
DECL_HANDLER
(
add_clipboard_listener
)
{
struct
clipboard
*
clipboard
=
get_process_clipboard
();
user_handle_t
win
=
req
->
window
;
user_handle_t
win
;
if
(
!
clipboard
)
return
;
if
(
!
get_user_object_handle
(
&
win
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
!
(
win
=
get_valid_window_handle
(
req
->
window
)))
return
;
add_listener
(
clipboard
,
win
);
}
...
...
@@ -411,15 +392,10 @@ DECL_HANDLER(add_clipboard_listener)
DECL_HANDLER
(
remove_clipboard_listener
)
{
struct
clipboard
*
clipboard
=
get_process_clipboard
();
user_handle_t
win
=
req
->
window
;
user_handle_t
win
;
if
(
!
clipboard
)
return
;
if
(
!
get_user_object_handle
(
&
win
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
!
(
win
=
get_valid_window_handle
(
req
->
window
)))
return
;
if
(
!
remove_listener
(
clipboard
,
win
))
set_error
(
STATUS_INVALID_PARAMETER
);
}
server/queue.c
View file @
70dd64cf
...
...
@@ -2685,10 +2685,9 @@ DECL_HANDLER(register_hotkey)
if
(
win_handle
)
{
if
(
!
get_user_object_handle
(
&
win_handle
,
USER_WINDOW
))
if
(
!
(
win_handle
=
get_valid_window_handle
(
win_handle
)
))
{
release_object
(
desktop
);
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
...
...
@@ -2754,10 +2753,9 @@ DECL_HANDLER(unregister_hotkey)
if
(
win_handle
)
{
if
(
!
get_user_object_handle
(
&
win_handle
,
USER_WINDOW
))
if
(
!
(
win_handle
=
get_valid_window_handle
(
win_handle
)
))
{
release_object
(
desktop
);
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
...
...
server/user.h
View file @
70dd64cf
...
...
@@ -207,4 +207,12 @@ static inline int intersect_rect( rectangle_t *dst, const rectangle_t *src1, con
return
(
dst
->
left
<
dst
->
right
&&
dst
->
top
<
dst
->
bottom
);
}
/* validate a window handle and return the full handle */
static
inline
user_handle_t
get_valid_window_handle
(
user_handle_t
win
)
{
if
(
get_user_object_handle
(
&
win
,
USER_WINDOW
))
return
win
;
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
0
;
}
#endif
/* __WINE_SERVER_USER_H */
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