kernel32: Return standard input handle in GetConsoleInputWaitHandle.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-07-01 16:27:22 +02:00 committed by Alexandre Julliard
parent 99e6bab3ed
commit e43f51640a
2 changed files with 13 additions and 17 deletions

View file

@ -76,9 +76,6 @@ static CRITICAL_SECTION CONSOLE_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
/* FIXME: this is not thread safe */
static HANDLE console_wait_event;
/* map input records to ASCII */
static void input_records_WtoA( INPUT_RECORD *buffer, int count )
{
@ -302,16 +299,7 @@ BOOL WINAPI CloseConsoleHandle(HANDLE handle)
*/
HANDLE WINAPI GetConsoleInputWaitHandle(void)
{
if (!console_wait_event)
{
SERVER_START_REQ(get_console_wait_event)
{
if (!wine_server_call_err( req ))
console_wait_event = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
}
return console_wait_event;
return GetStdHandle( STD_INPUT_HANDLE );
}
@ -630,9 +618,6 @@ BOOL WINAPI AllocConsole(void)
return FALSE;
}
/* invalidate local copy of input event handle */
console_wait_event = 0;
GetStartupInfoA(&siCurrent);
memset(&siConsole, 0, sizeof(siConsole));

View file

@ -30,6 +30,8 @@ static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD);
static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR);
static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle);
static BOOL skip_nt;
/* DEFAULT_ATTRIB is used for all initial filling of the console.
* all modifications are made with TEST_ATTRIB so that we could check
* what has to be modified or not
@ -1267,7 +1269,6 @@ static void test_CreateFileW(void)
UNICODE_STRING string;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
BOOL skip_nt = FALSE;
for (index = 0; index < ARRAY_SIZE(cf_table); index++)
{
@ -3225,6 +3226,16 @@ static void test_FreeConsole(void)
ok(handle == INVALID_HANDLE_VALUE &&
(GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* winxp */)),
"CreateFileA failed: %u\n", GetLastError());
if (!skip_nt)
{
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );
handle = GetConsoleInputWaitHandle();
ok(handle == (HANDLE)0xdeadbeef, "GetConsoleInputWaitHandle returned %p\n", handle);
SetStdHandle( STD_INPUT_HANDLE, NULL );
handle = GetConsoleInputWaitHandle();
ok(!handle, "GetConsoleInputWaitHandle returned %p\n", handle);
}
}
static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output)