diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 0ae63ffafb3..72d2272d5cc 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -2048,28 +2048,28 @@ static void test_permanence(void) attr.Attributes = 0; status = ZwOpenDirectoryObject( &handle, 0, &attr ); - todo_wine ok(!status, "got %#x\n", status); + ok(!status, "got %#x\n", status); status = ZwMakeTemporaryObject( handle ); ok(!status, "got %#x\n", status); status = ZwMakeTemporaryObject( handle ); ok(!status, "got %#x\n", status); status = ZwClose( handle ); - todo_wine ok(!status, "got %#x\n", status); + ok(!status, "got %#x\n", status); status = ZwOpenDirectoryObject( &handle, 0, &attr ); - ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status); + todo_wine ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status); status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr ); - ok(!status, "got %#x\n", status); + todo_wine ok(!status, "got %#x\n", status); attr.Attributes = OBJ_PERMANENT; status = ZwOpenDirectoryObject( &handle2, 0, &attr ); ok(status == STATUS_SUCCESS, "got %#x\n", status); status = ZwClose( handle2 ); ok(!status, "got %#x\n", status); status = ZwClose( handle ); - ok(!status, "got %#x\n", status); + todo_wine ok(!status, "got %#x\n", status); attr.Attributes = 0; status = ZwOpenDirectoryObject( &handle, 0, &attr ); - ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status); + todo_wine ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status); } static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack) diff --git a/server/object.c b/server/object.c index dacfe1d71a0..6c0bb9be3ab 100644 --- a/server/object.c +++ b/server/object.c @@ -278,7 +278,8 @@ data_size_t get_path_element( const WCHAR *name, data_size_t len ) } static struct object *create_object( struct object *parent, const struct object_ops *ops, - const struct unicode_str *name, const struct security_descriptor *sd ) + const struct unicode_str *name, unsigned int attributes, + const struct security_descriptor *sd ) { struct object *obj; struct object_name *name_ptr; @@ -292,6 +293,11 @@ static struct object *create_object( struct object *parent, const struct object_ name_ptr->obj = obj; obj->name = name_ptr; + if (attributes & OBJ_PERMANENT) + { + make_object_static( obj ); + grab_object( obj ); + } return obj; failed: @@ -340,7 +346,7 @@ void *create_named_object( struct object *parent, const struct object_ops *ops, return obj; } - new_obj = create_object( obj, ops, &new_name, sd ); + new_obj = create_object( obj, ops, &new_name, attributes, sd ); release_object( obj ); return new_obj; } @@ -401,6 +407,7 @@ void unlink_named_object( struct object *obj ) /* mark an object as being stored statically, i.e. only released at shutdown */ void make_object_static( struct object *obj ) { + obj->is_permanent = 1; #ifdef DEBUG_OBJECTS list_remove( &obj->obj_list ); list_add_head( &static_object_list, &obj->obj_list ); diff --git a/server/object.h b/server/object.h index f0b889d5899..fac35f0984e 100644 --- a/server/object.h +++ b/server/object.h @@ -105,6 +105,7 @@ struct object struct list wait_queue; struct object_name *name; struct security_descriptor *sd; + unsigned int is_permanent:1; #ifdef DEBUG_OBJECTS struct list obj_list; #endif