From 437a838470af2f1ba57c7cce16618d0bfc9fdf19 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 5 Apr 2011 11:12:57 +0200 Subject: [PATCH] server: Don't run low-level hooks in debugged processes. --- server/hook.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/server/hook.c b/server/hook.c index c9df5d37d39..180ddf10714 100644 --- a/server/hook.c +++ b/server/hook.c @@ -191,19 +191,6 @@ static inline struct hook *get_first_hook( struct hook_table *table, int index ) return elem ? HOOK_ENTRY( elem ) : NULL; } -/* check if a given hook should run in the current thread */ -static inline int run_hook_in_current_thread( struct hook *hook ) -{ - if ((!hook->process || hook->process == current->process) && - (!(hook->flags & WINEVENT_SKIPOWNPROCESS) || hook->process != current->process)) - { - if ((!hook->thread || hook->thread == current) && - (!(hook->flags & WINEVENT_SKIPOWNTHREAD) || hook->thread != current)) - return 1; - } - return 0; -} - /* check if a given hook should run in the owner thread instead of the current thread */ static inline int run_hook_in_owner_thread( struct hook *hook ) { @@ -213,6 +200,18 @@ static inline int run_hook_in_owner_thread( struct hook *hook ) return 0; } +/* check if a given hook should run in the current thread */ +static inline int run_hook_in_current_thread( struct hook *hook ) +{ + if (hook->process && hook->process != current->process) return 0; + if ((hook->flags & WINEVENT_SKIPOWNPROCESS) && hook->process == current->process) return 0; + if (hook->thread && hook->thread != current) return 0; + if ((hook->flags & WINEVENT_SKIPOWNTHREAD) && hook->thread == current) return 0; + /* don't run low-level hooks in debugged processes */ + if (run_hook_in_owner_thread( hook ) && hook->owner->process->debugger) return 0; + return 1; +} + /* find the first non-deleted hook in the chain */ static inline struct hook *get_first_valid_hook( struct hook_table *table, int index, int event, user_handle_t win, -- 2.11.4.GIT