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 bug seems to be easy to fix but to the wine server / client process creation insider.
well, it's not as easy as it seems... or straightforward I think we should inherit the handles which are not console handles when DETACHED_PROCESS and STARTF_USESTDHANDLES are jointly used.
could you try the same program but with keeping console handles and see what gives
A+