Alexandre Julliard : server: Support opening file objects from any root, not only directories.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 9 10:46:48 CST 2016
Module: wine
Branch: master
Commit: 6ccefdb7c59d6bea1650b661c9b72bb7096a3a97
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6ccefdb7c59d6bea1650b661c9b72bb7096a3a97
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Feb 9 20:19:34 2016 +0900
server: Support opening file objects from any root, not only directories.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/fd.c | 26 ++++++--------------------
server/file.c | 11 ++++++++++-
2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/server/fd.c b/server/fd.c
index 28f5346..e995380 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2393,27 +2393,13 @@ DECL_HANDLER(flush)
DECL_HANDLER(open_file_object)
{
struct unicode_str name = get_req_unicode_str();
- struct directory *root = NULL;
- struct object *obj, *result;
+ struct object *obj, *result, *root = NULL;
- if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
- {
- if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) return;
- if (!(obj = (struct object *)get_file_obj( current->process, req->rootdir, 0 ))) return;
- if (name.len)
- {
- release_object( obj );
- set_error( STATUS_OBJECT_PATH_NOT_FOUND );
- return;
- }
- clear_error();
- }
- else
- {
- obj = open_object_dir( root, &name, req->attributes, NULL );
- if (root) release_object( root );
- if (!obj) return;
- }
+ if (req->rootdir && !(root = get_handle_obj( current->process, req->rootdir, 0, NULL ))) return;
+
+ obj = open_named_object( root, NULL, &name, req->attributes );
+ if (root) release_object( root );
+ if (!obj) return;
if ((result = obj->ops->open_file( obj, req->access, req->sharing, req->options )))
{
diff --git a/server/file.c b/server/file.c
index 15fd411..dacb24a 100644
--- a/server/file.c
+++ b/server/file.c
@@ -68,6 +68,7 @@ static struct object_type *file_get_type( struct object *obj );
static struct fd *file_get_fd( struct object *obj );
static struct security_descriptor *file_get_sd( struct object *obj );
static int file_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info );
+static struct object *file_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
static struct object *file_open_file( struct object *obj, unsigned int access,
unsigned int sharing, unsigned int options );
static void file_destroy( struct object *obj );
@@ -90,7 +91,7 @@ static const struct object_ops file_ops =
default_fd_map_access, /* map_access */
file_get_sd, /* get_sd */
file_set_sd, /* set_sd */
- no_lookup_name, /* lookup_name */
+ file_lookup_name, /* lookup_name */
no_link_name, /* link_name */
NULL, /* unlink_name */
file_open_file, /* open_file */
@@ -609,6 +610,14 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd
return 1;
}
+static struct object *file_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr )
+{
+ if (!name || !name->len) return NULL; /* open the file itself */
+
+ set_error( STATUS_OBJECT_PATH_NOT_FOUND );
+ return NULL;
+}
+
static struct object *file_open_file( struct object *obj, unsigned int access,
unsigned int sharing, unsigned int options )
{
More information about the wine-cvs
mailing list