server: Don't run low-level hooks in debugged processes.

This commit is contained in:
Alexandre Julliard 2011-04-05 11:12:57 +02:00
parent bb411cfb65
commit 437a838470
1 changed files with 12 additions and 13 deletions

View File

@ -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,