Hello ,
This bug occurs to chess.net client application and may be some others.
I've debugged a problem with CreateProcess where parent process overrides child process' stdin, stderr, stdout handles.
It can be done like this (portion of a code)
// Override siStartInfo.dwFlags = STARTF_USESTDHANDLES;
// Create the child process.
if (!CreateProcess("child.exe", "child.exe", // command line NULL, // process security attributes NULL, // primary thread security attributes TRUE, // handles are inherited DETACHED_PROCESS, // creation flags NULL, // use parent's environment NULL, // use parent's current directory &siStartInfo, // STARTUPINFO pointer &piProcInfo)) // receives PROCESS_INFORMATION ErrorExit("Create process failed");
The bug in Wine is the following lines of scheduler/process.c
else if (!(main_create_flags & (DETACHED_PROCESS|CREATE_NEW_CONSOLE))) { SetStdHandle( STD_INPUT_HANDLE, current_startupinfo.hStdInput ); SetStdHandle( STD_OUTPUT_HANDLE, current_startupinfo.hStdOutput ); SetStdHandle( STD_ERROR_HANDLE, current_startupinfo.hStdError ); }
You see it does not allow any std handles overriding if main_create_flags' DETACHED_PROCESS or CREATE_NEW_CONSOLE bit is set on, which is partially wrong in Windows. Cause it doesn't take in account siStartInfo.dwFlags=STARTF_USESTDHANDLES, which requires overriding.
The full proof of a bug is included, test it on Windows. It may be used as on of wine tests, if you need that.
The bug seems to be easy to fix but to the wine server / client process creation insider.
I'm not sure what will be better to you fix it yourself, or guide me how to do it in the most proper way.