<div>if you move the test() call a couple of lines below, when the console is actually created, it should work.</div>
<div>for the actual program to run, you should use wineconsole.</div>
<div>A+<br><br> </div>
<div><span class="gmail_quote">2006/12/20, Robert Reif <<a href="mailto:reif@earthlink.net">reif@earthlink.net</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I get an error when running a windows console program on wine. It<br>appears that in wine, GetStdHandle(STD_INPUT_HANDLE) doesn't return a
<br>handle to a console so GetConsoleMode() on that handle fails. The<br>actual programs that fail are at: <a href="http://simh.trailing-edge.com/">http://simh.trailing-edge.com/</a><br><br>Here is a simple patch to kernel32/tests/console.c to demonstrate the
<br>problem:<br><br><br><br><br>diff -p -u -r1.2 console.c<br>--- dlls/kernel32/tests/console.c 10 Oct 2006 18:19:57 -0000 1.2<br>+++ dlls/kernel32/tests/console.c 20 Dec 2006 07:20:06 -0000<br>@@ -552,12 +552,31 @@ static void testCtrlHandler(void)
<br> ok(GetLastError() == ERROR_INVALID_PARAMETER, "Bad error %u\n", GetLastError());<br>}<br><br>+static void test(void)<br>+{<br>+ HANDLE std_input;<br>+ DWORD saved_mode;<br>+<br>+ std_input = GetStdHandle(STD_INPUT_HANDLE);
<br>+ ok(std_input != INVALID_HANDLE_VALUE,<br>+ "GetStdHandle(STD_INPUT_HANDLE) returned INVALID_HANDLE_VALUE\n");<br>+<br>+ if (std_input != INVALID_HANDLE_VALUE)<br>+ {<br>+ BOOL status;
<br>+ status = GetConsoleMode(std_input, &saved_mode);<br>+ ok(status != FALSE, "GetConsoleMode() failed: %08x\n", GetLastError());<br>+ }<br>+}<br>+<br>START_TEST(console)<br>{<br> HANDLE hConIn, hConOut;
<br> BOOL ret;<br> CONSOLE_SCREEN_BUFFER_INFO sbi;<br><br>+ test();<br>+<br> /* be sure we have a clean console (and that's our own)<br> * FIXME: this will make the test fail (currently) if we don't run
<br> * under X11<br><br><br><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Eric Pouech