http://bugs.winehq.org/show_bug.cgi?id=10827
Summary: No input/output after AllocConsole Product: Wine Version: 0.9.50. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: wine-console AssignedTo: wine-bugs@winehq.org ReportedBy: reijo.sund@helsinki.fi
Created an attachment (id=9694) --> (http://bugs.winehq.org/attachment.cgi?id=9694) pro1.c - simple source that demonstrates the AllocConsole problem
MSDN library includes sample code for console applications (http://msdn2.microsoft.com/en-us/library/aa263818.aspx). The source is available at: http://www.helsinki.fi/~sund/console_vs6.zip . The source compiles easily with winelib after --cuiexe transformations with winemaker.
The first example is about freeing and allocating a new console. These are basic operations that each reasonable console application should perform.
The problem with wine is that input and output for console are disabled after a (second) call to AllocConsole. That makes most interactive console applications unusable.
The problem can be replicated by running the sample code application with wineconsole, and by selecting the first example from the list.
To make even easier replication possible, I have attached a simple source that demonstrates the problem (works smoothly in Windows). I used the following commands to compile the attached source: export LD_LIBRARY_PATH=$WINE/library:$WINE/unicode winegcc -c -I$WINE/include -o pro1.o pro1.c winegcc -L$WINE/dlls -luser32 -lgdi32 -ladvapi32 -lkernel32 -lddraw -ldsound -lwinmm -o pro1.exe pro1.o
http://bugs.winehq.org/show_bug.cgi?id=10827
Kirill K. Smirnov lich@math.spbu.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |lich@math.spbu.ru
--- Comment #1 from Kirill K. Smirnov lich@math.spbu.ru 2007-12-19 16:00:06 --- MSDN and your example are a bit buggy...
AllocConsole modifies standard io handles, so programmer must re-get them using GetStdHandle. (MSDN example updates only OUTPUT, and you forgot to update both of them when you call AllocConsole last time).
[Un]fortunately Windows generates new console handles equal to the old ones, so it is very easy to forget to update them. This behaviour is undocumented but widely used.
I've send three patches to fix this, two of them are already applied. http://www.winehq.org/pipermail/wine-patches/2007-December/048106.html http://www.winehq.org/pipermail/wine-patches/2007-December/048062.html http://www.winehq.org/pipermail/wine-patches/2007-December/048148.html
And the last but not the least: it is dangerous to run console application using 'wineconsole' directly, because it tells system to use predefined io handles (using STARTUPINFO). Applications should be run using 'start' utility.
Dangerous to say: $ wineconsole app.exe use instead: $ wine start app.exe
http://bugs.winehq.org/show_bug.cgi?id=10827
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #2 from Dan Kegel dank@kegel.com 2007-12-24 10:34:47 --- It should not be neccessary to use wineconsole or start to run plain old console apps.
http://bugs.winehq.org/show_bug.cgi?id=10827
--- Comment #3 from Kirill K. Smirnov lich@math.spbu.ru 2007-12-24 11:04:30 ---
It should not be neccessary to use wineconsole or start to run plain old console apps.
Yes, I mean 'wine start' is supposed to be used with complicated (which use AllocConsole/FreeConsole and screen buffers) applications ONLY. Just 'wine a.exe' is enough for simple apps.
http://bugs.winehq.org/show_bug.cgi?id=10827
Reijo Sund reijo.sund@helsinki.fi changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED Version|0.9.50. |0.9.51.
--- Comment #4 from Reijo Sund reijo.sund@helsinki.fi 2007-12-27 08:54:11 --- Those patches fixed the problem. Thanks!
As the patches are checked into the tree and tested, I change resolution to fixed.
http://bugs.winehq.org/show_bug.cgi?id=10827
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|0.9.51. |0.9.50.
--- Comment #5 from Vitaliy Margolen vitaliy@kievinfo.com 2007-12-27 09:26:20 --- Don't change Wine version.
http://bugs.winehq.org/show_bug.cgi?id=10827
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|_obsolete_console |-unknown
http://bugs.winehq.org/show_bug.cgi?id=10827
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Dan Kegel dank@kegel.com 2008-01-28 06:09:17 --- Closing all RESOLVED FIXED bugs older than 0.9.54.