Alexandre Julliard : server: Pass full object attributes in the create_completion request.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 18 11:09:03 CST 2016


Module: wine
Branch: master
Commit: 1eb69be36f176f499b67a16c93a470475bb1b330
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1eb69be36f176f499b67a16c93a470475bb1b330

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jan 15 20:49:38 2016 +0900

server: Pass full object attributes in the create_completion request.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/sync.c              | 17 +++++++++--------
 include/wine/server_protocol.h |  8 +++-----
 server/completion.c            | 20 ++++++++++++--------
 server/protocol.def            |  4 +---
 server/request.h               |  6 ++----
 server/trace.c                 |  4 +---
 6 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 1206627..a6de6a1 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -1153,29 +1153,30 @@ NTSTATUS WINAPI NtReleaseKeyedEvent( HANDLE handle, const void *key,
  *
  */
 NTSTATUS WINAPI NtCreateIoCompletion( PHANDLE CompletionPort, ACCESS_MASK DesiredAccess,
-                                      POBJECT_ATTRIBUTES ObjectAttributes, ULONG NumberOfConcurrentThreads )
+                                      POBJECT_ATTRIBUTES attr, ULONG NumberOfConcurrentThreads )
 {
     NTSTATUS status;
+    data_size_t len;
+    struct object_attributes *objattr;
 
-    TRACE("(%p, %x, %p, %d)\n", CompletionPort, DesiredAccess,
-          ObjectAttributes, NumberOfConcurrentThreads);
+    TRACE("(%p, %x, %p, %d)\n", CompletionPort, DesiredAccess, attr, NumberOfConcurrentThreads);
 
     if (!CompletionPort)
         return STATUS_INVALID_PARAMETER;
 
+    if ((status = alloc_object_attributes( attr, &objattr, &len ))) return status;
+
     SERVER_START_REQ( create_completion )
     {
         req->access     = DesiredAccess;
-        req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
-        req->rootdir    = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
         req->concurrent = NumberOfConcurrentThreads;
-        if (ObjectAttributes && ObjectAttributes->ObjectName)
-            wine_server_add_data( req, ObjectAttributes->ObjectName->Buffer,
-                                       ObjectAttributes->ObjectName->Length );
+        wine_server_add_data( req, objattr, len );
         if (!(status = wine_server_call( req )))
             *CompletionPort = wine_server_ptr_handle( reply->handle );
     }
     SERVER_END_REQ;
+
+    RtlFreeHeap( GetProcessHeap(), 0, objattr );
     return status;
 }
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 4614c98..19ea2fc 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -4980,11 +4980,9 @@ struct create_completion_request
 {
     struct request_header __header;
     unsigned int access;
-    unsigned int attributes;
     unsigned int concurrent;
-    obj_handle_t rootdir;
-    /* VARARG(filename,unicode_str); */
-    char __pad_28[4];
+    /* VARARG(objattr,object_attributes); */
+    char __pad_20[4];
 };
 struct create_completion_reply
 {
@@ -6161,6 +6159,6 @@ union generic_reply
     struct terminate_job_reply terminate_job_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 496
+#define SERVER_PROTOCOL_VERSION 497
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/completion.c b/server/completion.c
index 77c72cc..a93551f 100644
--- a/server/completion.c
+++ b/server/completion.c
@@ -130,7 +130,9 @@ static unsigned int completion_map_access( struct object *obj, unsigned int acce
     return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
 }
 
-static struct completion *create_completion( struct directory *root, const struct unicode_str *name, unsigned int attr, unsigned int concurrent )
+static struct completion *create_completion( struct directory *root, const struct unicode_str *name,
+                                             unsigned int attr, unsigned int concurrent,
+                                             const struct security_descriptor *sd )
 {
     struct completion *completion;
 
@@ -140,6 +142,9 @@ static struct completion *create_completion( struct directory *root, const struc
         {
             list_init( &completion->queue );
             completion->depth = 0;
+            if (sd) default_set_sd( &completion->obj, sd,
+                                    OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
+                                    DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION );
         }
     }
 
@@ -175,16 +180,15 @@ DECL_HANDLER(create_completion)
     struct completion *completion;
     struct unicode_str name;
     struct directory *root = NULL;
+    const struct security_descriptor *sd;
+    const struct object_attributes *objattr = get_req_object_attributes( &sd, &name );
 
-    reply->handle = 0;
-
-    get_req_unicode_str( &name );
-    if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
-        return;
+    if (!objattr) return;
+    if (objattr->rootdir && !(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return;
 
-    if ( (completion = create_completion( root, &name, req->attributes, req->concurrent )) != NULL )
+    if ((completion = create_completion( root, &name, objattr->attributes, req->concurrent, sd )))
     {
-        reply->handle = alloc_handle( current->process, completion, req->access, req->attributes );
+        reply->handle = alloc_handle( current->process, completion, req->access, objattr->attributes );
         release_object( completion );
     }
 
diff --git a/server/protocol.def b/server/protocol.def
index cbf5ea7..390651d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3466,10 +3466,8 @@ struct handle_info
 /* Create I/O completion port */
 @REQ(create_completion)
     unsigned int access;          /* desired access to a port */
-    unsigned int attributes;      /* object attributes */
     unsigned int concurrent;      /* max number of concurrent active threads */
-    obj_handle_t rootdir;         /* root directory */
-    VARARG(filename,unicode_str); /* port name */
+    VARARG(objattr,object_attributes); /* object attributes */
 @REPLY
     obj_handle_t handle;          /* port handle */
 @END
diff --git a/server/request.h b/server/request.h
index e1d2487..2c99c79 100644
--- a/server/request.h
+++ b/server/request.h
@@ -2182,10 +2182,8 @@ C_ASSERT( FIELD_OFFSET(struct get_token_statistics_reply, group_count) == 32 );
 C_ASSERT( FIELD_OFFSET(struct get_token_statistics_reply, privilege_count) == 36 );
 C_ASSERT( sizeof(struct get_token_statistics_reply) == 40 );
 C_ASSERT( FIELD_OFFSET(struct create_completion_request, access) == 12 );
-C_ASSERT( FIELD_OFFSET(struct create_completion_request, attributes) == 16 );
-C_ASSERT( FIELD_OFFSET(struct create_completion_request, concurrent) == 20 );
-C_ASSERT( FIELD_OFFSET(struct create_completion_request, rootdir) == 24 );
-C_ASSERT( sizeof(struct create_completion_request) == 32 );
+C_ASSERT( FIELD_OFFSET(struct create_completion_request, concurrent) == 16 );
+C_ASSERT( sizeof(struct create_completion_request) == 24 );
 C_ASSERT( FIELD_OFFSET(struct create_completion_reply, handle) == 8 );
 C_ASSERT( sizeof(struct create_completion_reply) == 16 );
 C_ASSERT( FIELD_OFFSET(struct open_completion_request, access) == 12 );
diff --git a/server/trace.c b/server/trace.c
index 87fe202..edbc8c9 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -4087,10 +4087,8 @@ static void dump_get_token_statistics_reply( const struct get_token_statistics_r
 static void dump_create_completion_request( const struct create_completion_request *req )
 {
     fprintf( stderr, " access=%08x", req->access );
-    fprintf( stderr, ", attributes=%08x", req->attributes );
     fprintf( stderr, ", concurrent=%08x", req->concurrent );
-    fprintf( stderr, ", rootdir=%04x", req->rootdir );
-    dump_varargs_unicode_str( ", filename=", cur_size );
+    dump_varargs_object_attributes( ", objattr=", cur_size );
 }
 
 static void dump_create_completion_reply( const struct create_completion_reply *req )




More information about the wine-cvs mailing list