From 94655c8493d938c3951fd9c2efd2c81253dd95a2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 22 Mar 2007 11:52:40 +0100 Subject: [PATCH] server: Implemented the open_file method for named pipe and mailslot devices. --- dlls/ntdll/file.c | 1 + include/wine/server_protocol.h | 3 ++- server/fd.c | 10 ++++------ server/mailslot.c | 10 +++++++++- server/named_pipe.c | 10 +++++++++- server/protocol.def | 1 + server/trace.c | 1 + 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 0b225833a7f..2a2f9d2f47e 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -218,6 +218,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB req->attributes = attr->Attributes; req->rootdir = attr->RootDirectory; req->sharing = sharing; + req->options = options; wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length ); io->u.Status = wine_server_call( req ); *handle = reply->handle; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 726d833dd44..c0d628fd260 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1035,6 +1035,7 @@ struct open_file_object_request unsigned int attributes; obj_handle_t rootdir; unsigned int sharing; + unsigned int options; /* VARARG(filename,unicode_str); */ }; struct open_file_object_reply @@ -4699,6 +4700,6 @@ union generic_reply struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply; }; -#define SERVER_PROTOCOL_VERSION 285 +#define SERVER_PROTOCOL_VERSION 286 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/fd.c b/server/fd.c index cefdc162973..fba69074953 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1871,7 +1871,7 @@ DECL_HANDLER(open_file_object) { struct unicode_str name; struct directory *root = NULL; - struct object *obj; + struct object *obj, *result; get_req_unicode_str( &name ); if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) @@ -1879,12 +1879,10 @@ DECL_HANDLER(open_file_object) if ((obj = open_object_dir( root, &name, req->attributes, NULL ))) { - /* make sure this is a valid file object */ - struct fd *fd = get_obj_fd( obj ); - if (fd) + if ((result = obj->ops->open_file( obj, req->access, req->sharing, req->options ))) { - reply->handle = alloc_handle( current->process, obj, req->access, req->attributes ); - release_object( fd ); + reply->handle = alloc_handle( current->process, result, req->access, req->attributes ); + release_object( result ); } release_object( obj ); } diff --git a/server/mailslot.c b/server/mailslot.c index af2b25bbe60..9391e131229 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -154,6 +154,8 @@ static void mailslot_device_dump( struct object *obj, int verbose ); static struct fd *mailslot_device_get_fd( struct object *obj ); static struct object *mailslot_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ); +static struct object *mailslot_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); static void mailslot_device_destroy( struct object *obj ); static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags ); @@ -169,7 +171,7 @@ static const struct object_ops mailslot_device_ops = mailslot_device_get_fd, /* get_fd */ no_map_access, /* map_access */ mailslot_device_lookup_name, /* lookup_name */ - no_open_file, /* open_file */ + mailslot_device_open_file, /* open_file */ fd_close_handle, /* close_handle */ mailslot_device_destroy /* destroy */ }; @@ -293,6 +295,12 @@ static struct object *mailslot_device_lookup_name( struct object *obj, struct un return found; } +static struct object *mailslot_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) +{ + return grab_object( obj ); +} + static void mailslot_device_destroy( struct object *obj ) { struct mailslot_device *device = (struct mailslot_device*)obj; diff --git a/server/named_pipe.c b/server/named_pipe.c index 0e1aeabe02f..e121c916a02 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -202,6 +202,8 @@ static void named_pipe_device_dump( struct object *obj, int verbose ); static struct fd *named_pipe_device_get_fd( struct object *obj ); static struct object *named_pipe_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ); +static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); static void named_pipe_device_destroy( struct object *obj ); static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags ); @@ -217,7 +219,7 @@ static const struct object_ops named_pipe_device_ops = named_pipe_device_get_fd, /* get_fd */ pipe_map_access, /* map_access */ named_pipe_device_lookup_name, /* lookup_name */ - no_open_file, /* open_file */ + named_pipe_device_open_file, /* open_file */ fd_close_handle, /* close_handle */ named_pipe_device_destroy /* destroy */ }; @@ -434,6 +436,12 @@ static struct object *named_pipe_device_lookup_name( struct object *obj, struct return found; } +static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) +{ + return grab_object( obj ); +} + static void named_pipe_device_destroy( struct object *obj ) { struct named_pipe_device *device = (struct named_pipe_device*)obj; diff --git a/server/protocol.def b/server/protocol.def index 1e7cb8b298b..8e7875c643c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -861,6 +861,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT }; unsigned int attributes; /* open attributes */ obj_handle_t rootdir; /* root directory */ unsigned int sharing; /* sharing flags */ + unsigned int options; /* file options */ VARARG(filename,unicode_str); /* file name */ @REPLY obj_handle_t handle; /* handle to the file */ diff --git a/server/trace.c b/server/trace.c index ed42650515f..c3ffe18c88a 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1249,6 +1249,7 @@ static void dump_open_file_object_request( const struct open_file_object_request fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " rootdir=%p,", req->rootdir ); fprintf( stderr, " sharing=%08x,", req->sharing ); + fprintf( stderr, " options=%08x,", req->options ); fprintf( stderr, " filename=" ); dump_varargs_unicode_str( cur_size ); }