Commit 1eb69be3 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Pass full object attributes in the create_completion request.

parent 426c4a2f
......@@ -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;
}
......
......@@ -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 */
......@@ -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 );
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment