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

This commit is contained in:
Alexandre Julliard 2005-12-12 15:03:07 +01:00
parent 32a93960ba
commit 46d1b3e8da
2 changed files with 22 additions and 2 deletions

View File

@ -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 );

View File

@ -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 )
{