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

oldstable
Alexandre Julliard 2007-03-22 11:52:40 +01:00
parent 7e71c1ddee
commit 94655c8493
7 changed files with 27 additions and 9 deletions

View File

@ -218,6 +218,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
req->attributes = attr->Attributes; req->attributes = attr->Attributes;
req->rootdir = attr->RootDirectory; req->rootdir = attr->RootDirectory;
req->sharing = sharing; req->sharing = sharing;
req->options = options;
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length ); wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
io->u.Status = wine_server_call( req ); io->u.Status = wine_server_call( req );
*handle = reply->handle; *handle = reply->handle;

View File

@ -1035,6 +1035,7 @@ struct open_file_object_request
unsigned int attributes; unsigned int attributes;
obj_handle_t rootdir; obj_handle_t rootdir;
unsigned int sharing; unsigned int sharing;
unsigned int options;
/* VARARG(filename,unicode_str); */ /* VARARG(filename,unicode_str); */
}; };
struct open_file_object_reply struct open_file_object_reply
@ -4699,6 +4700,6 @@ union generic_reply
struct allocate_locally_unique_id_reply allocate_locally_unique_id_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 */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1871,7 +1871,7 @@ DECL_HANDLER(open_file_object)
{ {
struct unicode_str name; struct unicode_str name;
struct directory *root = NULL; struct directory *root = NULL;
struct object *obj; struct object *obj, *result;
get_req_unicode_str( &name ); get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) 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 ))) if ((obj = open_object_dir( root, &name, req->attributes, NULL )))
{ {
/* make sure this is a valid file object */ if ((result = obj->ops->open_file( obj, req->access, req->sharing, req->options )))
struct fd *fd = get_obj_fd( obj );
if (fd)
{ {
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes ); reply->handle = alloc_handle( current->process, result, req->access, req->attributes );
release_object( fd ); release_object( result );
} }
release_object( obj ); release_object( obj );
} }

View File

@ -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 fd *mailslot_device_get_fd( struct object *obj );
static struct object *mailslot_device_lookup_name( struct object *obj, struct unicode_str *name, static struct object *mailslot_device_lookup_name( struct object *obj, struct unicode_str *name,
unsigned int attr ); 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 void mailslot_device_destroy( struct object *obj );
static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags ); 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 */ mailslot_device_get_fd, /* get_fd */
no_map_access, /* map_access */ no_map_access, /* map_access */
mailslot_device_lookup_name, /* lookup_name */ mailslot_device_lookup_name, /* lookup_name */
no_open_file, /* open_file */ mailslot_device_open_file, /* open_file */
fd_close_handle, /* close_handle */ fd_close_handle, /* close_handle */
mailslot_device_destroy /* destroy */ mailslot_device_destroy /* destroy */
}; };
@ -293,6 +295,12 @@ static struct object *mailslot_device_lookup_name( struct object *obj, struct un
return found; 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 ) static void mailslot_device_destroy( struct object *obj )
{ {
struct mailslot_device *device = (struct mailslot_device*)obj; struct mailslot_device *device = (struct mailslot_device*)obj;

View File

@ -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 fd *named_pipe_device_get_fd( struct object *obj );
static struct object *named_pipe_device_lookup_name( struct object *obj, static struct object *named_pipe_device_lookup_name( struct object *obj,
struct unicode_str *name, unsigned int attr ); 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 void named_pipe_device_destroy( struct object *obj );
static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags ); 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 */ named_pipe_device_get_fd, /* get_fd */
pipe_map_access, /* map_access */ pipe_map_access, /* map_access */
named_pipe_device_lookup_name, /* lookup_name */ named_pipe_device_lookup_name, /* lookup_name */
no_open_file, /* open_file */ named_pipe_device_open_file, /* open_file */
fd_close_handle, /* close_handle */ fd_close_handle, /* close_handle */
named_pipe_device_destroy /* destroy */ named_pipe_device_destroy /* destroy */
}; };
@ -434,6 +436,12 @@ static struct object *named_pipe_device_lookup_name( struct object *obj, struct
return found; 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 ) static void named_pipe_device_destroy( struct object *obj )
{ {
struct named_pipe_device *device = (struct named_pipe_device*)obj; struct named_pipe_device *device = (struct named_pipe_device*)obj;

View File

@ -861,6 +861,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
unsigned int attributes; /* open attributes */ unsigned int attributes; /* open attributes */
obj_handle_t rootdir; /* root directory */ obj_handle_t rootdir; /* root directory */
unsigned int sharing; /* sharing flags */ unsigned int sharing; /* sharing flags */
unsigned int options; /* file options */
VARARG(filename,unicode_str); /* file name */ VARARG(filename,unicode_str); /* file name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the file */ obj_handle_t handle; /* handle to the file */

View 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, " attributes=%08x,", req->attributes );
fprintf( stderr, " rootdir=%p,", req->rootdir ); fprintf( stderr, " rootdir=%p,", req->rootdir );
fprintf( stderr, " sharing=%08x,", req->sharing ); fprintf( stderr, " sharing=%08x,", req->sharing );
fprintf( stderr, " options=%08x,", req->options );
fprintf( stderr, " filename=" ); fprintf( stderr, " filename=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }