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