Move timer objects into directory name space.

This commit is contained in:
Vitaliy Margolen 2005-12-02 16:05:54 +01:00 committed by Alexandre Julliard
parent 5daae3dfa9
commit 7c5cb7a229
6 changed files with 28 additions and 6 deletions

View File

@ -927,6 +927,7 @@ HANDLE WINAPI CreateWaitableTimerW( SECURITY_ATTRIBUTES *sa, BOOL manual, LPCWST
{
RtlInitUnicodeString( &nameW, name );
attr.ObjectName = &nameW;
attr.RootDirectory = get_BaseNamedObjects_handle();
}
status = NtCreateTimer(&handle, TIMER_ALL_ACCESS, &attr,
@ -979,6 +980,7 @@ HANDLE WINAPI OpenWaitableTimerW( DWORD access, BOOL inherit, LPCWSTR name )
{
RtlInitUnicodeString( &nameW, name );
attr.ObjectName = &nameW;
attr.RootDirectory = get_BaseNamedObjects_handle();
}
status = NtOpenTimer(&handle, access, &attr);

View File

@ -422,6 +422,7 @@ NTSTATUS WINAPI NtCreateTimer(OUT HANDLE *handle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->manual = (timer_type == NotificationTimer) ? TRUE : FALSE;
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
@ -449,6 +450,7 @@ NTSTATUS WINAPI NtOpenTimer(OUT PHANDLE handle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
*handle = reply->handle;

View File

@ -1885,6 +1885,7 @@ struct create_timer_request
struct request_header __header;
unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
int manual;
/* VARARG(name,unicode_str); */
};
@ -1901,6 +1902,7 @@ struct open_timer_request
struct request_header __header;
unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
/* VARARG(name,unicode_str); */
};
struct open_timer_reply
@ -4308,6 +4310,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 203
#define SERVER_PROTOCOL_VERSION 204
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1360,6 +1360,7 @@ enum char_info_mode
@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 */
@REPLY
@ -1371,6 +1372,7 @@ enum char_info_mode
@REQ(open_timer)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
obj_handle_t rootdir; /* root directory */
VARARG(name,unicode_str); /* object name */
@REPLY
obj_handle_t handle; /* handle to the timer */

View File

@ -72,12 +72,12 @@ static const struct object_ops timer_ops =
/* create a timer object */
static struct timer *create_timer( const struct unicode_str *name, unsigned int attr,
int manual )
static struct timer *create_timer( struct directory *root, const struct unicode_str *name,
unsigned int attr, int manual )
{
struct timer *timer;
if ((timer = create_named_object( sync_namespace, &timer_ops, name, attr )))
if ((timer = create_named_object_dir( root, name, attr, &timer_ops )))
{
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
{
@ -209,24 +209,36 @@ DECL_HANDLER(create_timer)
{
struct timer *timer;
struct unicode_str name;
struct directory *root = NULL;
reply->handle = 0;
get_req_unicode_str( &name );
if ((timer = create_timer( &name, req->attributes, req->manual )))
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
return;
if ((timer = create_timer( root, &name, req->attributes, req->manual )))
{
reply->handle = alloc_handle( current->process, timer, req->access,
req->attributes & OBJ_INHERIT );
release_object( timer );
}
if (root) release_object( root );
}
/* open a handle to a timer */
DECL_HANDLER(open_timer)
{
struct unicode_str name;
struct directory *root = NULL;
get_req_unicode_str( &name );
reply->handle = open_object( sync_namespace, &name, &timer_ops, req->access, req->attributes );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
return;
reply->handle = open_object_dir( root, &name, req->attributes, &timer_ops, req->access );
if (root) release_object( root );
}
/* set a waitable timer */

View File

@ -1798,6 +1798,7 @@ 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=%p,", req->rootdir );
fprintf( stderr, " manual=%d,", req->manual );
fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size );
@ -1812,6 +1813,7 @@ static void dump_open_timer_request( const struct open_timer_request *req )
{
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " rootdir=%p,", req->rootdir );
fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size );
}