it appeared (thanks Igor for all the testings and traces) that after terminate_process request was issued, the client/server pipe got closed because the running thread was actually killed, erasing the exit_code that terminate_process had set.
This patch actually fixes it.
A+ -- Eric Pouech
Name: tk ChangeLog: process termination was incorrectly setting exit_code License: X11 GenDate: 2003/06/08 09:27:56 UTC ModifiedFiles: server/thread.h server/process.c server/thread.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/server/thread.h,v retrieving revision 1.52 diff -u -u -r1.52 thread.h --- server/thread.h 4 Apr 2003 22:26:34 -0000 1.52 +++ server/thread.h 8 Jun 2003 09:25:01 -0000 @@ -37,6 +37,7 @@ enum run_state { RUNNING, /* running normally */ + TERMINATING,/* being terminated */ TERMINATED /* terminated */ }; @@ -82,7 +83,7 @@ struct fd *request_fd; /* fd for receiving client requests */ struct fd *reply_fd; /* fd to send a reply to a client */ struct fd *wait_fd; /* fd to use to wake a sleeping client */ - enum run_state state; /* running state */ + enum run_state states; /* running state */ int attached; /* is thread attached with ptrace? */ int exit_code; /* thread exit code */ int unix_pid; /* Unix pid of client */ Index: server/process.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/server/process.c,v retrieving revision 1.104 diff -u -u -r1.104 process.c --- server/process.c 18 Mar 2003 05:04:33 -0000 1.104 +++ server/process.c 7 Jun 2003 20:36:57 -0000 @@ -688,8 +659,10 @@ while (thread) { struct thread *next = thread->proc_next; - thread->exit_code = exit_code; + if (thread->state == RUNNING) + thread->exit_code = exit_code; if (thread != skip) kill_thread( thread, 1 ); + else thread->state = TERMINATING; thread = next; } } Index: server/thread.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/server/thread.c,v retrieving revision 1.97 diff -u -u -r1.97 thread.c --- server/thread.c 4 Apr 2003 22:26:34 -0000 1.97 +++ server/thread.c 8 Jun 2003 09:27:33 -0000 @@ -589,7 +589,7 @@ /* cancel a possible previous APC with the same owner */ if (owner) thread_cancel_apc( thread, owner, system ); - if (thread->state == TERMINATED) return 0; + if (thread->state != RUNNING) return 0; if (!(apc = mem_alloc( sizeof(*apc) ))) return 0; apc->prev = queue->tail; @@ -764,12 +764,12 @@ int total = 0; for (thread = first_thread; thread; thread = thread->next) - if (thread->state != TERMINATED) total++; + if (thread->state == RUNNING) total++; if (!total || !(snapshot = mem_alloc( sizeof(*snapshot) * total ))) return NULL; ptr = snapshot; for (thread = first_thread; thread; thread = thread->next) { - if (thread->state == TERMINATED) continue; + if (thread->state != RUNNING) continue; ptr->thread = thread; ptr->count = thread->obj.refcount; ptr->priority = thread->priority; @@ -908,7 +908,7 @@ { reply->tid = get_thread_id( thread ); reply->teb = thread->teb; - reply->exit_code = (thread->state == TERMINATED) ? thread->exit_code : STILL_ACTIVE; + reply->exit_code = (thread->state == RUNNING) ? STILL_ACTIVE : thread->exit_code; reply->priority = thread->priority; reply->creation_time = thread->creation_time; reply->exit_time = thread->exit_time; @@ -936,7 +936,7 @@ if ((thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME ))) { - if (thread->state == TERMINATED) set_error( STATUS_ACCESS_DENIED ); + if (thread->state != RUNNING) set_error( STATUS_ACCESS_DENIED ); else reply->count = suspend_thread( thread ); release_object( thread ); } @@ -949,7 +949,7 @@ if ((thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME ))) { - if (thread->state == TERMINATED) set_error( STATUS_ACCESS_DENIED ); + if (thread->state != RUNNING) set_error( STATUS_ACCESS_DENIED ); else reply->count = resume_thread( thread ); release_object( thread ); }