Zebediah Figura : server: Implement OBJ_PERMANENT.

Alexandre Julliard julliard at winehq.org
Thu Jul 16 19:01:21 CDT 2020


Module: wine
Branch: master
Commit: c7032e9222fdfd3b4364d6c729fa5ca6f0b35f69
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c7032e9222fdfd3b4364d6c729fa5ca6f0b35f69

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Jul 15 20:27:54 2020 -0500

server: Implement OBJ_PERMANENT.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/tests/driver.c | 12 ++++++------
 server/object.c                  | 11 +++++++++--
 server/object.h                  |  1 +
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index 0ae63ffafb..72d2272d5c 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 dacfe1d71a..6c0bb9be3a 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 f0b889d589..fac35f0984 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




More information about the wine-cvs mailing list