Set or clear the BeingDebugged flag in the PEB when a debugger is
attached to or detached from a process.
Don't send exception events to the server unless a debugger is
present.
diff --git a/server/debugger.c b/server/debugger.c
index 5670617..e7c1b9a 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -436,6 +436,12 @@
resume_process( process );
return 0;
}
+ if (!set_process_debug_flag( process, 1 ))
+ {
+ process->debugger = NULL;
+ resume_process( process );
+ return 0;
+ }
return 1;
error:
@@ -480,8 +486,7 @@
/* remove relationships between process and its debugger */
process->debugger = NULL;
- release_object( debugger->debug_ctx );
- debugger->debug_ctx = NULL;
+ if (!set_process_debug_flag( process, 0 )) clear_error(); /* ignore error */
detach_process( process );
/* from this function */