Jacek Caban : kernelbase: Use init_console_std_handles in AttachConsole.
Alexandre Julliard
julliard at winehq.org
Thu Jul 30 15:31:26 CDT 2020
Module: wine
Branch: master
Commit: ed8358393413d52096c56e96b44ee73f15053f91
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ed8358393413d52096c56e96b44ee73f15053f91
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jul 30 17:16:42 2020 +0200
kernelbase: Use init_console_std_handles in AttachConsole.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/console.c | 9 +++------
include/wine/server_protocol.h | 6 +-----
server/console.c | 14 --------------
server/protocol.def | 4 ----
server/request.h | 4 ----
server/trace.c | 9 +--------
6 files changed, 5 insertions(+), 41 deletions(-)
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index be05a535c5..93ab29d6f1 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -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;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 7753d24877..587b2391ce 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 ### */
diff --git a/server/console.c b/server/console.c
index 0060f7cb65..53910b3f46 100644
--- a/server/console.c
+++ b/server/console.c
@@ -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 */
diff --git a/server/protocol.def b/server/protocol.def
index c2773307a4..1bbc8c5008 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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 */
- at REPLY
- obj_handle_t std_in; /* attached stdin */
- obj_handle_t std_out; /* attached stdout */
- obj_handle_t std_err; /* attached stderr */
@END
diff --git a/server/request.h b/server/request.h
index 190581332b..cd0799f2c1 100644
--- a/server/request.h
+++ b/server/request.h
@@ -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 );
diff --git a/server/trace.c b/server/trace.c
index 15a769fb59..51bd490fe2 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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,
More information about the wine-cvs
mailing list