Alexandre Julliard : server: Use attributes instead of inherit flag in console requests.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 9 05:54:20 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 7a096601e3f94e932a33e10f3fe40a6a40c1ddee
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7a096601e3f94e932a33e10f3fe40a6a40c1ddee

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Dec  9 12:05:20 2005 +0100

server: Use attributes instead of inherit flag in console requests.

---

 dlls/kernel/console.c              |   16 ++++++++--------
 include/wine/server_protocol.h     |   12 ++++++------
 programs/wineconsole/wineconsole.c |   18 +++++++++---------
 server/console.c                   |    6 +++---
 server/protocol.def                |   10 +++++-----
 server/trace.c                     |   10 +++++-----
 6 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c
index 9e62bcb..5dac5ec 100644
--- a/dlls/kernel/console.c
+++ b/dlls/kernel/console.c
@@ -230,10 +230,10 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name,
 
     SERVER_START_REQ( open_console )
     {
-        req->from    = output;
-        req->access  = access;
-	req->share   = FILE_SHARE_READ | FILE_SHARE_WRITE;
-        req->inherit = inherit;
+        req->from       = output;
+        req->access     = access;
+        req->attributes = inherit ? OBJ_INHERIT : 0;
+        req->share      = FILE_SHARE_READ | FILE_SHARE_WRITE;
         SetLastError(0);
         wine_server_call_err( req );
         ret = reply->handle;
@@ -1665,10 +1665,10 @@ HANDLE WINAPI CreateConsoleScreenBuffer(
 
     SERVER_START_REQ(create_console_output)
     {
-	req->handle_in = 0;
-	req->access    = dwDesiredAccess;
-	req->share     = dwShareMode;
-	req->inherit   = (sa && sa->bInheritHandle);
+        req->handle_in  = 0;
+        req->access     = dwDesiredAccess;
+        req->attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0;
+        req->share      = dwShareMode;
 	if (!wine_server_call_err( req )) ret = reply->handle_out;
     }
     SERVER_END_REQ;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 4677cfb..785db2f 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -977,7 +977,7 @@ struct alloc_console_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     process_id_t pid;
 };
 struct alloc_console_reply
@@ -1063,7 +1063,7 @@ struct open_console_request
     int          from;
 
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     int          share;
 };
 struct open_console_reply
@@ -1183,9 +1183,9 @@ struct create_console_output_request
 {
     struct request_header __header;
     obj_handle_t handle_in;
-    int          access;
-    int          share;
-    int          inherit;
+    unsigned int access;
+    unsigned int attributes;
+    unsigned int share;
 };
 struct create_console_output_reply
 {
@@ -4316,6 +4316,6 @@ union generic_reply
     struct query_symlink_reply query_symlink_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 209
+#define SERVER_PROTOCOL_VERSION 210
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c
index d73dc96..1d5ad7d 100644
--- a/programs/wineconsole/wineconsole.c
+++ b/programs/wineconsole/wineconsole.c
@@ -274,10 +274,10 @@ int	WINECON_GrabChanges(struct inner_dat
 	case CONSOLE_RENDERER_ACTIVE_SB_EVENT:
 	    SERVER_START_REQ( open_console )
 	    {
-		req->from    = (int)data->hConIn;
-		req->access  = GENERIC_READ | GENERIC_WRITE;
-		req->share   = FILE_SHARE_READ | FILE_SHARE_WRITE;
-		req->inherit = FALSE;
+                req->from       = (int)data->hConIn;
+                req->access     = GENERIC_READ | GENERIC_WRITE;
+                req->attributes = 0;
+                req->share      = FILE_SHARE_READ | FILE_SHARE_WRITE;
 		h = wine_server_call_err( req ) ? 0 : (HANDLE)reply->handle;
 	    }
 	    SERVER_END_REQ;
@@ -608,7 +608,7 @@ static struct inner_data* WINECON_Init(H
     SERVER_START_REQ(alloc_console)
     {
         req->access     = GENERIC_READ | GENERIC_WRITE;
-        req->inherit    = FALSE;
+        req->attributes = 0;
         req->pid        = pid;
 
         ret = !wine_server_call_err( req );
@@ -631,10 +631,10 @@ static struct inner_data* WINECON_Init(H
 
     SERVER_START_REQ(create_console_output)
     {
-        req->handle_in = (obj_handle_t)data->hConIn;
-        req->access    = GENERIC_WRITE|GENERIC_READ;
-        req->share     = FILE_SHARE_READ|FILE_SHARE_WRITE;
-        req->inherit   = FALSE;
+        req->handle_in  = data->hConIn;
+        req->access     = GENERIC_WRITE|GENERIC_READ;
+        req->attributes = 0;
+        req->share      = FILE_SHARE_READ|FILE_SHARE_WRITE;
         ret = !wine_server_call_err( req );
         data->hConOut  = (HANDLE)reply->handle_out;
     }
diff --git a/server/console.c b/server/console.c
index e567d60..e096079 100644
--- a/server/console.c
+++ b/server/console.c
@@ -1240,7 +1240,7 @@ DECL_HANDLER(alloc_console)
     }
     if ((console = (struct console_input*)create_console_input( current )))
     {
-        if ((in = alloc_handle( renderer, console, req->access, req->inherit )))
+        if ((in = alloc_handle( renderer, console, req->access, req->attributes & OBJ_INHERIT )))
         {
             if ((evt = alloc_handle( renderer, console->evt,
                                      SYNCHRONIZE|GENERIC_READ|GENERIC_WRITE, FALSE )))
@@ -1312,7 +1312,7 @@ DECL_HANDLER(open_console)
     /* FIXME: req->share is not used (as in screen buffer creation)  */
     if (obj)
     {
-        reply->handle = alloc_handle( current->process, obj, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, obj, req->access, req->attributes & OBJ_INHERIT );
         release_object( obj );
     }
     else if (!get_error()) set_error( STATUS_ACCESS_DENIED );
@@ -1411,7 +1411,7 @@ DECL_HANDLER(create_console_output)
         /* FIXME: should store sharing and test it when opening the CONOUT$ device
          * see file.c on how this could be done */
         reply->handle_out = alloc_handle( current->process, screen_buffer,
-                                          req->access, req->inherit );
+                                          req->access, req->attributes & OBJ_INHERIT );
         release_object( screen_buffer );
     }
     release_object( console );
diff --git a/server/protocol.def b/server/protocol.def
index 98bcb90..2dfd020 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -738,7 +738,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, 
 /* Allocate a console (only used by a console renderer) */
 @REQ(alloc_console)
     unsigned int access;        /* wanted access rights */
-    int          inherit;       /* inherit flag */
+    unsigned int attributes;    /* object attributes */
     process_id_t pid;           /* pid of process which shall be attached to the console */
 @REPLY
     obj_handle_t handle_in;     /* handle to console input */
@@ -808,7 +808,7 @@ struct console_renderer_event
     int          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 */
-    int          inherit;       /* inherit flag */
+    unsigned int attributes;    /* object attributes */
     int          share;         /* share mask (only for output handles) */
 @REPLY
     obj_handle_t handle;        /* handle to the console */
@@ -885,9 +885,9 @@ struct console_renderer_event
 /* creates a new screen buffer on process' console */
 @REQ(create_console_output)
     obj_handle_t handle_in;     /* handle to console input, or 0 for process' console */
-    int          access;        /* wanted access rights */
-    int          share;         /* sharing credentials */
-    int          inherit;       /* inherit flag */
+    unsigned int access;        /* wanted access rights */
+    unsigned int attributes;    /* object attributes */
+    unsigned int share;         /* sharing credentials */
 @REPLY
     obj_handle_t handle_out;    /* handle to the screen buffer */
 @END
diff --git a/server/trace.c b/server/trace.c
index 6ede1c2..d79adb6 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1169,7 +1169,7 @@ static void dump_set_socket_deferred_req
 static void dump_alloc_console_request( const struct alloc_console_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
-    fprintf( stderr, " inherit=%d,", req->inherit );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " pid=%04x", req->pid );
 }
 
@@ -1198,7 +1198,7 @@ static void dump_open_console_request( c
 {
     fprintf( stderr, " from=%d,", req->from );
     fprintf( stderr, " access=%08x,", req->access );
-    fprintf( stderr, " inherit=%d,", req->inherit );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " share=%d", req->share );
 }
 
@@ -1282,9 +1282,9 @@ static void dump_get_console_input_histo
 static void dump_create_console_output_request( const struct create_console_output_request *req )
 {
     fprintf( stderr, " handle_in=%p,", req->handle_in );
-    fprintf( stderr, " access=%d,", req->access );
-    fprintf( stderr, " share=%d,", req->share );
-    fprintf( stderr, " inherit=%d", req->inherit );
+    fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
+    fprintf( stderr, " share=%08x", req->share );
 }
 
 static void dump_create_console_output_reply( const struct create_console_output_reply *req )




More information about the wine-cvs mailing list