Commit 46d1b3e8 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Added access rights mapping to process and thread objects.

parent 32a93960
......@@ -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_ops =
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 object *obj, struct thread *thread )
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 );
......
......@@ -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_ops =
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 object *obj, struct thread *thread )
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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment