Unconditionally open a fresh console for the tests.

This commit is contained in:
Ferenc Wagner 2004-10-08 23:35:47 +00:00 committed by Alexandre Julliard
parent 120009e9b4
commit cbf4c5c650
1 changed files with 3 additions and 8 deletions

View File

@ -565,17 +565,12 @@ START_TEST(console)
* the curses backend * the curses backend
*/ */
hConIn = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); /* first, we detach and open a fresh console to play with */
hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); FreeConsole();
/* first, we need to be sure we're attached to a console */
if (hConIn == INVALID_HANDLE_VALUE || hConOut == INVALID_HANDLE_VALUE)
{
/* we're not attached to a console, let's do it */
AllocConsole(); AllocConsole();
hConIn = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); hConIn = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
}
/* now verify everything's ok */ /* now verify everything's ok */
ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn\n"); ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn\n");
ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut\n"); ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut\n");