Le 03/08/2011 18:07, Francois Gouget a écrit :
WriteFile() checks if the handle corresponds to the console and if it
does invokes WriteConsoleA(). This barely escaped an infinite loop but
messed up the string encoding as CP_UNIXCP is usually different from
CP_ACP.
---
I noticed this issue while testing the net.exe tool. After making it
use WineConsole() I was getting the following outputs:
$ wine net stop
Spécifie le service à arrêter.
$ ./wine net stop | cat
Sp├®cifie le service ├á arr├¬ter.
It turns out that it's because we only get through the WineConsoleW() ->
WriteFile() -> WriteConsoleA() loop in the second case.
could you elaborate a bit more. in case of wine ... | cat, the standard
output should be a pipe not a console
so writeconsoleW is supposed to fail
so it would make more sense to simply let WriteConsoleW fail when
is_console_handle(hConsoleOutput) is FALSE ?
(similar functions as WriteConsoleA, ReadConsoleA/W should be protected
the same way)
A+
--
Eric Pouech
"The problem with designing something completely foolproof is to underestimate the
ingenuity of a complete idiot." (Douglas Adams)