Module: wine Branch: refs/heads/master Commit: 46d1b3e8da47999f7d8d58be8802eadae8321b21 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=46d1b3e8da47999f7d8d58be...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Dec 12 15:03:07 2005 +0100
server: Added access rights mapping to process and thread objects.
---
server/process.c | 12 +++++++++++- server/thread.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/server/process.c b/server/process.c index 83cd716..c1657e4 100644 --- a/server/process.c +++ b/server/process.c @@ -59,6 +59,7 @@ static int running_processes;
static void process_dump( struct object *obj, int verbose ); static int process_signaled( struct object *obj, struct thread *thread ); +static unsigned int process_map_access( struct object *obj, unsigned int access ); static void process_poll_event( struct fd *fd, int event ); static void process_destroy( struct object *obj );
@@ -72,7 +73,7 @@ static const struct object_ops process_o no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - no_map_access, /* map_access */ + process_map_access, /* map_access */ no_lookup_name, /* lookup_name */ no_close_handle, /* close_handle */ process_destroy /* destroy */ @@ -415,6 +416,15 @@ static int process_signaled( struct obje return !process->running_threads; }
+static unsigned int process_map_access( struct object *obj, unsigned int access ) +{ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | SYNCHRONIZE; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | SYNCHRONIZE; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE; + if (access & GENERIC_ALL) access |= PROCESS_ALL_ACCESS; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + static void process_poll_event( struct fd *fd, int event ) { struct process *process = get_fd_user( fd ); diff --git a/server/thread.c b/server/thread.c index 9e2481e..507eed5 100644 --- a/server/thread.c +++ b/server/thread.c @@ -83,6 +83,7 @@ struct thread_apc
static void dump_thread( struct object *obj, int verbose ); static int thread_signaled( struct object *obj, struct thread *thread ); +static unsigned int thread_map_access( struct object *obj, unsigned int access ); static void thread_poll_event( struct fd *fd, int event ); static void destroy_thread( struct object *obj ); static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system_only ); @@ -97,7 +98,7 @@ static const struct object_ops thread_op no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - no_map_access, /* map_access */ + thread_map_access, /* map_access */ no_lookup_name, /* lookup_name */ no_close_handle, /* close_handle */ destroy_thread /* destroy */ @@ -271,6 +272,15 @@ static int thread_signaled( struct objec return (mythread->state == TERMINATED); }
+static unsigned int thread_map_access( struct object *obj, unsigned int access ) +{ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | SYNCHRONIZE; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | SYNCHRONIZE; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE; + if (access & GENERIC_ALL) access |= THREAD_ALL_ACCESS; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + /* get a thread pointer from a thread id (and increment the refcount) */ struct thread *get_thread_from_id( thread_id_t id ) {