<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>&nbsp;</div>
<div><span class="gmail_quote">2006/12/20, Robert Reif &lt;<a href="mailto:reif@earthlink.net">reif@earthlink.net</a>&gt;:</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.&nbsp;&nbsp;It<br>appears that in wine, GetStdHandle(STD_INPUT_HANDLE) doesn&#39;t return a
<br>handle to a console so GetConsoleMode() on that handle fails.&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10 Oct 2006 18:19:57 -0000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.2<br>+++ dlls/kernel32/tests/console.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20 Dec 2006 07:20:06 -0000<br>@@ -552,12 +552,31 @@ static void testCtrlHandler(void)
<br>&nbsp;&nbsp;&nbsp;&nbsp;ok(GetLastError() == ERROR_INVALID_PARAMETER, &quot;Bad error %u\n&quot;, GetLastError());<br>}<br><br>+static void test(void)<br>+{<br>+&nbsp;&nbsp;&nbsp;&nbsp;HANDLE std_input;<br>+&nbsp;&nbsp;&nbsp;&nbsp;DWORD saved_mode;<br>+<br>+&nbsp;&nbsp;&nbsp;&nbsp;std_input = GetStdHandle(STD_INPUT_HANDLE);
<br>+&nbsp;&nbsp;&nbsp;&nbsp;ok(std_input != INVALID_HANDLE_VALUE,<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;GetStdHandle(STD_INPUT_HANDLE) returned INVALID_HANDLE_VALUE\n&quot;);<br>+<br>+&nbsp;&nbsp;&nbsp;&nbsp;if (std_input != INVALID_HANDLE_VALUE)<br>+&nbsp;&nbsp;&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BOOL status;
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status = GetConsoleMode(std_input, &amp;saved_mode);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ok(status != FALSE, &quot;GetConsoleMode() failed: %08x\n&quot;, GetLastError());<br>+&nbsp;&nbsp;&nbsp;&nbsp;}<br>+}<br>+<br>START_TEST(console)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;HANDLE hConIn, hConOut;
<br>&nbsp;&nbsp;&nbsp;&nbsp;BOOL ret;<br>&nbsp;&nbsp;&nbsp;&nbsp;CONSOLE_SCREEN_BUFFER_INFO sbi;<br><br>+&nbsp;&nbsp;&nbsp;&nbsp;test();<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp;/* be sure we have a clean console (and that&#39;s our own)<br>&nbsp;&nbsp;&nbsp;&nbsp; * FIXME: this will make the test fail (currently) if we don&#39;t run
<br>&nbsp;&nbsp;&nbsp;&nbsp; * under X11<br><br><br><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Eric Pouech