Commit 94655c84 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Implemented the open_file method for named pipe and mailslot devices.

parent 7e71c1dd
......@@ -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;
......
......@@ -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 */
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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 );
}
......
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