Alex Henrie alexhenrie24@gmail.com writes:
@@ -2572,7 +2572,7 @@ static void test_ReadConsoleOutputAttribute(HANDLE output_handle) ok(count == 1, "Expected count to be 1, got %u\n", count); }
-static void test_ReadConsole(void) +static void test_ReadConsole(HANDLE input_handle) { HANDLE std_input; DWORD ret, bytes; @@ -2582,6 +2582,13 @@ static void test_ReadConsole(void)
SetLastError(0xdeadbeef); ret = GetFileSize(std_input, NULL);
- if (GetLastError() == 0xdeadbeef)
- {
/* print a warning and cheat a little so that the tests can continue */
skip("stdin appears to be redirected; if it's not then this is an error");
std_input = input_handle;
ret = GetFileSize(std_input, NULL);
- }
I'm not sure why we'd need to use stdin at all then, we might as well always use the proper console handle.
2017-11-02 17:09 GMT+01:00 Alexandre Julliard julliard@winehq.org:
Alex Henrie alexhenrie24@gmail.com writes:
@@ -2572,7 +2572,7 @@ static void test_ReadConsoleOutputAttribute(HANDLE output_handle) ok(count == 1, "Expected count to be 1, got %u\n", count); }
-static void test_ReadConsole(void) +static void test_ReadConsole(HANDLE input_handle) { HANDLE std_input; DWORD ret, bytes; @@ -2582,6 +2582,13 @@ static void test_ReadConsole(void)
SetLastError(0xdeadbeef); ret = GetFileSize(std_input, NULL);
- if (GetLastError() == 0xdeadbeef)
- {
/* print a warning and cheat a little so that the tests can continue */
skip("stdin appears to be redirected; if it's not then this is an error");
std_input = input_handle;
ret = GetFileSize(std_input, NULL);
- }
I'm not sure why we'd need to use stdin at all then, we might as well always use the proper console handle.
I thought that this code was trying to test that AllocConsole had redirected stdin to the console input, which is usually (but not always) the case. Ideally there would be tests for exactly which circumstances cause AllocConsole to redirect or not redirect stdin, but I was unable to figure out Windows's internal logic here.
Anyway, if it's not important for this function to try to test that stdin is now the console input, then yes, we can just use the console input handle directly.
-Alex