From: Rémi Bernon rbernon@codeweavers.com
--- server/hook.c | 6 +++--- server/protocol.def | 1 + server/queue.c | 20 +++++++++++++++++++- server/user.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/server/hook.c b/server/hook.c index c22e3748b8b..aff3a5b12b6 100644 --- a/server/hook.c +++ b/server/hook.c @@ -463,7 +463,7 @@ DECL_HANDLER(set_hook) hook->module = module; hook->module_size = module_size; reply->handle = hook->handle; - reply->active_hooks = get_active_hooks(); + reply->active_hooks = set_queue_active_hooks( current ); } else free( module );
@@ -501,7 +501,7 @@ DECL_HANDLER(remove_hook) } } remove_hook( hook ); - reply->active_hooks = get_active_hooks(); + reply->active_hooks = set_queue_active_hooks( current ); }
@@ -518,7 +518,7 @@ DECL_HANDLER(start_hook_chain) return; }
- reply->active_hooks = get_active_hooks(); + reply->active_hooks = set_queue_active_hooks( current );
if (!table || !(hook = get_first_valid_hook( table, req->id - WH_MINHOOK, req->event, req->window, req->object_id, req->child_id ))) diff --git a/server/protocol.def b/server/protocol.def index d200dfc7528..c20137a05f1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -916,6 +916,7 @@ typedef volatile struct typedef volatile struct { obj_handle_t handle; /* handle to the queue */ + unsigned int active_hooks; /* active hooks bitmap */ } queue_shm_t;
typedef volatile union diff --git a/server/queue.c b/server/queue.c index 60c9b98dec8..cd6ab1bccdc 100644 --- a/server/queue.c +++ b/server/queue.c @@ -333,6 +333,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ SHARED_WRITE_BEGIN( queue->shared, queue_shm_t ) { shared->handle = handle; + shared->active_hooks = 0; } SHARED_WRITE_END;
@@ -631,6 +632,23 @@ void set_queue_hooks( struct thread *thread, struct hook_table *hooks ) queue->hooks = hooks; }
+/* update the thread message queue active hooks bitmap */ +unsigned int set_queue_active_hooks( struct thread *thread ) +{ + unsigned int active_hooks = get_active_hooks(); + + if (thread->queue) + { + SHARED_WRITE_BEGIN( thread->queue->shared, queue_shm_t ) + { + shared->active_hooks = active_hooks; + } + SHARED_WRITE_END; + } + + return active_hooks; +} + /* check the queue status */ static inline int is_signaled( struct msg_queue *queue ) { @@ -3092,7 +3110,7 @@ DECL_HANDLER(get_message) user_handle_t get_win = get_user_full_handle( req->get_win ); unsigned int filter = req->flags >> 16;
- reply->active_hooks = get_active_hooks(); + reply->active_hooks = set_queue_active_hooks( current );
if (get_win && get_win != 1 && get_win != -1 && !get_user_object( get_win, USER_WINDOW )) { diff --git a/server/user.h b/server/user.h index 99491293a7c..3d7dcce6e13 100644 --- a/server/user.h +++ b/server/user.h @@ -114,6 +114,7 @@ extern struct thread *get_first_global_hook( struct desktop *desktop, int id ); extern void free_msg_queue( struct thread *thread ); extern struct hook_table *get_queue_hooks( struct thread *thread ); extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks ); +extern unsigned int set_queue_active_hooks( struct thread *thread ); extern void inc_queue_paint_count( struct thread *thread, int incr ); extern void queue_cleanup_window( struct thread *thread, user_handle_t win ); extern int init_thread_queue( struct thread *thread );