Alexandre Julliard : server: Pass full object attributes in the create_timer request.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 18 11:09:02 CST 2016
Module: wine
Branch: master
Commit: b5245a15a82770da5dcc1c50e5960786e0e4b6d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b5245a15a82770da5dcc1c50e5960786e0e4b6d7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jan 15 18:47:06 2016 +0900
server: Pass full object attributes in the create_timer request.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/sync.c | 15 ++++++++-------
include/wine/server_protocol.h | 8 +++-----
server/protocol.def | 4 +---
server/request.h | 6 ++----
server/timer.c | 17 ++++++++++-------
server/trace.c | 4 +---
6 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 36a9c86..1206627 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -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;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 8dd4994..aba649e 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 */
diff --git a/server/protocol.def b/server/protocol.def
index 4becb8f..8250bed 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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
diff --git a/server/request.h b/server/request.h
index b2e5719..d9163a0 100644
--- a/server/request.h
+++ b/server/request.h
@@ -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 );
diff --git a/server/timer.c b/server/timer.c
index 9c293f2..2c0522c 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -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 );
}
diff --git a/server/trace.c b/server/trace.c
index edfcaf5..552e8c2 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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 )
More information about the wine-cvs
mailing list