Jacek Caban (@jacek) commented about dlls/kernelbase/process.c:
TRACE( "PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE %p reference %p\n", console, console->reference ); params->ConsoleHandle = console->reference; + if (!(flags & DETACHED_PROCESS)) + { + params->ConsoleFlags |= 2; + /* don't inherit standard handles bound to parent console (but inherit the others) */ + if (!(startup_info->dwFlags & STARTF_USESTDHANDLES)) + { + DWORD mode; + if (GetConsoleMode(params->hStdInput, &mode)) params->hStdInput = NULL; + if (GetConsoleMode(params->hStdOutput, &mode)) params->hStdOutput = NULL; + if (GetConsoleMode(params->hStdError, &mode)) params->hStdError = NULL;
For non-console handles this will set last error. I’m not sure if that’s a problem, but https://gitlab.winehq.org/jacek/wine/-/commit/32e39c819be6a2a2a0c03047175cb8... also passes the tests. It’s not exactly the same, though, what do you think? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9500#note_122762