mirror of
https://github.com/reactos/wine.git
synced 2025-02-02 02:04:34 +00:00
server: Add a function to open a named object inside any parent, not only directories.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0458a7d0e3
commit
7a5b14d456
@ -278,7 +278,6 @@ static void test_handles(void)
|
|||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
d2 = OpenDesktopA( "", 0, TRUE, DESKTOP_ALL_ACCESS );
|
d2 = OpenDesktopA( "", 0, TRUE, DESKTOP_ALL_ACCESS );
|
||||||
ok( !d2, "open mepty desktop succeeded\n" );
|
ok( !d2, "open mepty desktop succeeded\n" );
|
||||||
todo_wine
|
|
||||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
|
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
|
||||||
|
|
||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
@ -289,7 +288,6 @@ static void test_handles(void)
|
|||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
d2 = OpenDesktopA( "foo\\bar", 0, TRUE, DESKTOP_ALL_ACCESS );
|
d2 = OpenDesktopA( "foo\\bar", 0, TRUE, DESKTOP_ALL_ACCESS );
|
||||||
ok( !d2, "open desktop succeeded\n" );
|
ok( !d2, "open desktop succeeded\n" );
|
||||||
todo_wine
|
|
||||||
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %u\n", GetLastError() );
|
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %u\n", GetLastError() );
|
||||||
|
|
||||||
d2 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
d2 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||||
|
@ -261,21 +261,7 @@ void *create_named_object_dir( struct directory *root, const struct unicode_str
|
|||||||
void *open_object_dir( struct directory *root, const struct unicode_str *name,
|
void *open_object_dir( struct directory *root, const struct unicode_str *name,
|
||||||
unsigned int attr, const struct object_ops *ops )
|
unsigned int attr, const struct object_ops *ops )
|
||||||
{
|
{
|
||||||
struct unicode_str name_left;
|
return open_named_object( &root->obj, ops, name, attr );
|
||||||
struct object *obj;
|
|
||||||
|
|
||||||
if ((obj = find_object_dir( root, name, attr, &name_left )))
|
|
||||||
{
|
|
||||||
if (name_left.len) /* not fully parsed */
|
|
||||||
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
|
|
||||||
else if (ops && obj->ops != ops)
|
|
||||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
|
||||||
else
|
|
||||||
return obj;
|
|
||||||
|
|
||||||
release_object( obj );
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve an object type, creating it if needed */
|
/* retrieve an object type, creating it if needed */
|
||||||
|
@ -316,6 +316,27 @@ void *create_named_object( struct object *parent, const struct object_ops *ops,
|
|||||||
return new_obj;
|
return new_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* open a object by name under the specified parent */
|
||||||
|
void *open_named_object( struct object *parent, const struct object_ops *ops,
|
||||||
|
const struct unicode_str *name, unsigned int attributes )
|
||||||
|
{
|
||||||
|
struct unicode_str name_left;
|
||||||
|
struct object *obj;
|
||||||
|
|
||||||
|
if ((obj = lookup_named_object( parent, name, attributes, &name_left )))
|
||||||
|
{
|
||||||
|
if (name_left.len) /* not fully parsed */
|
||||||
|
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
|
||||||
|
else if (ops && obj->ops != ops)
|
||||||
|
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||||
|
else
|
||||||
|
return obj;
|
||||||
|
|
||||||
|
release_object( obj );
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* recursive helper for dump_object_name */
|
/* recursive helper for dump_object_name */
|
||||||
static void dump_name( struct object *obj )
|
static void dump_name( struct object *obj )
|
||||||
{
|
{
|
||||||
|
@ -138,6 +138,8 @@ extern void *create_object( struct object *parent, const struct object_ops *ops,
|
|||||||
const struct unicode_str *name );
|
const struct unicode_str *name );
|
||||||
extern void *create_named_object( struct object *parent, const struct object_ops *ops,
|
extern void *create_named_object( struct object *parent, const struct object_ops *ops,
|
||||||
const struct unicode_str *name, unsigned int attributes );
|
const struct unicode_str *name, unsigned int attributes );
|
||||||
|
extern void *open_named_object( struct object *parent, const struct object_ops *ops,
|
||||||
|
const struct unicode_str *name, unsigned int attributes );
|
||||||
extern void unlink_named_object( struct object *obj );
|
extern void unlink_named_object( struct object *obj );
|
||||||
extern void make_object_static( struct object *obj );
|
extern void make_object_static( struct object *obj );
|
||||||
extern struct namespace *create_namespace( unsigned int hash_size );
|
extern struct namespace *create_namespace( unsigned int hash_size );
|
||||||
|
@ -534,13 +534,11 @@ DECL_HANDLER(open_desktop)
|
|||||||
|
|
||||||
if (!winstation) return;
|
if (!winstation) return;
|
||||||
|
|
||||||
if ((obj = find_object( winstation->desktop_names, &name, req->attributes )))
|
if ((obj = open_named_object( &winstation->obj, &desktop_ops, &name, req->attributes )))
|
||||||
{
|
{
|
||||||
assert( obj->ops == &desktop_ops );
|
|
||||||
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
|
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
|
||||||
release_object( obj );
|
release_object( obj );
|
||||||
}
|
}
|
||||||
else set_error( STATUS_OBJECT_NAME_NOT_FOUND );
|
|
||||||
|
|
||||||
release_object( winstation );
|
release_object( winstation );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user