Module: wine Branch: refs/heads/master Commit: fac494c8226dd777c9c4b107d7ec9a100f0a43d6 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=fac494c8226dd777c9c4b107...
Author: Mike McCormack mike@codeweavers.com Date: Wed Jun 7 18:33:46 2006 +0900
server: open_console's from field should be a handle.
---
dlls/kernel/console.c | 6 +++--- include/wine/server_protocol.h | 4 ++-- programs/wineconsole/wineconsole.c | 2 +- server/console.c | 25 +++++++++++-------------- server/protocol.def | 2 +- server/trace.c | 2 +- 6 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c index 384bbfd..fc16195 100644 --- a/dlls/kernel/console.c +++ b/dlls/kernel/console.c @@ -210,13 +210,13 @@ BOOL WINAPI Beep( DWORD dwFreq, DWORD dw */ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creation) { - BOOL output; + HANDLE output; HANDLE ret;
if (strcmpiW(coninW, name) == 0) - output = FALSE; + output = (HANDLE) FALSE; else if (strcmpiW(conoutW, name) == 0) - output = TRUE; + output = (HANDLE) TRUE; else { SetLastError(ERROR_INVALID_NAME); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 7481eb1..c39f83c 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1082,7 +1082,7 @@ struct get_console_renderer_events_reply struct open_console_request { struct request_header __header; - int from; + obj_handle_t from;
unsigned int access; unsigned int attributes; @@ -4382,6 +4382,6 @@ union generic_reply struct query_symlink_reply query_symlink_reply; };
-#define SERVER_PROTOCOL_VERSION 235 +#define SERVER_PROTOCOL_VERSION 236
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index bf3d6cf..edf0fa8 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -274,7 +274,7 @@ int WINECON_GrabChanges(struct inner_dat case CONSOLE_RENDERER_ACTIVE_SB_EVENT: SERVER_START_REQ( open_console ) { - req->from = (int)data->hConIn; + req->from = data->hConIn; req->access = GENERIC_READ | GENERIC_WRITE; req->attributes = 0; req->share = FILE_SHARE_READ | FILE_SHARE_WRITE; diff --git a/server/console.c b/server/console.c index a4d8f87..b080293 100644 --- a/server/console.c +++ b/server/console.c @@ -1311,26 +1311,23 @@ DECL_HANDLER(open_console) struct object *obj = NULL;
reply->handle = 0; - switch (req->from) + if (req->from == (obj_handle_t)0) { - case 0: if (current->process->console && current->process->console->renderer) obj = grab_object( (struct object*)current->process->console ); - break; - case 1: + } + else if (req->from == (obj_handle_t)1) + { if (current->process->console && current->process->console->renderer && current->process->console->active) obj = grab_object( (struct object*)current->process->console->active ); - break; - default: - if ((obj = get_handle_obj( current->process, (obj_handle_t)req->from, - CONSOLE_READ|CONSOLE_WRITE, &console_input_ops ))) - { - struct console_input* console = (struct console_input*)obj; - obj = (console->active) ? grab_object( console->active ) : NULL; - release_object( console ); - } - break; + } + else if ((obj = get_handle_obj( current->process, req->from, + CONSOLE_READ|CONSOLE_WRITE, &console_input_ops ))) + { + struct console_input *console = (struct console_input *)obj; + obj = (console->active) ? grab_object( console->active ) : NULL; + release_object( console ); }
/* FIXME: req->share is not used (as in screen buffer creation) */ diff --git a/server/protocol.def b/server/protocol.def index c313df1..fac00d3 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -822,7 +822,7 @@ struct console_renderer_event
/* Open a handle to the process console */ @REQ(open_console) - int from; /* 0 (resp 1) input (resp output) of current process console */ + obj_handle_t from; /* 0 (resp 1) input (resp output) of current process console */ /* otherwise console_in handle to get active screen buffer? */ unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ diff --git a/server/trace.c b/server/trace.c index 98f622c..5d2c525 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1245,7 +1245,7 @@ static void dump_get_console_renderer_ev
static void dump_open_console_request( const struct open_console_request *req ) { - fprintf( stderr, " from=%d,", req->from ); + fprintf( stderr, " from=%p,", req->from ); fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " share=%d", req->share );