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

Alexandre Julliard julliard at winehq.org
Tue Apr 5 11:23:31 CDT 2011


Module: wine
Branch: master
Commit: 437a838470af2f1ba57c7cce16618d0bfc9fdf19
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=437a838470af2f1ba57c7cce16618d0bfc9fdf19

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr  5 11:12:57 2011 +0200

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

---

 server/hook.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/server/hook.c b/server/hook.c
index c9df5d3..180ddf1 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,




More information about the wine-cvs mailing list