http://bugs.winehq.org/show_bug.cgi?id=28192
--- Comment #2 from Jason Edmeades us@edmeades.me.uk 2012-11-27 15:48:37 CST --- Looking into this I would say there's a two problems here:
[This bug] - Under windows, a GUI program is not attached (by default) to a console But you can redirect stdout / stderr to a file, so I think its more that the program is launched without the stdout/stderr being attached to anything - Under wine, anything you launch can write to the console, which is the launching window
[Bug 17124] - Under windows, createprocess for an application flagged as a CUI app will spawn a new console, if one is not attached to the process - even if the CreateProcess call does not specify CREATE_NEW_CONSOLE - Under wine, if you do not specify create new console, you run in the existing console meaning it interleaves with the spawning application
Note that a GUI app can call AllocConsole to allocate itself a console (a new one) if the application does not have one. In my limited testing it appears to pop up a DOS type window (on windows). It would appear that a GUI app which has called AllocConsole, which subsequently spawns a CUI application, passes the allocated console to the spawned CUI app.
I think (A) in Eric's comment#1 is the only option, and we also need to do the reverse (bug#17124). Simple testing implies if a command app running in cmd.exe spawns a gui app using createprocess, then the created process has no stdout capability to the console, ie its createprocess not cmd which does it.