From 232c54eb1b8d4a75ea86d4ca585689e8d5d4b15b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 4 Dec 2015 10:36:47 +0100
Subject: [PATCH] server: Introduce a new alloc_handle object callback. (v2)

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
 server/async.c      |  2 ++
 server/atom.c       |  1 +
 server/change.c     |  1 +
 server/clipboard.c  |  1 +
 server/completion.c |  1 +
 server/console.c    |  4 ++++
 server/debugger.c   |  2 ++
 server/device.c     |  4 ++++
 server/directory.c  |  2 ++
 server/event.c      |  2 ++
 server/fd.c         |  4 ++++
 server/file.c       |  1 +
 server/handle.c     | 13 +++++++++++--
 server/hook.c       |  1 +
 server/mailslot.c   |  3 +++
 server/mapping.c    |  3 +++
 server/mutex.c      |  1 +
 server/named_pipe.c |  7 ++++++-
 server/object.c     |  4 ++++
 server/object.h     |  5 ++++-
 server/process.c    |  3 +++
 server/queue.c      |  2 ++
 server/registry.c   |  1 +
 server/request.c    |  1 +
 server/semaphore.c  |  1 +
 server/serial.c     |  1 +
 server/signal.c     |  1 +
 server/sock.c       |  2 ++
 server/symlink.c    |  1 +
 server/thread.c     |  3 +++
 server/timer.c      |  1 +
 server/token.c      |  1 +
 server/winstation.c |  2 ++
 33 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/server/async.c b/server/async.c
index 03994e8fac2..9feafd01847 100644
--- a/server/async.c
+++ b/server/async.c
@@ -81,6 +81,7 @@ static const struct object_ops async_ops =
     NULL,                      /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     async_destroy              /* destroy */
 };
@@ -494,6 +495,7 @@ static const struct object_ops iosb_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     no_close_handle,          /* close_handle */
     iosb_destroy              /* destroy */
 };
diff --git a/server/atom.c b/server/atom.c
index 57aff7b8918..04e301b0bc9 100644
--- a/server/atom.c
+++ b/server/atom.c
@@ -91,6 +91,7 @@ static const struct object_ops atom_table_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     atom_table_destroy            /* destroy */
 };
diff --git a/server/change.c b/server/change.c
index a8f3329c722..d0744e72f07 100644
--- a/server/change.c
+++ b/server/change.c
@@ -126,6 +126,7 @@ static const struct object_ops dir_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     dir_close_handle,         /* close_handle */
     dir_destroy               /* destroy */
 };
diff --git a/server/clipboard.c b/server/clipboard.c
index e6884dd75fa..dcc92507bc1 100644
--- a/server/clipboard.c
+++ b/server/clipboard.c
@@ -88,6 +88,7 @@ static const struct object_ops clipboard_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     clipboard_destroy             /* destroy */
 };
diff --git a/server/completion.c b/server/completion.c
index db04727b93b..e72a155eeeb 100644
--- a/server/completion.c
+++ b/server/completion.c
@@ -75,6 +75,7 @@ static const struct object_ops completion_ops =
     default_unlink_name,       /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     completion_destroy         /* destroy */
 };
diff --git a/server/console.c b/server/console.c
index 53910b3f46e..0290ef425d4 100644
--- a/server/console.c
+++ b/server/console.c
@@ -99,6 +99,7 @@ static const struct object_ops console_input_ops =
     NULL,                             /* unlink_name */
     console_input_open_file,          /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     console_input_destroy             /* destroy */
 };
@@ -157,6 +158,7 @@ static const struct object_ops console_input_events_ops =
     NULL,                             /* unlink_name */
     console_input_events_open_file,   /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     console_input_events_destroy      /* destroy */
 };
@@ -237,6 +239,7 @@ static const struct object_ops screen_buffer_ops =
     NULL,                             /* unlink_name */
     screen_buffer_open_file,          /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     screen_buffer_destroy             /* destroy */
 };
@@ -283,6 +286,7 @@ static const struct object_ops console_device_ops =
     default_unlink_name,              /* unlink_name */
     console_device_open_file,         /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     no_destroy                        /* destroy */
 };
diff --git a/server/debugger.c b/server/debugger.c
index 401ce36a47a..b7746d55c0e 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -84,6 +84,7 @@ static const struct object_ops debug_event_ops =
     NULL,                          /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     no_close_handle,               /* close_handle */
     debug_event_destroy            /* destroy */
 };
@@ -111,6 +112,7 @@ static const struct object_ops debug_ctx_ops =
     NULL,                          /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     no_close_handle,               /* close_handle */
     debug_ctx_destroy              /* destroy */
 };
diff --git a/server/device.c b/server/device.c
index 01e08f295f7..90150e1b251 100644
--- a/server/device.c
+++ b/server/device.c
@@ -79,6 +79,7 @@ static const struct object_ops irp_call_ops =
     NULL,                             /* unlink_name */
     no_open_file,                     /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     irp_call_destroy                  /* destroy */
 };
@@ -118,6 +119,7 @@ static const struct object_ops device_manager_ops =
     NULL,                             /* unlink_name */
     no_open_file,                     /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     device_manager_destroy            /* destroy */
 };
@@ -161,6 +163,7 @@ static const struct object_ops device_ops =
     default_unlink_name,              /* unlink_name */
     device_open_file,                 /* open_file */
     device_get_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     no_close_handle,                  /* close_handle */
     device_destroy                    /* destroy */
 };
@@ -210,6 +213,7 @@ static const struct object_ops device_file_ops =
     NULL,                             /* unlink_name */
     no_open_file,                     /* open_file */
     device_file_get_kernel_obj_list,  /* get_kernel_obj_list */
+    no_alloc_handle,                  /* alloc_handle */
     device_file_close_handle,         /* close_handle */
     device_file_destroy               /* destroy */
 };
diff --git a/server/directory.c b/server/directory.c
index 198fc48ece2..b735602a805 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -68,6 +68,7 @@ static const struct object_ops object_type_ops =
     default_unlink_name,          /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     no_destroy                    /* destroy */
 };
@@ -104,6 +105,7 @@ static const struct object_ops directory_ops =
     default_unlink_name,          /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     directory_destroy             /* destroy */
 };
diff --git a/server/event.c b/server/event.c
index d339d85aa45..a78d73d9e78 100644
--- a/server/event.c
+++ b/server/event.c
@@ -71,6 +71,7 @@ static const struct object_ops event_ops =
     default_unlink_name,       /* unlink_name */
     no_open_file,              /* open_file */
     event_get_kernel_obj_list, /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     no_destroy                 /* destroy */
 };
@@ -105,6 +106,7 @@ static const struct object_ops keyed_event_ops =
     default_unlink_name,         /* unlink_name */
     no_open_file,                /* open_file */
     no_kernel_obj_list,          /* get_kernel_obj_list */
+    no_alloc_handle,             /* alloc_handle */
     no_close_handle,             /* close_handle */
     no_destroy                   /* destroy */
 };
diff --git a/server/fd.c b/server/fd.c
index 7ea8ac273e5..a4741724fb6 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -221,6 +221,7 @@ static const struct object_ops fd_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     no_close_handle,          /* close_handle */
     fd_destroy                /* destroy */
 };
@@ -261,6 +262,7 @@ static const struct object_ops device_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     no_close_handle,          /* close_handle */
     device_destroy            /* destroy */
 };
@@ -300,6 +302,7 @@ static const struct object_ops inode_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     no_close_handle,          /* close_handle */
     inode_destroy             /* destroy */
 };
@@ -341,6 +344,7 @@ static const struct object_ops file_lock_ops =
     NULL,                       /* unlink_name */
     no_open_file,               /* open_file */
     no_kernel_obj_list,         /* get_kernel_obj_list */
+    no_alloc_handle,            /* alloc_handle */
     no_close_handle,            /* close_handle */
     no_destroy                  /* destroy */
 };
diff --git a/server/file.c b/server/file.c
index 38260cfd2b3..ba9358c0ee0 100644
--- a/server/file.c
+++ b/server/file.c
@@ -96,6 +96,7 @@ static const struct object_ops file_ops =
     NULL,                         /* unlink_name */
     file_open_file,               /* open_file */
     file_get_kernel_obj_list,     /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     fd_close_handle,              /* close_handle */
     file_destroy                  /* destroy */
 };
diff --git a/server/handle.c b/server/handle.c
index 9ae99cd0c63..5a3a357b991 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -134,6 +134,7 @@ static const struct object_ops handle_table_ops =
     NULL,                            /* unlink_name */
     no_open_file,                    /* open_file */
     no_kernel_obj_list,              /* get_kernel_obj_list */
+    no_alloc_handle,                 /* alloc_handle */
     no_close_handle,                 /* close_handle */
     handle_table_destroy             /* destroy */
 };
@@ -233,7 +234,7 @@ static int grow_handle_table( struct handle_table *table )
 }
 
 /* allocate the first free entry in the handle table */
-static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned int access )
+static obj_handle_t alloc_entry( struct handle_table *table, struct object *obj, unsigned int access )
 {
     struct handle_entry *entry = table->entries + table->free;
     int i;
@@ -249,6 +250,10 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned
     table->free = i + 1;
     entry->ptr    = grab_object_for_handle( obj );
     entry->access = access;
+
+    if (table->process)
+        obj->ops->alloc_handle( obj, table->process, index_to_handle(i) );
+
     return index_to_handle(i);
 }
 
@@ -374,7 +379,11 @@ struct handle_table *copy_handle_table( struct process *process, struct process
         for (i = 0; i <= table->last; i++, ptr++)
         {
             if (!ptr->ptr) continue;
-            if (ptr->access & RESERVED_INHERIT) grab_object_for_handle( ptr->ptr );
+            if (ptr->access & RESERVED_INHERIT)
+            {
+                ptr->ptr->ops->alloc_handle( ptr->ptr, process, index_to_handle(i) );
+                grab_object_for_handle( ptr->ptr );
+            }
             else ptr->ptr = NULL; /* don't inherit this entry */
         }
     }
diff --git a/server/hook.c b/server/hook.c
index ec6be582482..c2a26eb4dff 100644
--- a/server/hook.c
+++ b/server/hook.c
@@ -92,6 +92,7 @@ static const struct object_ops hook_table_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     hook_table_destroy            /* destroy */
 };
diff --git a/server/mailslot.c b/server/mailslot.c
index 58d650cbb25..5adae562289 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -89,6 +89,7 @@ static const struct object_ops mailslot_ops =
     default_unlink_name,       /* unlink_name */
     mailslot_open_file,        /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     fd_close_handle,           /* close_handle */
     mailslot_destroy           /* destroy */
 };
@@ -146,6 +147,7 @@ static const struct object_ops mail_writer_ops =
     NULL,                       /* unlink_name */
     no_open_file,               /* open_file */
     no_kernel_obj_list,         /* get_kernel_obj_list */
+    no_alloc_handle,            /* alloc_handle */
     fd_close_handle,            /* close_handle */
     mail_writer_destroy         /* destroy */
 };
@@ -208,6 +210,7 @@ static const struct object_ops mailslot_device_ops =
     default_unlink_name,            /* unlink_name */
     mailslot_device_open_file,      /* open_file */
     no_kernel_obj_list,             /* get_kernel_obj_list */
+    no_alloc_handle,                /* alloc_handle */
     no_close_handle,                /* close_handle */
     mailslot_device_destroy         /* destroy */
 };
diff --git a/server/mapping.c b/server/mapping.c
index db0debe0af5..952984381cc 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -79,6 +79,7 @@ static const struct object_ops ranges_ops =
     NULL,                      /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     ranges_destroy             /* destroy */
 };
@@ -114,6 +115,7 @@ static const struct object_ops shared_map_ops =
     NULL,                      /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     shared_map_destroy         /* destroy */
 };
@@ -171,6 +173,7 @@ static const struct object_ops mapping_ops =
     default_unlink_name,         /* unlink_name */
     no_open_file,                /* open_file */
     no_kernel_obj_list,          /* get_kernel_obj_list */
+    no_alloc_handle,             /* alloc_handle */
     fd_close_handle,             /* close_handle */
     mapping_destroy              /* destroy */
 };
diff --git a/server/mutex.c b/server/mutex.c
index 8a8f7248eae..3754c35acbb 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -72,6 +72,7 @@ static const struct object_ops mutex_ops =
     default_unlink_name,       /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     mutex_destroy              /* destroy */
 };
diff --git a/server/named_pipe.c b/server/named_pipe.c
index b259abb8de4..4ca744441f3 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -129,6 +129,7 @@ static const struct object_ops named_pipe_ops =
     default_unlink_name,          /* unlink_name */
     named_pipe_open_file,         /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     named_pipe_destroy            /* destroy */
 };
@@ -171,6 +172,7 @@ static const struct object_ops pipe_server_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     fd_close_handle,              /* close_handle */
     pipe_server_destroy           /* destroy */
 };
@@ -213,6 +215,7 @@ static const struct object_ops pipe_client_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     fd_close_handle,              /* close_handle */
     pipe_end_destroy              /* destroy */
 };
@@ -259,7 +262,8 @@ static const struct object_ops named_pipe_device_ops =
     default_unlink_name,              /* unlink_name */
     named_pipe_device_open_file,      /* open_file */
     no_kernel_obj_list,               /* get_kernel_obj_list */
-    no_close_handle,                  /* close_handle */
+    no_alloc_handle,                  /* alloc_handle */
+    fd_close_handle,                  /* close_handle */
     named_pipe_device_destroy         /* destroy */
 };
 
@@ -288,6 +292,7 @@ static const struct object_ops named_pipe_device_file_ops =
     NULL,                                    /* unlink_name */
     no_open_file,                            /* open_file */
     no_kernel_obj_list,                      /* get_kernel_obj_list */
+    no_alloc_handle,                         /* alloc_handle */
     fd_close_handle,                         /* close_handle */
     named_pipe_device_file_destroy           /* destroy */
 };
diff --git a/server/object.c b/server/object.c
index 8ec6609f69d..c319cfc4876 100644
--- a/server/object.c
+++ b/server/object.c
@@ -711,6 +711,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i
     return NULL;
 }
 
+void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle )
+{
+}
+
 int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
 {
     return 1;  /* ok to close */
diff --git a/server/object.h b/server/object.h
index 1f5c4a5f061..d47abbc3e43 100644
--- a/server/object.h
+++ b/server/object.h
@@ -91,8 +91,10 @@ struct object_ops
                                 unsigned int options);
     /* return list of kernel objects */
     struct list *(*get_kernel_obj_list)(struct object *);
+    /* allocate a handle to this object */
+    void (*alloc_handle)(struct object *, struct process *, obj_handle_t);
     /* close a handle to this object */
-    int (*close_handle)(struct object *,struct process *,obj_handle_t);
+    int (*close_handle)(struct object *, struct process *, obj_handle_t);
     /* destroy on refcount == 0 */
     void (*destroy)(struct object *);
 };
@@ -170,6 +172,7 @@ extern void default_unlink_name( struct object *obj, struct object_name *name );
 extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
                                     unsigned int options );
 extern struct list *no_kernel_obj_list( struct object *obj );
+extern void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle );
 extern int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
 extern void no_destroy( struct object *obj );
 #ifdef DEBUG_OBJECTS
diff --git a/server/process.c b/server/process.c
index 5e587b28cbe..7928d0ceb68 100644
--- a/server/process.c
+++ b/server/process.c
@@ -89,6 +89,7 @@ static const struct object_ops process_ops =
     NULL,                        /* unlink_name */
     no_open_file,                /* open_file */
     process_get_kernel_obj_list, /* get_kernel_obj_list */
+    no_alloc_handle,             /* alloc_handle */
     no_close_handle,             /* close_handle */
     process_destroy              /* destroy */
 };
@@ -139,6 +140,7 @@ static const struct object_ops startup_info_ops =
     NULL,                          /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     no_close_handle,               /* close_handle */
     startup_info_destroy           /* destroy */
 };
@@ -184,6 +186,7 @@ static const struct object_ops job_ops =
     default_unlink_name,           /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     job_close_handle,              /* close_handle */
     job_destroy                    /* destroy */
 };
diff --git a/server/queue.c b/server/queue.c
index a65eab38bdc..d658c48323f 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -182,6 +182,7 @@ static const struct object_ops msg_queue_ops =
     NULL,                      /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     msg_queue_destroy          /* destroy */
 };
@@ -218,6 +219,7 @@ static const struct object_ops thread_input_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     thread_input_destroy          /* destroy */
 };
diff --git a/server/registry.c b/server/registry.c
index dcbb3f791e1..6e5eddcd257 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -170,6 +170,7 @@ static const struct object_ops key_ops =
     NULL,                    /* unlink_name */
     no_open_file,            /* open_file */
     no_kernel_obj_list,      /* get_kernel_obj_list */
+    no_alloc_handle,         /* alloc_handle */
     key_close_handle,        /* close_handle */
     key_destroy              /* destroy */
 };
diff --git a/server/request.c b/server/request.c
index 4c1f30a5fe7..42cc83c3037 100644
--- a/server/request.c
+++ b/server/request.c
@@ -107,6 +107,7 @@ static const struct object_ops master_socket_ops =
     NULL,                          /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     no_close_handle,               /* close_handle */
     master_socket_destroy          /* destroy */
 };
diff --git a/server/semaphore.c b/server/semaphore.c
index 6e2415fd79a..457cd6f4558 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -69,6 +69,7 @@ static const struct object_ops semaphore_ops =
     default_unlink_name,           /* unlink_name */
     no_open_file,                  /* open_file */
     no_kernel_obj_list,            /* get_kernel_obj_list */
+    no_alloc_handle,               /* alloc_handle */
     no_close_handle,               /* close_handle */
     no_destroy                     /* destroy */
 };
diff --git a/server/serial.c b/server/serial.c
index 4292472613a..ecb9a9350ad 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -103,6 +103,7 @@ static const struct object_ops serial_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     fd_close_handle,              /* close_handle */
     serial_destroy                /* destroy */
 };
diff --git a/server/signal.c b/server/signal.c
index c81f6b8e989..b8dd87d86f1 100644
--- a/server/signal.c
+++ b/server/signal.c
@@ -78,6 +78,7 @@ static const struct object_ops handler_ops =
     NULL,                     /* unlink_name */
     no_open_file,             /* open_file */
     no_kernel_obj_list,       /* get_kernel_obj_list */
+    no_alloc_handle,          /* alloc_handle */
     no_close_handle,          /* close_handle */
     handler_destroy           /* destroy */
 };
diff --git a/server/sock.c b/server/sock.c
index 5095a6ef9f0..7b10b74cc4e 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -155,6 +155,7 @@ static const struct object_ops sock_ops =
     NULL,                         /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     fd_close_handle,              /* close_handle */
     sock_destroy                  /* destroy */
 };
@@ -970,6 +971,7 @@ static const struct object_ops ifchange_ops =
     NULL,                    /* unlink_name */
     no_open_file,            /* open_file */
     no_kernel_obj_list,      /* get_kernel_obj_list */
+    no_alloc_handle,         /* alloc_handle */
     no_close_handle,         /* close_handle */
     ifchange_destroy         /* destroy */
 };
diff --git a/server/symlink.c b/server/symlink.c
index 7a2f8642d5f..7bb28c8d7ce 100644
--- a/server/symlink.c
+++ b/server/symlink.c
@@ -71,6 +71,7 @@ static const struct object_ops symlink_ops =
     default_unlink_name,          /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     no_close_handle,              /* close_handle */
     symlink_destroy               /* destroy */
 };
diff --git a/server/thread.c b/server/thread.c
index 9b14174578e..e3783351eb1 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -121,6 +121,7 @@ static const struct object_ops thread_apc_ops =
     NULL,                       /* unlink_name */
     no_open_file,               /* open_file */
     no_kernel_obj_list,         /* get_kernel_obj_list */
+    no_alloc_handle,            /* alloc_handle */
     no_close_handle,            /* close_handle */
     thread_apc_destroy          /* destroy */
 };
@@ -157,6 +158,7 @@ static const struct object_ops context_ops =
     NULL,                       /* unlink_name */
     no_open_file,               /* open_file */
     no_kernel_obj_list,         /* get_kernel_obj_list */
+    no_alloc_handle,            /* alloc_handle */
     no_close_handle,            /* close_handle */
     no_destroy                  /* destroy */
 };
@@ -191,6 +193,7 @@ static const struct object_ops thread_ops =
     NULL,                       /* unlink_name */
     no_open_file,               /* open_file */
     thread_get_kernel_obj_list, /* get_kernel_obj_list */
+    no_alloc_handle,            /* alloc_handle */
     no_close_handle,            /* close_handle */
     destroy_thread              /* destroy */
 };
diff --git a/server/timer.c b/server/timer.c
index 6460acbf519..2b5ae29a45a 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -76,6 +76,7 @@ static const struct object_ops timer_ops =
     default_unlink_name,       /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     timer_destroy              /* destroy */
 };
diff --git a/server/token.c b/server/token.c
index 2fa95e17aaf..8464eaf83eb 100644
--- a/server/token.c
+++ b/server/token.c
@@ -157,6 +157,7 @@ static const struct object_ops token_ops =
     NULL,                      /* unlink_name */
     no_open_file,              /* open_file */
     no_kernel_obj_list,        /* get_kernel_obj_list */
+    no_alloc_handle,           /* alloc_handle */
     no_close_handle,           /* close_handle */
     token_destroy              /* destroy */
 };
diff --git a/server/winstation.c b/server/winstation.c
index 2962ea0df4a..79a38d4069e 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -75,6 +75,7 @@ static const struct object_ops winstation_ops =
     default_unlink_name,          /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     winstation_close_handle,      /* close_handle */
     winstation_destroy            /* destroy */
 };
@@ -99,6 +100,7 @@ static const struct object_ops desktop_ops =
     default_unlink_name,          /* unlink_name */
     no_open_file,                 /* open_file */
     no_kernel_obj_list,           /* get_kernel_obj_list */
+    no_alloc_handle,              /* alloc_handle */
     desktop_close_handle,         /* close_handle */
     desktop_destroy               /* destroy */
 };
-- 
2.27.0

