server: open_console's from field should be a handle.

This commit is contained in:
Mike McCormack 2006-06-07 18:33:46 +09:00 committed by Alexandre Julliard
parent f386950fdd
commit fac494c822
6 changed files with 19 additions and 22 deletions

View File

@ -210,13 +210,13 @@ BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
*/ */
HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creation) HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creation)
{ {
BOOL output; HANDLE output;
HANDLE ret; HANDLE ret;
if (strcmpiW(coninW, name) == 0) if (strcmpiW(coninW, name) == 0)
output = FALSE; output = (HANDLE) FALSE;
else if (strcmpiW(conoutW, name) == 0) else if (strcmpiW(conoutW, name) == 0)
output = TRUE; output = (HANDLE) TRUE;
else else
{ {
SetLastError(ERROR_INVALID_NAME); SetLastError(ERROR_INVALID_NAME);

View File

@ -1082,7 +1082,7 @@ struct get_console_renderer_events_reply
struct open_console_request struct open_console_request
{ {
struct request_header __header; struct request_header __header;
int from; obj_handle_t from;
unsigned int access; unsigned int access;
unsigned int attributes; unsigned int attributes;
@ -4382,6 +4382,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply; struct query_symlink_reply query_symlink_reply;
}; };
#define SERVER_PROTOCOL_VERSION 235 #define SERVER_PROTOCOL_VERSION 236
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -274,7 +274,7 @@ int WINECON_GrabChanges(struct inner_data* data)
case CONSOLE_RENDERER_ACTIVE_SB_EVENT: case CONSOLE_RENDERER_ACTIVE_SB_EVENT:
SERVER_START_REQ( open_console ) SERVER_START_REQ( open_console )
{ {
req->from = (int)data->hConIn; req->from = data->hConIn;
req->access = GENERIC_READ | GENERIC_WRITE; req->access = GENERIC_READ | GENERIC_WRITE;
req->attributes = 0; req->attributes = 0;
req->share = FILE_SHARE_READ | FILE_SHARE_WRITE; req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;

View File

@ -1311,26 +1311,23 @@ DECL_HANDLER(open_console)
struct object *obj = NULL; struct object *obj = NULL;
reply->handle = 0; reply->handle = 0;
switch (req->from) if (req->from == (obj_handle_t)0)
{ {
case 0:
if (current->process->console && current->process->console->renderer) if (current->process->console && current->process->console->renderer)
obj = grab_object( (struct object*)current->process->console ); 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 && if (current->process->console && current->process->console->renderer &&
current->process->console->active) current->process->console->active)
obj = grab_object( (struct object*)current->process->console->active ); obj = grab_object( (struct object*)current->process->console->active );
break; }
default: else if ((obj = get_handle_obj( current->process, req->from,
if ((obj = get_handle_obj( current->process, (obj_handle_t)req->from, CONSOLE_READ|CONSOLE_WRITE, &console_input_ops )))
CONSOLE_READ|CONSOLE_WRITE, &console_input_ops ))) {
{ struct console_input *console = (struct console_input *)obj;
struct console_input* console = (struct console_input*)obj; obj = (console->active) ? grab_object( console->active ) : NULL;
obj = (console->active) ? grab_object( console->active ) : NULL; release_object( console );
release_object( console );
}
break;
} }
/* FIXME: req->share is not used (as in screen buffer creation) */ /* FIXME: req->share is not used (as in screen buffer creation) */

View File

@ -822,7 +822,7 @@ struct console_renderer_event
/* Open a handle to the process console */ /* Open a handle to the process console */
@REQ(open_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? */ /* otherwise console_in handle to get active screen buffer? */
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */ unsigned int attributes; /* object attributes */

View File

@ -1245,7 +1245,7 @@ static void dump_get_console_renderer_events_reply( const struct get_console_ren
static void dump_open_console_request( const struct open_console_request *req ) 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, " access=%08x,", req->access );
fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " share=%d", req->share ); fprintf( stderr, " share=%d", req->share );