kernelbase: Use init_console_std_handles in AttachConsole.

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-30 17:16:42 +02:00 committed by Alexandre Julliard
parent a09a268fae
commit ed83583934
6 changed files with 5 additions and 41 deletions

View File

@ -246,15 +246,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH AttachConsole( DWORD pid )
SERVER_START_REQ( attach_console )
{
req->pid = pid;
if ((ret = !wine_server_call_err( req )))
{
SetStdHandle( STD_INPUT_HANDLE, wine_server_ptr_handle( reply->std_in ));
SetStdHandle( STD_OUTPUT_HANDLE, wine_server_ptr_handle( reply->std_out ));
SetStdHandle( STD_ERROR_HANDLE, wine_server_ptr_handle( reply->std_err ));
}
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
if (ret && !(ret = init_console_std_handles())) FreeConsole();
RtlLeaveCriticalSection( &console_section );
return ret;
}

View File

@ -1858,10 +1858,6 @@ struct attach_console_request
struct attach_console_reply
{
struct reply_header __header;
obj_handle_t std_in;
obj_handle_t std_out;
obj_handle_t std_err;
char __pad_20[4];
};
@ -6355,7 +6351,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 633
#define SERVER_PROTOCOL_VERSION 634
/* ### protocol_version end ### */

View File

@ -2108,15 +2108,6 @@ DECL_HANDLER(attach_console)
if (process->console && process->console->active)
{
reply->std_in = alloc_handle( current->process, process->console, GENERIC_READ, 0 );
if (!reply->std_in) goto error;
reply->std_out = alloc_handle( current->process, process->console->active, GENERIC_WRITE, 0 );
if (!reply->std_out) goto error;
reply->std_err = alloc_handle( current->process, process->console->active, GENERIC_WRITE, 0 );
if (!reply->std_err) goto error;
current->process->console = (struct console_input *)grab_object( process->console );
current->process->console->num_proc++;
}
@ -2127,11 +2118,6 @@ DECL_HANDLER(attach_console)
release_object( process );
return;
error:
if (reply->std_in) close_handle( current->process, reply->std_in );
if (reply->std_out) close_handle( current->process, reply->std_out );
release_object( process );
}
/* set info about a console input */

View File

@ -1475,10 +1475,6 @@ enum server_fd_type
/* Attach to a other process's console */
@REQ(attach_console)
process_id_t pid; /* pid of attached console process */
@REPLY
obj_handle_t std_in; /* attached stdin */
obj_handle_t std_out; /* attached stdout */
obj_handle_t std_err; /* attached stderr */
@END

View File

@ -1112,10 +1112,6 @@ C_ASSERT( sizeof(struct alloc_console_reply) == 16 );
C_ASSERT( sizeof(struct free_console_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct attach_console_request, pid) == 12 );
C_ASSERT( sizeof(struct attach_console_request) == 16 );
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, event) == 8 );

View File

@ -2046,13 +2046,6 @@ static void dump_attach_console_request( const struct attach_console_request *re
fprintf( stderr, " pid=%04x", req->pid );
}
static void dump_attach_console_reply( const struct attach_console_reply *req )
{
fprintf( stderr, " std_in=%04x", req->std_in );
fprintf( stderr, ", std_out=%04x", req->std_out );
fprintf( stderr, ", std_err=%04x", req->std_err );
}
static void dump_get_console_wait_event_request( const struct get_console_wait_event_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
@ -4793,7 +4786,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL,
(dump_func)dump_alloc_console_reply,
NULL,
(dump_func)dump_attach_console_reply,
NULL,
(dump_func)dump_get_console_wait_event_reply,
NULL,
(dump_func)dump_get_console_input_info_reply,