server: Support passing a handle to get_console_wait_event.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-12-12 11:46:39 +01:00
parent 2d0e8ff672
commit 4118697829
6 changed files with 25 additions and 10 deletions

View File

@ -310,7 +310,7 @@ HANDLE WINAPI GetConsoleInputWaitHandle(void)
SERVER_START_REQ(get_console_wait_event)
{
if (!wine_server_call_err( req ))
console_wait_event = wine_server_ptr_handle( reply->handle );
console_wait_event = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
}

View File

@ -1922,12 +1922,12 @@ struct attach_console_reply
struct get_console_wait_event_request
{
struct request_header __header;
char __pad_12[4];
obj_handle_t handle;
};
struct get_console_wait_event_reply
{
struct reply_header __header;
obj_handle_t handle;
obj_handle_t event;
char __pad_12[4];
};
@ -6702,6 +6702,6 @@ union generic_reply
struct resume_process_reply resume_process_reply;
};
#define SERVER_PROTOCOL_VERSION 593
#define SERVER_PROTOCOL_VERSION 594
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1905,14 +1905,26 @@ static int cgwe_enum( struct process* process, void* user)
DECL_HANDLER(get_console_wait_event)
{
struct console_input* console = NULL;
struct object *obj;
if (current->process->console)
console = (struct console_input*)grab_object( (struct object*)current->process->console );
if (req->handle)
{
if (!(obj = get_handle_obj( current->process, req->handle, FILE_READ_PROPERTIES, NULL ))) return;
if (obj->ops == &console_input_ops)
console = (struct console_input *)grab_object( obj );
else if (obj->ops == &screen_buffer_ops)
console = (struct console_input *)grab_object( ((struct screen_buffer *)obj)->input );
else
set_error( STATUS_OBJECT_TYPE_MISMATCH );
release_object( obj );
}
else if (current->process->console)
console = (struct console_input *)grab_object( current->process->console );
else enum_processes(cgwe_enum, &console);
if (console)
{
reply->handle = alloc_handle( current->process, console->event, EVENT_ALL_ACCESS, 0 );
reply->event = alloc_handle( current->process, console->event, EVENT_ALL_ACCESS, 0 );
release_object( console );
}
else set_error( STATUS_INVALID_PARAMETER );

View File

@ -1532,8 +1532,9 @@ struct console_renderer_event
/* Get the input queue wait event */
@REQ(get_console_wait_event)
obj_handle_t handle; /* handle to the console */
@REPLY
obj_handle_t handle;
obj_handle_t event;
@END
/* Get a console mode (input or output) */

View File

@ -1144,8 +1144,9 @@ C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_in) == 8 );
C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_out) == 12 );
C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_err) == 16 );
C_ASSERT( sizeof(struct attach_console_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_console_wait_event_request, handle) == 12 );
C_ASSERT( sizeof(struct get_console_wait_event_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_console_wait_event_reply, handle) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_console_wait_event_reply, event) == 8 );
C_ASSERT( sizeof(struct get_console_wait_event_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_console_mode_request, handle) == 12 );
C_ASSERT( sizeof(struct get_console_mode_request) == 16 );

View File

@ -2031,11 +2031,12 @@ static void dump_attach_console_reply( const struct attach_console_reply *req )
static void dump_get_console_wait_event_request( const struct get_console_wait_event_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_get_console_wait_event_reply( const struct get_console_wait_event_reply *req )
{
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, " event=%04x", req->event );
}
static void dump_get_console_mode_request( const struct get_console_mode_request *req )