Commit 1ec0769c authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Use a direct server call instead of GetConsoleInputWaitHandle().

parent 41186978
......@@ -37,6 +37,7 @@
#include "kernelbase.h"
#include "wine/asm.h"
#include "wine/exception.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(sync);
......@@ -128,6 +129,8 @@ static BOOL get_open_object_attributes( OBJECT_ATTRIBUTES *attr, UNICODE_STRING
static HANDLE normalize_handle_if_console( HANDLE handle )
{
static HANDLE wait_event;
if ((handle == (HANDLE)STD_INPUT_HANDLE) ||
(handle == (HANDLE)STD_OUTPUT_HANDLE) ||
(handle == (HANDLE)STD_ERROR_HANDLE))
......@@ -136,9 +139,22 @@ static HANDLE normalize_handle_if_console( HANDLE handle )
/* even screen buffer console handles are waitable, and are
* handled as a handle to the console itself
*/
if (is_console_handle( handle ) && VerifyConsoleIoHandle( handle ))
handle = GetConsoleInputWaitHandle();
if (is_console_handle( handle ))
{
HANDLE event = 0;
SERVER_START_REQ( get_console_wait_event )
{
req->handle = wine_server_obj_handle( console_handle_map( handle ));
if (!wine_server_call( req )) event = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
if (event)
{
if (InterlockedCompareExchangePointer( &wait_event, event, 0 )) NtClose( event );
handle = wait_event;
}
}
return handle;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment