server: Pass full object attributes in the create_timer request.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-15 18:47:06 +09:00
parent d05587afb8
commit b5245a15a8
6 changed files with 25 additions and 29 deletions

View File

@ -745,25 +745,26 @@ NTSTATUS WINAPI NtCreateTimer(OUT HANDLE *handle,
IN const OBJECT_ATTRIBUTES *attr OPTIONAL,
IN TIMER_TYPE timer_type)
{
DWORD len = (attr && attr->ObjectName) ? attr->ObjectName->Length : 0;
NTSTATUS status;
if (len >= MAX_PATH * sizeof(WCHAR)) return STATUS_NAME_TOO_LONG;
NTSTATUS status;
data_size_t len;
struct object_attributes *objattr;
if (timer_type != NotificationTimer && timer_type != SynchronizationTimer)
return STATUS_INVALID_PARAMETER;
if ((status = alloc_object_attributes( attr, &objattr, &len ))) return status;
SERVER_START_REQ( create_timer )
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
req->manual = (timer_type == NotificationTimer);
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
wine_server_add_data( req, objattr, len );
status = wine_server_call( req );
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
return status;
}

View File

@ -2601,11 +2601,9 @@ struct create_timer_request
{
struct request_header __header;
unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
int manual;
/* VARARG(name,unicode_str); */
char __pad_28[4];
/* VARARG(objattr,object_attributes); */
char __pad_20[4];
};
struct create_timer_reply
{
@ -6171,6 +6169,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 494
#define SERVER_PROTOCOL_VERSION 495
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1950,10 +1950,8 @@ enum char_info_mode
/* Create a waitable timer */
@REQ(create_timer)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
obj_handle_t rootdir; /* root directory */
int manual; /* manual reset */
VARARG(name,unicode_str); /* object name */
VARARG(objattr,object_attributes); /* object attributes */
@REPLY
obj_handle_t handle; /* handle to the timer */
@END

View File

@ -1352,10 +1352,8 @@ C_ASSERT( FIELD_OFFSET(struct set_registry_notification_request, subtree) == 20
C_ASSERT( FIELD_OFFSET(struct set_registry_notification_request, filter) == 24 );
C_ASSERT( sizeof(struct set_registry_notification_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct create_timer_request, access) == 12 );
C_ASSERT( FIELD_OFFSET(struct create_timer_request, attributes) == 16 );
C_ASSERT( FIELD_OFFSET(struct create_timer_request, rootdir) == 20 );
C_ASSERT( FIELD_OFFSET(struct create_timer_request, manual) == 24 );
C_ASSERT( sizeof(struct create_timer_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct create_timer_request, manual) == 16 );
C_ASSERT( sizeof(struct create_timer_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct create_timer_reply, handle) == 8 );
C_ASSERT( sizeof(struct create_timer_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_timer_request, access) == 12 );

View File

@ -80,7 +80,7 @@ static const struct object_ops timer_ops =
/* create a timer object */
static struct timer *create_timer( struct directory *root, const struct unicode_str *name,
unsigned int attr, int manual )
unsigned int attr, int manual, const struct security_descriptor *sd )
{
struct timer *timer;
@ -95,6 +95,9 @@ static struct timer *create_timer( struct directory *root, const struct unicode_
timer->period = 0;
timer->timeout = NULL;
timer->thread = NULL;
if (sd) default_set_sd( &timer->obj, sd,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION );
}
}
return timer;
@ -232,15 +235,15 @@ DECL_HANDLER(create_timer)
struct timer *timer;
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 ((timer = create_timer( root, &name, req->attributes, req->manual )))
if ((timer = create_timer( root, &name, objattr->attributes, req->manual, sd )))
{
reply->handle = alloc_handle( current->process, timer, req->access, req->attributes );
reply->handle = alloc_handle( current->process, timer, req->access, objattr->attributes );
release_object( timer );
}

View File

@ -2441,10 +2441,8 @@ static void dump_set_registry_notification_request( const struct set_registry_no
static void dump_create_timer_request( const struct create_timer_request *req )
{
fprintf( stderr, " access=%08x", req->access );
fprintf( stderr, ", attributes=%08x", req->attributes );
fprintf( stderr, ", rootdir=%04x", req->rootdir );
fprintf( stderr, ", manual=%d", req->manual );
dump_varargs_unicode_str( ", name=", cur_size );
dump_varargs_object_attributes( ", objattr=", cur_size );
}
static void dump_create_timer_reply( const struct create_timer_reply *req )