server: Added infrastructure for access rights mapping.
diff --git a/server/atom.c b/server/atom.c
index e42a503..bf5851e 100644
--- a/server/atom.c
+++ b/server/atom.c
@@ -82,6 +82,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     atom_table_destroy            /* destroy */
diff --git a/server/change.c b/server/change.c
index 661cb87..b3fead1 100644
--- a/server/change.c
+++ b/server/change.c
@@ -76,6 +76,7 @@
     no_satisfied,             /* satisfied */
     no_signal,                /* signal */
     no_get_fd,                /* get_fd */
+    no_map_access,            /* map_access */
     no_lookup_name,           /* lookup_name */
     no_close_handle,          /* close_handle */
     change_destroy            /* destroy */
diff --git a/server/clipboard.c b/server/clipboard.c
index 3aa7f01..3963885 100644
--- a/server/clipboard.c
+++ b/server/clipboard.c
@@ -58,6 +58,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     no_destroy                    /* destroy */
diff --git a/server/console.c b/server/console.c
index 56d359c..9cf606c 100644
--- a/server/console.c
+++ b/server/console.c
@@ -51,6 +51,7 @@
     no_satisfied,                     /* satisfied */
     no_signal,                        /* signal */
     no_get_fd,                        /* get_fd */
+    no_map_access,                    /* map_access */
     no_lookup_name,                   /* lookup_name */
     no_close_handle,                  /* close_handle */
     console_input_destroy             /* destroy */
@@ -78,6 +79,7 @@
     no_satisfied,                     /* satisfied */
     no_signal,                        /* signal */
     no_get_fd,                        /* get_fd */
+    no_map_access,                    /* map_access */
     no_lookup_name,                   /* lookup_name */
     no_close_handle,                  /* close_handle */
     console_input_events_destroy      /* destroy */
@@ -116,6 +118,7 @@
     NULL,                             /* satisfied */
     no_signal,                        /* signal */
     no_get_fd,                        /* get_fd */
+    no_map_access,                    /* map_access */
     no_lookup_name,                   /* lookup_name */
     no_close_handle,                  /* close_handle */
     screen_buffer_destroy             /* destroy */
diff --git a/server/debugger.c b/server/debugger.c
index f40f494..e326516 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -76,6 +76,7 @@
     no_satisfied,                  /* satisfied */
     no_signal,                     /* signal */
     no_get_fd,                     /* get_fd */
+    no_map_access,                 /* map_access */
     no_lookup_name,                /* lookup_name */
     no_close_handle,               /* close_handle */
     debug_event_destroy            /* destroy */
@@ -95,6 +96,7 @@
     no_satisfied,                  /* satisfied */
     no_signal,                     /* signal */
     no_get_fd,                     /* get_fd */
+    no_map_access,                 /* map_access */
     no_lookup_name,                /* lookup_name */
     no_close_handle,               /* close_handle */
     debug_ctx_destroy              /* destroy */
diff --git a/server/directory.c b/server/directory.c
index 6f14833..d4ec59b 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -62,6 +62,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     directory_lookup_name,        /* lookup_name */
     no_close_handle,              /* close_handle */
     directory_destroy             /* destroy */
diff --git a/server/event.c b/server/event.c
index adbbb11..d6c8fef 100644
--- a/server/event.c
+++ b/server/event.c
@@ -57,6 +57,7 @@
     event_satisfied,           /* satisfied */
     event_signal,              /* signal */
     no_get_fd,                 /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     no_destroy                 /* destroy */
diff --git a/server/fd.c b/server/fd.c
index 07ae40e..7ed113f 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -165,6 +165,7 @@
     NULL,                     /* satisfied */
     no_signal,                /* signal */
     no_get_fd,                /* get_fd */
+    no_map_access,            /* map_access */
     no_lookup_name,           /* lookup_name */
     no_close_handle,          /* close_handle */
     fd_destroy                /* destroy */
@@ -197,6 +198,7 @@
     NULL,                     /* satisfied */
     no_signal,                /* signal */
     no_get_fd,                /* get_fd */
+    no_map_access,            /* map_access */
     no_lookup_name,           /* lookup_name */
     no_close_handle,          /* close_handle */
     device_destroy            /* destroy */
@@ -228,6 +230,7 @@
     NULL,                     /* satisfied */
     no_signal,                /* signal */
     no_get_fd,                /* get_fd */
+    no_map_access,            /* map_access */
     no_lookup_name,           /* lookup_name */
     no_close_handle,          /* close_handle */
     inode_destroy             /* destroy */
@@ -261,6 +264,7 @@
     no_satisfied,               /* satisfied */
     no_signal,                  /* signal */
     no_get_fd,                  /* get_fd */
+    no_map_access,              /* map_access */
     no_lookup_name,             /* lookup_name */
     no_close_handle,            /* close_handle */
     no_destroy                  /* destroy */
diff --git a/server/file.c b/server/file.c
index b24751a..8e97f6d 100644
--- a/server/file.c
+++ b/server/file.c
@@ -79,6 +79,7 @@
     no_satisfied,                 /* satisfied */
     no_signal,                    /* signal */
     file_get_fd,                  /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     file_destroy                  /* destroy */
diff --git a/server/handle.c b/server/handle.c
index 9305191..375539f 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -110,6 +110,7 @@
     NULL,                            /* satisfied */
     no_signal,                       /* signal */
     no_get_fd,                       /* get_fd */
+    no_map_access,                   /* map_access */
     no_lookup_name,                  /* lookup_name */
     no_close_handle,                 /* close_handle */
     handle_table_destroy             /* destroy */
@@ -223,8 +224,11 @@
 
 /* allocate a handle for an object, incrementing its refcount */
 /* return the handle, or 0 on error */
-obj_handle_t alloc_handle( struct process *process, void *obj, unsigned int access, unsigned int attr )
+obj_handle_t alloc_handle( struct process *process, void *ptr, unsigned int access, unsigned int attr )
 {
+    struct object *obj = ptr;
+
+    access = obj->ops->map_access( obj, access );
     access &= ~RESERVED_ALL;
     if (attr & OBJ_INHERIT) access |= RESERVED_INHERIT;
     if (!process->handles)
diff --git a/server/hook.c b/server/hook.c
index 431243e..dd7b177 100644
--- a/server/hook.c
+++ b/server/hook.c
@@ -83,6 +83,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     hook_table_destroy            /* destroy */
diff --git a/server/mailslot.c b/server/mailslot.c
index ce2fbfd..00cc8b1 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -84,6 +84,7 @@
     no_satisfied,              /* satisfied */
     no_signal,                 /* signal */
     mailslot_get_fd,           /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     mailslot_destroy           /* destroy */
@@ -125,6 +126,7 @@
     NULL,                       /* satisfied */
     no_signal,                  /* signal */
     mail_writer_get_fd,         /* get_fd */
+    no_map_access,              /* map_access */
     no_lookup_name,             /* lookup_name */
     no_close_handle,            /* close_handle */
     mail_writer_destroy         /* destroy */
@@ -158,6 +160,7 @@
     no_satisfied,                   /* satisfied */
     no_signal,                      /* signal */
     mailslot_device_get_fd,         /* get_fd */
+    no_map_access,                  /* map_access */
     mailslot_device_lookup_name,    /* lookup_name */
     no_close_handle,                /* close_handle */
     mailslot_device_destroy         /* destroy */
diff --git a/server/mapping.c b/server/mapping.c
index af6f074..2c2daf1 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -65,6 +65,7 @@
     NULL,                        /* satisfied */
     no_signal,                   /* signal */
     mapping_get_fd,              /* get_fd */
+    no_map_access,               /* map_access */
     no_lookup_name,              /* lookup_name */
     no_close_handle,             /* close_handle */
     mapping_destroy              /* destroy */
diff --git a/server/mutex.c b/server/mutex.c
index f602200..0f1e9f8 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -60,6 +60,7 @@
     mutex_satisfied,           /* satisfied */
     mutex_signal,              /* signal */
     no_get_fd,                 /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     mutex_destroy              /* destroy */
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 45ebf11..07a7ceb 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -119,6 +119,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     named_pipe_destroy            /* destroy */
@@ -141,6 +142,7 @@
     no_satisfied,                 /* satisfied */
     no_signal,                    /* signal */
     pipe_server_get_fd,           /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     pipe_server_destroy           /* destroy */
@@ -173,6 +175,7 @@
     no_satisfied,                 /* satisfied */
     no_signal,                    /* signal */
     pipe_client_get_fd,           /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     pipe_client_destroy           /* destroy */
@@ -204,6 +207,7 @@
     no_satisfied,                     /* satisfied */
     no_signal,                        /* signal */
     named_pipe_device_get_fd,         /* get_fd */
+    no_map_access,                    /* map_access */
     named_pipe_device_lookup_name,    /* lookup_name */
     no_close_handle,                  /* close_handle */
     named_pipe_device_destroy         /* destroy */
diff --git a/server/object.c b/server/object.c
index e1330f2..94c8c53 100644
--- a/server/object.c
+++ b/server/object.c
@@ -312,6 +312,11 @@
     return NULL;
 }
 
+unsigned int no_map_access( struct object *obj, unsigned int access )
+{
+    return access;
+}
+
 struct object *no_lookup_name( struct object *obj, struct unicode_str *name,
                                unsigned int attr )
 {
diff --git a/server/object.h b/server/object.h
index 62c0015..4a137fd 100644
--- a/server/object.h
+++ b/server/object.h
@@ -72,6 +72,8 @@
     int  (*signal)(struct object *, unsigned int);
     /* return an fd object that can be used to read/write from the object */
     struct fd *(*get_fd)(struct object *);
+    /* map access rights to the specific rights for this object */
+    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);
     /* close a handle to this object */
@@ -118,6 +120,7 @@
 extern int no_satisfied( struct object *obj, struct thread *thread );
 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 int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
 extern void no_destroy( struct object *obj );
diff --git a/server/process.c b/server/process.c
index 3f7daf3..83cd716 100644
--- a/server/process.c
+++ b/server/process.c
@@ -72,6 +72,7 @@
     no_satisfied,                /* satisfied */
     no_signal,                   /* signal */
     no_get_fd,                   /* get_fd */
+    no_map_access,               /* map_access */
     no_lookup_name,              /* lookup_name */
     no_close_handle,             /* close_handle */
     process_destroy              /* destroy */
@@ -121,6 +122,7 @@
     no_satisfied,                  /* satisfied */
     no_signal,                     /* signal */
     no_get_fd,                     /* get_fd */
+    no_map_access,                 /* map_access */
     no_lookup_name,                /* lookup_name */
     no_close_handle,               /* close_handle */
     startup_info_destroy           /* destroy */
diff --git a/server/queue.c b/server/queue.c
index 0453b0e..3bc64d4 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -153,6 +153,7 @@
     msg_queue_satisfied,       /* satisfied */
     no_signal,                 /* signal */
     no_get_fd,                 /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     msg_queue_destroy          /* destroy */
@@ -169,6 +170,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     thread_input_destroy          /* destroy */
diff --git a/server/registry.c b/server/registry.c
index 5610984..52b4c19 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -147,6 +147,7 @@
     NULL,                    /* satisfied */
     no_signal,               /* signal */
     no_get_fd,               /* get_fd */
+    no_map_access,           /* map_access */
     no_lookup_name,          /* lookup_name */
     key_close_handle,        /* close_handle */
     key_destroy              /* destroy */
diff --git a/server/request.c b/server/request.c
index 7c3b50a..4793cb4 100644
--- a/server/request.c
+++ b/server/request.c
@@ -95,6 +95,7 @@
     NULL,                          /* satisfied */
     no_signal,                     /* signal */
     no_get_fd,                     /* get_fd */
+    no_map_access,                 /* map_access */
     no_lookup_name,                /* lookup_name */
     no_close_handle,               /* close_handle */
     master_socket_destroy          /* destroy */
diff --git a/server/semaphore.c b/server/semaphore.c
index d64bfbe..6cc1012 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -57,6 +57,7 @@
     semaphore_satisfied,           /* satisfied */
     semaphore_signal,              /* signal */
     no_get_fd,                     /* get_fd */
+    no_map_access,                 /* map_access */
     no_lookup_name,                /* lookup_name */
     no_close_handle,               /* close_handle */
     no_destroy                     /* destroy */
diff --git a/server/serial.c b/server/serial.c
index 88f44fb..a6f3903 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -102,6 +102,7 @@
     no_satisfied,                 /* satisfied */
     no_signal,                    /* signal */
     serial_get_fd,                /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     serial_destroy                /* destroy */
diff --git a/server/signal.c b/server/signal.c
index d90739f..0c2a579 100644
--- a/server/signal.c
+++ b/server/signal.c
@@ -64,6 +64,7 @@
     NULL,                     /* satisfied */
     no_signal,                /* signal */
     no_get_fd,                /* get_fd */
+    no_map_access,            /* map_access */
     no_lookup_name,           /* lookup_name */
     no_close_handle,          /* close_handle */
     handler_destroy           /* destroy */
diff --git a/server/snapshot.c b/server/snapshot.c
index 1d2ec97..0ef5370 100644
--- a/server/snapshot.c
+++ b/server/snapshot.c
@@ -66,6 +66,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     snapshot_destroy              /* destroy */
diff --git a/server/sock.c b/server/sock.c
index 2cbd100..dd48e3d 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -111,6 +111,7 @@
     no_satisfied,                 /* satisfied */
     no_signal,                    /* signal */
     sock_get_fd,                  /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     no_close_handle,              /* close_handle */
     sock_destroy                  /* destroy */
diff --git a/server/symlink.c b/server/symlink.c
index 083da71..62fb863 100644
--- a/server/symlink.c
+++ b/server/symlink.c
@@ -60,6 +60,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     symlink_lookup_name,          /* lookup_name */
     no_close_handle,              /* close_handle */
     symlink_destroy               /* destroy */
diff --git a/server/thread.c b/server/thread.c
index 705dc7b..9e2481e 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -97,6 +97,7 @@
     no_satisfied,               /* satisfied */
     no_signal,                  /* signal */
     no_get_fd,                  /* get_fd */
+    no_map_access,              /* map_access */
     no_lookup_name,             /* lookup_name */
     no_close_handle,            /* close_handle */
     destroy_thread              /* destroy */
diff --git a/server/timer.c b/server/timer.c
index 395bbda..7c20f19 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -65,6 +65,7 @@
     timer_satisfied,           /* satisfied */
     no_signal,                 /* signal */
     no_get_fd,                 /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     timer_destroy              /* destroy */
diff --git a/server/token.c b/server/token.c
index 3af7236..11b1f11 100644
--- a/server/token.c
+++ b/server/token.c
@@ -118,6 +118,7 @@
     NULL,                      /* satisfied */
     no_signal,                 /* signal */
     no_get_fd,                 /* get_fd */
+    no_map_access,             /* map_access */
     no_lookup_name,            /* lookup_name */
     no_close_handle,           /* close_handle */
     token_destroy              /* destroy */
diff --git a/server/winstation.c b/server/winstation.c
index efacdf3..30cbe18 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -60,6 +60,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     winstation_close_handle,      /* close_handle */
     winstation_destroy            /* destroy */
@@ -76,6 +77,7 @@
     NULL,                         /* satisfied */
     no_signal,                    /* signal */
     no_get_fd,                    /* get_fd */
+    no_map_access,                /* map_access */
     no_lookup_name,               /* lookup_name */
     desktop_close_handle,         /* close_handle */
     desktop_destroy               /* destroy */