[PATCH 2/6] server: Implement OBJ_PERMANENT.

Zebediah Figura z.figura12 at gmail.com
Wed Jul 15 18:34:16 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 server/object.c | 11 +++++++++--
 server/object.h |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

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
-- 
2.27.0




More information about the wine-devel mailing list