server: Pass full object attributes in the create_directory request.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-15 19:02:18 +09:00
parent 14825a7a55
commit 82800f513c
6 changed files with 31 additions and 34 deletions

View File

@ -478,25 +478,27 @@ NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Desir
* Failure: An NTSTATUS error code.
*/
NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
OBJECT_ATTRIBUTES *attr )
{
NTSTATUS ret;
data_size_t len;
struct object_attributes *objattr;
if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(attr));
if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
SERVER_START_REQ(create_directory)
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
if (ObjectAttributes && ObjectAttributes->ObjectName)
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length);
wine_server_add_data( req, objattr, len );
ret = wine_server_call( req );
*DirectoryHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
return ret;
}

View File

@ -4710,9 +4710,7 @@ struct create_directory_request
{
struct request_header __header;
unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
/* VARARG(directory_name,unicode_str); */
/* VARARG(objattr,object_attributes); */
};
struct create_directory_reply
{

View File

@ -189,7 +189,8 @@ static void directory_destroy( struct object *obj )
}
static struct directory *create_directory( struct directory *root, const struct unicode_str *name,
unsigned int attr, unsigned int hash_size )
unsigned int attr, unsigned int hash_size,
const struct security_descriptor *sd )
{
struct directory *dir;
@ -201,6 +202,8 @@ static struct directory *create_directory( struct directory *root, const struct
release_object( dir );
dir = NULL;
}
if (sd) default_set_sd( &dir->obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION );
}
return dir;
}
@ -440,19 +443,19 @@ void init_directories(void)
struct keyed_event *keyed_event;
unsigned int i;
root_directory = create_directory( NULL, NULL, 0, HASH_SIZE );
dir_driver = create_directory( root_directory, &dir_driver_str, 0, HASH_SIZE );
dir_device = create_directory( root_directory, &dir_device_str, 0, HASH_SIZE );
dir_objtype = create_directory( root_directory, &dir_objtype_str, 0, HASH_SIZE );
dir_sessions = create_directory( root_directory, &dir_sessions_str, 0, HASH_SIZE );
dir_kernel = create_directory( root_directory, &dir_kernel_str, 0, HASH_SIZE );
root_directory = create_directory( NULL, NULL, 0, HASH_SIZE, NULL );
dir_driver = create_directory( root_directory, &dir_driver_str, 0, HASH_SIZE, NULL );
dir_device = create_directory( root_directory, &dir_device_str, 0, HASH_SIZE, NULL );
dir_objtype = create_directory( root_directory, &dir_objtype_str, 0, HASH_SIZE, NULL );
dir_sessions = create_directory( root_directory, &dir_sessions_str, 0, HASH_SIZE, NULL );
dir_kernel = create_directory( root_directory, &dir_kernel_str, 0, HASH_SIZE, NULL );
make_object_static( &root_directory->obj );
make_object_static( &dir_driver->obj );
make_object_static( &dir_objtype->obj );
dir_global = create_directory( NULL, &dir_global_str, 0, HASH_SIZE );
dir_global = create_directory( NULL, &dir_global_str, 0, HASH_SIZE, NULL );
/* use a larger hash table for this one since it can contain a lot of objects */
dir_basenamed = create_directory( NULL, &dir_basenamed_str, 0, 37 );
dir_basenamed = create_directory( NULL, &dir_basenamed_str, 0, 37, NULL );
/* devices */
create_named_pipe_device( dir_device, &named_pipe_str );
@ -501,15 +504,15 @@ DECL_HANDLER(create_directory)
{
struct unicode_str name;
struct directory *dir, *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 ((dir = create_directory( root, &name, req->attributes, HASH_SIZE )))
if ((dir = create_directory( root, &name, objattr->attributes, HASH_SIZE, sd )))
{
reply->handle = alloc_handle( current->process, dir, req->access, req->attributes );
reply->handle = alloc_handle( current->process, dir, req->access, objattr->attributes );
release_object( dir );
}

View File

@ -3300,9 +3300,7 @@ struct handle_info
/* Create a directory object */
@REQ(create_directory)
unsigned int access; /* access flags */
unsigned int attributes; /* object attributes */
obj_handle_t rootdir; /* root directory */
VARARG(directory_name,unicode_str); /* Directory name */
VARARG(objattr,object_attributes); /* object attributes */
@REPLY
obj_handle_t handle; /* handle to the directory */
@END

View File

@ -2095,9 +2095,7 @@ C_ASSERT( FIELD_OFFSET(struct set_mailslot_info_reply, read_timeout) == 8 );
C_ASSERT( FIELD_OFFSET(struct set_mailslot_info_reply, max_msgsize) == 16 );
C_ASSERT( sizeof(struct set_mailslot_info_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct create_directory_request, access) == 12 );
C_ASSERT( FIELD_OFFSET(struct create_directory_request, attributes) == 16 );
C_ASSERT( FIELD_OFFSET(struct create_directory_request, rootdir) == 20 );
C_ASSERT( sizeof(struct create_directory_request) == 24 );
C_ASSERT( sizeof(struct create_directory_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct create_directory_reply, handle) == 8 );
C_ASSERT( sizeof(struct create_directory_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_directory_request, access) == 12 );

View File

@ -3892,9 +3892,7 @@ static void dump_set_mailslot_info_reply( const struct set_mailslot_info_reply *
static void dump_create_directory_request( const struct create_directory_request *req )
{
fprintf( stderr, " access=%08x", req->access );
fprintf( stderr, ", attributes=%08x", req->attributes );
fprintf( stderr, ", rootdir=%04x", req->rootdir );
dump_varargs_unicode_str( ", directory_name=", cur_size );
dump_varargs_object_attributes( ", objattr=", cur_size );
}
static void dump_create_directory_reply( const struct create_directory_reply *req )