server: Make create_mapping use struct object_attributes and set the security descriptor of file mapping objects.
diff --git a/server/mapping.c b/server/mapping.c
index 33e4204..8f1bf5c 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -37,6 +37,7 @@
 #include "handle.h"
 #include "thread.h"
 #include "request.h"
+#include "security.h"
 
 struct mapping
 {
@@ -281,7 +282,7 @@
 
 static struct object *create_mapping( struct directory *root, const struct unicode_str *name,
                                       unsigned int attr, file_pos_t size, int protect,
-                                      obj_handle_t handle )
+                                      obj_handle_t handle, const struct security_descriptor *sd )
 {
     struct mapping *mapping;
     int access = 0;
@@ -293,6 +294,10 @@
     if (get_error() == STATUS_OBJECT_NAME_EXISTS)
         return &mapping->obj;  /* Nothing else to do */
 
+    if (sd) default_set_sd( &mapping->obj, sd, OWNER_SECURITY_INFORMATION|
+                                               GROUP_SECURITY_INFORMATION|
+                                               DACL_SECURITY_INFORMATION|
+                                               SACL_SECURITY_INFORMATION );
     mapping->header_size = 0;
     mapping->base        = NULL;
     mapping->shared_file = NULL;
@@ -394,13 +399,24 @@
     struct object *obj;
     struct unicode_str name;
     struct directory *root = NULL;
+    const struct object_attributes *objattr = get_req_data();
+    const struct security_descriptor *sd;
 
     reply->handle = 0;
-    get_req_unicode_str( &name );
-    if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
+
+    if (!objattr_is_valid( objattr, get_req_data_size() ))
         return;
 
-    if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle )))
+    sd = objattr->sd_len ? (const struct security_descriptor *)(objattr + 1) : NULL;
+
+    /* get unicode string */
+    name.len = ((get_req_data_size() - sizeof(*objattr) - objattr->sd_len) / sizeof(WCHAR)) * sizeof(WCHAR);
+    name.str = (const WCHAR *)get_req_data() + (sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR);
+
+    if (objattr->rootdir && !(root = get_directory_obj( current->process, objattr->rootdir, 0 )))
+        return;
+
+    if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle, sd )))
     {
         reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
         release_object( obj );
diff --git a/server/protocol.def b/server/protocol.def
index e486367..d336af6 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1310,11 +1310,10 @@
 @REQ(create_mapping)
     unsigned int access;        /* wanted access rights */
     unsigned int attributes;    /* object attributes */
-    obj_handle_t rootdir;       /* root directory */
     file_pos_t   size;          /* mapping size */
     int          protect;       /* protection flags (see below) */
     obj_handle_t file_handle;   /* file handle */
-    VARARG(name,unicode_str);   /* object name */
+    VARARG(objattr,object_attributes); /* object attributes */
 @REPLY
     obj_handle_t handle;        /* handle to the mapping */
 @END
diff --git a/server/trace.c b/server/trace.c
index 377d9de..30d6efd 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1721,14 +1721,13 @@
 {
     fprintf( stderr, " access=%08x,", req->access );
     fprintf( stderr, " attributes=%08x,", req->attributes );
-    fprintf( stderr, " rootdir=%p,", req->rootdir );
     fprintf( stderr, " size=" );
     dump_file_pos( &req->size );
     fprintf( stderr, "," );
     fprintf( stderr, " protect=%d,", req->protect );
     fprintf( stderr, " file_handle=%p,", req->file_handle );
-    fprintf( stderr, " name=" );
-    dump_varargs_unicode_str( cur_size );
+    fprintf( stderr, " objattr=" );
+    dump_varargs_object_attributes( cur_size );
 }
 
 static void dump_create_mapping_reply( const struct create_mapping_reply *req )