From 7e71c1ddee5238760d439c28fd84a77d174640ec Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 22 Mar 2007 11:44:29 +0100 Subject: [PATCH] server: Add an open_file() function to the object operations. --- server/async.c | 1 + server/atom.c | 1 + server/change.c | 1 + server/clipboard.c | 1 + server/console.c | 3 +++ server/debugger.c | 2 ++ server/directory.c | 1 + server/event.c | 1 + server/fd.c | 4 ++++ server/file.c | 1 + server/handle.c | 1 + server/hook.c | 1 + server/mailslot.c | 3 +++ server/mapping.c | 1 + server/mutex.c | 1 + server/named_pipe.c | 4 ++++ server/object.c | 7 +++++++ server/object.h | 5 +++++ server/process.c | 2 ++ 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/snapshot.c | 1 + server/sock.c | 1 + server/symlink.c | 1 + server/thread.c | 2 ++ server/timer.c | 1 + server/token.c | 1 + server/winstation.c | 2 ++ 32 files changed, 57 insertions(+) diff --git a/server/async.c b/server/async.c index 2d8018a0f7..aa4db4e7a5 100644 --- a/server/async.c +++ b/server/async.c @@ -57,6 +57,7 @@ static const struct object_ops async_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ async_destroy /* destroy */ }; diff --git a/server/atom.c b/server/atom.c index 8c190a40de..d23ec3e9eb 100644 --- a/server/atom.c +++ b/server/atom.c @@ -84,6 +84,7 @@ static const struct object_ops atom_table_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ atom_table_destroy /* destroy */ }; diff --git a/server/change.c b/server/change.c index 4ecbc46442..db5034208e 100644 --- a/server/change.c +++ b/server/change.c @@ -177,6 +177,7 @@ static const struct object_ops dir_ops = dir_get_fd, /* get_fd */ dir_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ dir_destroy /* destroy */ }; diff --git a/server/clipboard.c b/server/clipboard.c index 399f37e9d3..764d89c9a3 100644 --- a/server/clipboard.c +++ b/server/clipboard.c @@ -60,6 +60,7 @@ static const struct object_ops clipboard_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; diff --git a/server/console.c b/server/console.c index 64601fbecb..cb34cb3010 100644 --- a/server/console.c +++ b/server/console.c @@ -59,6 +59,7 @@ static const struct object_ops console_input_ops = no_get_fd, /* get_fd */ console_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ console_input_destroy /* destroy */ }; @@ -87,6 +88,7 @@ static const struct object_ops console_input_events_ops = no_get_fd, /* get_fd */ console_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ console_input_events_destroy /* destroy */ }; @@ -126,6 +128,7 @@ static const struct object_ops screen_buffer_ops = no_get_fd, /* get_fd */ console_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ screen_buffer_destroy /* destroy */ }; diff --git a/server/debugger.c b/server/debugger.c index 72de05fc19..85ab63a4fe 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -78,6 +78,7 @@ static const struct object_ops debug_event_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ debug_event_destroy /* destroy */ }; @@ -98,6 +99,7 @@ static const struct object_ops debug_ctx_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ debug_ctx_destroy /* destroy */ }; diff --git a/server/directory.c b/server/directory.c index 7779c31e57..006d95998b 100644 --- a/server/directory.c +++ b/server/directory.c @@ -65,6 +65,7 @@ static const struct object_ops directory_ops = no_get_fd, /* get_fd */ directory_map_access, /* map_access */ directory_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ directory_destroy /* destroy */ }; diff --git a/server/event.c b/server/event.c index 47dde24ae7..a7d65b36be 100644 --- a/server/event.c +++ b/server/event.c @@ -60,6 +60,7 @@ static const struct object_ops event_ops = no_get_fd, /* get_fd */ event_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; diff --git a/server/fd.c b/server/fd.c index 7d9e7f0c9a..cefdc16297 100644 --- a/server/fd.c +++ b/server/fd.c @@ -190,6 +190,7 @@ static const struct object_ops fd_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ fd_destroy /* destroy */ }; @@ -223,6 +224,7 @@ static const struct object_ops device_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ device_destroy /* destroy */ }; @@ -255,6 +257,7 @@ static const struct object_ops inode_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ inode_destroy /* destroy */ }; @@ -289,6 +292,7 @@ static const struct object_ops file_lock_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; diff --git a/server/file.c b/server/file.c index 050f72382c..193f5d3825 100644 --- a/server/file.c +++ b/server/file.c @@ -84,6 +84,7 @@ static const struct object_ops file_ops = file_get_fd, /* get_fd */ file_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ file_destroy /* destroy */ }; diff --git a/server/handle.c b/server/handle.c index 9fc8b609e5..4b35e8b346 100644 --- a/server/handle.c +++ b/server/handle.c @@ -112,6 +112,7 @@ static const struct object_ops handle_table_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ handle_table_destroy /* destroy */ }; diff --git a/server/hook.c b/server/hook.c index 6137b58190..c9bf3dbbb2 100644 --- a/server/hook.c +++ b/server/hook.c @@ -85,6 +85,7 @@ static const struct object_ops hook_table_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ hook_table_destroy /* destroy */ }; diff --git a/server/mailslot.c b/server/mailslot.c index f2c191539e..af2b25bbe6 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -80,6 +80,7 @@ static const struct object_ops mailslot_ops = mailslot_get_fd, /* get_fd */ mailslot_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ mailslot_destroy /* destroy */ }; @@ -124,6 +125,7 @@ static const struct object_ops mail_writer_ops = mail_writer_get_fd, /* get_fd */ mail_writer_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ mail_writer_destroy /* destroy */ }; @@ -167,6 +169,7 @@ static const struct object_ops mailslot_device_ops = mailslot_device_get_fd, /* get_fd */ no_map_access, /* map_access */ mailslot_device_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ mailslot_device_destroy /* destroy */ }; diff --git a/server/mapping.c b/server/mapping.c index 566f6dc1ea..7b99134297 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -68,6 +68,7 @@ static const struct object_ops mapping_ops = mapping_get_fd, /* get_fd */ mapping_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ mapping_destroy /* destroy */ }; diff --git a/server/mutex.c b/server/mutex.c index c70f24f0ad..7d330e2fe5 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -63,6 +63,7 @@ static const struct object_ops mutex_ops = no_get_fd, /* get_fd */ mutex_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ mutex_destroy /* destroy */ }; diff --git a/server/named_pipe.c b/server/named_pipe.c index a9ca5b11b1..0e1aeabe02 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -122,6 +122,7 @@ static const struct object_ops named_pipe_ops = no_get_fd, /* get_fd */ named_pipe_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ named_pipe_destroy /* destroy */ }; @@ -148,6 +149,7 @@ static const struct object_ops pipe_server_ops = pipe_server_get_fd, /* get_fd */ pipe_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ pipe_server_destroy /* destroy */ }; @@ -181,6 +183,7 @@ static const struct object_ops pipe_client_ops = pipe_client_get_fd, /* get_fd */ pipe_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ pipe_client_destroy /* destroy */ }; @@ -214,6 +217,7 @@ static const struct object_ops named_pipe_device_ops = named_pipe_device_get_fd, /* get_fd */ pipe_map_access, /* map_access */ named_pipe_device_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ named_pipe_device_destroy /* destroy */ }; diff --git a/server/object.c b/server/object.c index 095d01814f..7f44b71ed1 100644 --- a/server/object.c +++ b/server/object.c @@ -371,6 +371,13 @@ struct object *no_lookup_name( struct object *obj, struct unicode_str *name, return NULL; } +struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing, + unsigned int options ) +{ + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + return NULL; +} + 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 a2d702958c..a6632ba137 100644 --- a/server/object.h +++ b/server/object.h @@ -76,6 +76,9 @@ struct object_ops unsigned int (*map_access)(struct object *, unsigned int); /* lookup a name if an object has a namespace */ struct object *(*lookup_name)(struct object *, struct unicode_str *,unsigned int); + /* open a file object to access this object */ + struct object *(*open_file)(struct object *, unsigned int access, unsigned int sharing, + unsigned int options); /* close a handle to this object */ int (*close_handle)(struct object *,struct process *,obj_handle_t); /* destroy on refcount == 0 */ @@ -125,6 +128,8 @@ extern int no_signal( struct object *obj, unsigned int access ); extern struct fd *no_get_fd( struct object *obj ); extern unsigned int no_map_access( struct object *obj, unsigned int access ); extern struct object *no_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attributes ); +extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing, + unsigned int options ); 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 1c53f49cf2..f947d6dfd4 100644 --- a/server/process.c +++ b/server/process.c @@ -75,6 +75,7 @@ static const struct object_ops process_ops = no_get_fd, /* get_fd */ process_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ process_destroy /* destroy */ }; @@ -119,6 +120,7 @@ static const struct object_ops startup_info_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ startup_info_destroy /* destroy */ }; diff --git a/server/queue.c b/server/queue.c index a9d8448f63..197315270d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -155,6 +155,7 @@ static const struct object_ops msg_queue_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ msg_queue_destroy /* destroy */ }; @@ -172,6 +173,7 @@ static const struct object_ops thread_input_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ thread_input_destroy /* destroy */ }; diff --git a/server/registry.c b/server/registry.c index d27d51c0e7..6e5e767f69 100644 --- a/server/registry.c +++ b/server/registry.c @@ -150,6 +150,7 @@ static const struct object_ops key_ops = no_get_fd, /* get_fd */ key_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ key_close_handle, /* close_handle */ key_destroy /* destroy */ }; diff --git a/server/request.c b/server/request.c index c01a70ea87..20fe4356fa 100644 --- a/server/request.c +++ b/server/request.c @@ -97,6 +97,7 @@ static const struct object_ops master_socket_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ master_socket_destroy /* destroy */ }; diff --git a/server/semaphore.c b/server/semaphore.c index da6719e161..cd4080f4f3 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -60,6 +60,7 @@ static const struct object_ops semaphore_ops = no_get_fd, /* get_fd */ semaphore_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; diff --git a/server/serial.c b/server/serial.c index 40724d8929..d459426a51 100644 --- a/server/serial.c +++ b/server/serial.c @@ -104,6 +104,7 @@ static const struct object_ops serial_ops = serial_get_fd, /* get_fd */ serial_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ serial_destroy /* destroy */ }; diff --git a/server/signal.c b/server/signal.c index 006a470273..7b388e1305 100644 --- a/server/signal.c +++ b/server/signal.c @@ -71,6 +71,7 @@ static const struct object_ops handler_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ handler_destroy /* destroy */ }; diff --git a/server/snapshot.c b/server/snapshot.c index fafe65ce1c..14ec97bd04 100644 --- a/server/snapshot.c +++ b/server/snapshot.c @@ -69,6 +69,7 @@ static const struct object_ops snapshot_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ snapshot_destroy /* destroy */ }; diff --git a/server/sock.c b/server/sock.c index e8d6ef3e2d..f1b7255122 100644 --- a/server/sock.c +++ b/server/sock.c @@ -114,6 +114,7 @@ static const struct object_ops sock_ops = sock_get_fd, /* get_fd */ sock_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ fd_close_handle, /* close_handle */ sock_destroy /* destroy */ }; diff --git a/server/symlink.c b/server/symlink.c index c3f9cedd2a..4c06b85dfb 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -63,6 +63,7 @@ static const struct object_ops symlink_ops = no_get_fd, /* get_fd */ symlink_map_access, /* map_access */ symlink_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ symlink_destroy /* destroy */ }; diff --git a/server/thread.c b/server/thread.c index dfa7411045..ec1b16170f 100644 --- a/server/thread.c +++ b/server/thread.c @@ -94,6 +94,7 @@ static const struct object_ops thread_apc_ops = no_get_fd, /* get_fd */ no_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ thread_apc_destroy /* destroy */ }; @@ -119,6 +120,7 @@ static const struct object_ops thread_ops = no_get_fd, /* get_fd */ thread_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ destroy_thread /* destroy */ }; diff --git a/server/timer.c b/server/timer.c index 9ffa64972b..dd53020b44 100644 --- a/server/timer.c +++ b/server/timer.c @@ -68,6 +68,7 @@ static const struct object_ops timer_ops = no_get_fd, /* get_fd */ timer_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ timer_destroy /* destroy */ }; diff --git a/server/token.c b/server/token.c index 1325058f29..8bbe29e6ba 100644 --- a/server/token.c +++ b/server/token.c @@ -128,6 +128,7 @@ static const struct object_ops token_ops = no_get_fd, /* get_fd */ token_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ no_close_handle, /* close_handle */ token_destroy /* destroy */ }; diff --git a/server/winstation.c b/server/winstation.c index 5d2418d232..14abb3c906 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -64,6 +64,7 @@ static const struct object_ops winstation_ops = no_get_fd, /* get_fd */ winstation_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ winstation_close_handle, /* close_handle */ winstation_destroy /* destroy */ }; @@ -81,6 +82,7 @@ static const struct object_ops desktop_ops = no_get_fd, /* get_fd */ desktop_map_access, /* map_access */ no_lookup_name, /* lookup_name */ + no_open_file, /* open_file */ desktop_close_handle, /* close_handle */ desktop_destroy /* destroy */ }; -- 2.32.0.93.g670b81a890