Hi everybody,
I ran into a pretty serious problem. I'm trying to run a program which creates a child process. I noticed that the call to the server request init_process_done returned erroneus information about the debugger state. After some investigation, here's what I found.
I put a few fprintfs in the start_process(), wine_server_call() and send_request() functions. I also tweaked the init_process_done request to return an unsigned int equal to 0x12345678 in the reply structure just after the debugger member.
Here's what a 'normal' call to start_process() looks like
calling wine_server_call req=0x405a6ec4 wine_server_call req=0x405a6ec4 request_header.req=6 wine_server_call checkpoint 1 send_request checkpoint 1 send_request checkpoint 2 wine_server_call checkpoint 2 wine_server_call req=0x405a6ec4 wine_server_call 00 00 00 00 00 00 00 00 wine_server_call 00 00 00 00 78 56 34 12 wine_server_call returned req=0x405a6ec4 wine_server_call returned 00 00 00 00 00 00 00 00 wine_server_call returned 00 00 00 00 78 56 34 12
There is one 'checkpoint' in wine_server_call just before the call to send_request(), and one right after. There are 2 checkpoints in send_request, the first one right before the call to writev() and the second one right after.
The hex dump in the above trace is the content of the 16 first bytes of reply. Please notice the '78 56 34 12' at the end, being the extra member I added to the init_process_done_reply structure.
Here's now what the 'broken' call to start_process() looks like
calling wine_server_call req=0x40556ec4 wine_server_call req=0x40556ec4 request_header.req=6 wine_server_call checkpoint 1 send_request checkpoint 1 wine_server_call req=0x40555254 request_header.req=90 wine_server_call checkpoint 1 send_request checkpoint 1 send_request checkpoint 2 wine_server_call checkpoint 2 wine_server_call req=0x40555254 wine_server_call 00 00 00 00 00 00 00 00 wine_server_call 00 00 00 00 78 56 34 12 wine_server_call req=0x4055601c request_header.req=90 wine_server_call checkpoint 1 send_request checkpoint 1 send_request checkpoint 2 wine_server_call checkpoint 2 wine_server_call req=0x4055601c wine_server_call 00 00 00 00 00 00 00 00 wine_server_call 20 00 00 00 00 00 00 00 wine_server_call req=0x40555f2c request_header.req=94 wine_server_call checkpoint 1 send_request checkpoint 1 send_request checkpoint 2 wine_server_call checkpoint 2 wine_server_call req=0x40555f2c wine_server_call 00 00 00 00 00 00 00 00 wine_server_call 28 00 00 00 00 00 00 00 wine_server_call req=0x4055607c request_header.req=20 wine_server_call checkpoint 1 send_request checkpoint 1 wine_server_call checkpoint 2 wine_server_call req=0x4055607c wine_server_call 34 00 00 c0 00 00 00 00 wine_server_call ff ff ff ff 00 00 00 00 send_request checkpoint 2 wine_server_call checkpoint 2 wine_server_call req=0x40556ec4 wine_server_call 00 00 00 00 00 00 00 00 wine_server_call ff ff ff ff 00 00 00 00 wine_server_call returned req=0x40556ec4 wine_server_call returned 00 00 00 00 00 00 00 00 wine_server_call returned ff ff ff ff 00 00 00 00
As you can see, the call to writev() seems to trigger something registry-related (90 is open_key, 94 is get_key_value and 20 is close_handle).
I have absolutely no idea about where those calls come from (Wine internal registry calls or external calls). Remember that there are two processes running, start_process() being called for the second one.
As you can see for the hex dump, the open_key request receives the answer of the init_process_done request !
I'm completely clueless about that problem. If someone has any idea, or needs more information, please send me a mail.
Laurent Pinchart
Hi,
I finally manage to understand where the problem comes from. And unfortunately there's a pretty serious inter process communication problem.
CreateProcess waits until the child process initialization is done. This is handled by the server, which receives a init_process_done request from the child process, and then 'wakes' the parent process.
My parent process calls SetThreadContext right after CreateProcess returns. Unfortunately, that's done in the middle of a wine server call from the child process (after it has sent the init_process_done request, but before he has read the reply). This causes some other server calls to be made, and a desynchronization to occur.
I'll try to have a look at the code to find a way to fix that. As I don't have a global view of all the wine architecture, I'll probably forget a lot of side effects, so I'd appreciate very much if someone more experienced than me could give me a few advices.
Thanks in advance.
Laurent Pinchart