server: Add object type to struct object

Vitaliy Margolen wine-patch at kievinfo.com
Sat Oct 29 11:00:40 CDT 2005


This is by far not what native does. But we are not implementing the whole
kernel here. So having just an object type ID will work just fine for what
we need.

Vitaliy Margolen

changelog:
  server
  - Add object type to struct object
-------------- next part --------------
Index: server/object.h
===================================================================
RCS file: /home/wine/wine/server/object.h,v
retrieving revision 1.67
diff -u -p -r1.67 object.h
--- server/object.h	29 Oct 2005 12:38:23 -0000	1.67
+++ server/object.h	29 Oct 2005 15:54:35 -0000
@@ -29,6 +29,31 @@
 #include "wine/server_protocol.h"
 #include "wine/list.h"
 
+#define OB_TYPE_NONE                    0
+#define OB_TYPE_TYPE                    1
+#define OB_TYPE_DIRECTORY               2
+#define OB_TYPE_SYMBOLIC_LINK           3
+#define OB_TYPE_TOKEN                   4
+#define OB_TYPE_PROCESS                 5
+#define OB_TYPE_THREAD                  6
+#define OB_TYPE_EVENT                   7
+#define OB_TYPE_EVENT_PAIR              8
+#define OB_TYPE_MUTANT                  9
+#define OB_TYPE_SEMAPHORE               10
+#define OB_TYPE_TIMER                   11
+#define OB_TYPE_PROFILE                 12
+#define OB_TYPE_WINDOW_STATION          13
+#define OB_TYPE_DESKTOP                 14
+#define OB_TYPE_SECTION                 15
+#define OB_TYPE_KEY                     16
+#define OB_TYPE_PORT                    17
+#define OB_TYPE_ADAPTER                 18
+#define OB_TYPE_CONTROLLER              19
+#define OB_TYPE_DEVICE                  20
+#define OB_TYPE_DRIVER                  21
+#define OB_TYPE_IO_COMPLETION           22
+#define OB_TYPE_FILE                    23
+
 #define DEBUG_OBJECTS
 
 /* kernel objects */
@@ -72,6 +97,7 @@ struct object_ops
 
 struct object
 {
+    unsigned short            type;        /* object type */
     unsigned int              refcount;    /* reference count */
     const struct object_ops  *ops;
     struct list               wait_queue;
Index: server/event.c
===================================================================
RCS file: /home/wine/wine/server/event.c,v
retrieving revision 1.33
diff -u -p -r1.33 event.c
--- server/event.c	29 Oct 2005 12:38:23 -0000	1.33
+++ server/event.c	29 Oct 2005 15:54:34 -0000
@@ -69,6 +69,7 @@ struct event *create_event( const WCHAR 
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            event->obj.type     = OB_TYPE_EVENT;
             event->manual_reset = manual_reset;
             event->signaled     = initial_state;
         }
Index: server/mapping.c
===================================================================
RCS file: /home/wine/wine/server/mapping.c,v
retrieving revision 1.58
diff -u -p -r1.58 mapping.c
--- server/mapping.c	29 Oct 2005 12:38:23 -0000	1.58
+++ server/mapping.c	29 Oct 2005 15:54:35 -0000
@@ -283,6 +283,7 @@ static struct object *create_mapping( co
     if (get_error() == STATUS_OBJECT_NAME_COLLISION)
         return &mapping->obj;  /* Nothing else to do */
 
+    mapping->obj.type    = OB_TYPE_SECTION;
     mapping->header_size = 0;
     mapping->base        = NULL;
     mapping->shared_file = NULL;
Index: server/mutex.c
===================================================================
RCS file: /home/wine/wine/server/mutex.c,v
retrieving revision 1.31
diff -u -p -r1.31 mutex.c
--- server/mutex.c	29 Oct 2005 12:38:23 -0000	1.31
+++ server/mutex.c	29 Oct 2005 15:54:35 -0000
@@ -72,6 +72,7 @@ static struct mutex *create_mutex( const
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            mutex->obj.type = OB_TYPE_MUTANT;
             mutex->count = 0;
             mutex->owner = NULL;
             mutex->abandoned = 0;
Index: server/named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.50
diff -u -p -r1.50 named_pipe.c
--- server/named_pipe.c	29 Oct 2005 12:38:23 -0000	1.50
+++ server/named_pipe.c	29 Oct 2005 15:54:35 -0000
@@ -450,6 +450,7 @@ static struct named_pipe *create_named_p
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            pipe->obj.type = OB_TYPE_FILE;
             pipe->instances = 0;
             list_init( &pipe->servers );
             list_init( &pipe->waiters );
@@ -554,6 +555,7 @@ DECL_HANDLER(create_named_pipe)
 
     if (get_error() != STATUS_OBJECT_NAME_COLLISION)
     {
+        pipe->obj.type = OB_TYPE_FILE;
         pipe->insize = req->insize;
         pipe->outsize = req->outsize;
         pipe->maxinstances = req->maxinstances;
Index: server/object.c
===================================================================
RCS file: /home/wine/wine/server/object.c,v
retrieving revision 1.35
diff -u -p -r1.35 object.c
--- server/object.c	29 Oct 2005 12:38:23 -0000	1.35
+++ server/object.c	29 Oct 2005 15:54:35 -0000
@@ -144,6 +144,7 @@ void *alloc_object( const struct object_
     struct object *obj = mem_alloc( ops->size );
     if (obj)
     {
+        obj->type     = OB_TYPE_NONE;
         obj->refcount = 1;
         obj->ops      = ops;
         obj->name     = NULL;
Index: server/semaphore.c
===================================================================
RCS file: /home/wine/wine/server/semaphore.c,v
retrieving revision 1.31
diff -u -p -r1.31 semaphore.c
--- server/semaphore.c	29 Oct 2005 12:38:23 -0000	1.31
+++ server/semaphore.c	29 Oct 2005 15:54:35 -0000
@@ -74,6 +74,7 @@ static struct semaphore *create_semaphor
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            sem->obj.type = OB_TYPE_SEMAPHORE;
             sem->count = initial;
             sem->max   = max;
         }
Index: server/timer.c
===================================================================
RCS file: /home/wine/wine/server/timer.c,v
retrieving revision 1.30
diff -u -p -r1.30 timer.c
--- server/timer.c	29 Oct 2005 12:38:23 -0000	1.30
+++ server/timer.c	29 Oct 2005 15:54:35 -0000
@@ -78,6 +78,7 @@ static struct timer *create_timer( const
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            timer->obj.type     = OB_TYPE_TIMER;
             timer->manual       = manual;
             timer->signaled     = 0;
             timer->when.tv_sec  = 0;
Index: server/winstation.c
===================================================================
RCS file: /home/wine/wine/server/winstation.c,v
retrieving revision 1.12
diff -u -p -r1.12 winstation.c
--- server/winstation.c	29 Oct 2005 12:38:23 -0000	1.12
+++ server/winstation.c	29 Oct 2005 15:54:35 -0000
@@ -99,6 +99,7 @@ static struct winstation *create_winstat
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            winstation->obj.type = OB_TYPE_WINDOW_STATION;
             winstation->flags = flags;
             winstation->clipboard = NULL;
             winstation->atom_table = NULL;
@@ -189,6 +190,7 @@ static struct desktop *create_desktop( c
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
             /* initialize it if it didn't already exist */
+            desktop->obj.type = OB_TYPE_DESKTOP;
             desktop->flags = flags;
             desktop->winstation = (struct winstation *)grab_object( winstation );
             desktop->top_window = NULL;


More information about the wine-patches mailing list