[PATCH 01/10] server: Debugging our own process is disallowed.

Henri Verbeet hverbeet at codeweavers.com
Sun Mar 14 15:53:19 CDT 2010


---
 dlls/kernel32/tests/debugger.c |    3 +++
 server/debugger.c              |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index d37217a..8d3a802 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -537,6 +537,9 @@ static void test_debug_loop(int argc, char **argv)
     }
 
     pid = GetCurrentProcessId();
+    ret = DebugActiveProcess(pid);
+    ok(!ret, "DebugActiveProcess() succeeded on own process.\n");
+
     get_file_name(blackbox_file);
     cmd = HeapAlloc(GetProcessHeap(), 0, strlen(argv[0]) + strlen(arguments) + strlen(blackbox_file) + 10);
     sprintf(cmd, "%s%s%08x %s", argv[0], arguments, pid, blackbox_file);
diff --git a/server/debugger.c b/server/debugger.c
index 727f3be..533347c 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -421,6 +421,7 @@ void generate_debug_event( struct thread *thread, int code, const void *arg )
 static int debugger_attach( struct process *process, struct thread *debugger )
 {
     if (process->debugger) goto error;  /* already being debugged */
+    if (debugger->process == process) goto error;
     if (!is_process_init_done( process )) goto error;  /* still starting up */
     if (list_empty( &process->thread_list )) goto error;  /* no thread running in the process */
 
-- 
1.6.4.4




More information about the wine-patches mailing list