Module: wine Branch: master Commit: e612bd410c48944e95a615f370def07ba6d2310c URL: http://source.winehq.org/git/wine.git/?a=commit;h=e612bd410c48944e95a615f370...
Author: Vitaliy Margolen wine-patches@kievinfo.com Date: Thu Jan 18 13:10:31 2007 -0700
server: Add generic access mapping for winstation and desktop objects.
---
server/winstation.c | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/server/winstation.c b/server/winstation.c index 44c66a5..a7df50e 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -46,9 +46,11 @@ static struct namespace *winstation_name static void winstation_dump( struct object *obj, int verbose ); static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void winstation_destroy( struct object *obj ); +static unsigned int winstation_map_access( struct object *obj, unsigned int access ); static void desktop_dump( struct object *obj, int verbose ); static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void desktop_destroy( struct object *obj ); +static unsigned int desktop_map_access( struct object *obj, unsigned int access );
static const struct object_ops winstation_ops = { @@ -60,7 +62,7 @@ static const struct object_ops winstatio NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - no_map_access, /* map_access */ + winstation_map_access, /* map_access */ no_lookup_name, /* lookup_name */ winstation_close_handle, /* close_handle */ winstation_destroy /* destroy */ @@ -77,7 +79,7 @@ static const struct object_ops desktop_o NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - no_map_access, /* map_access */ + desktop_map_access, /* map_access */ no_lookup_name, /* lookup_name */ desktop_close_handle, /* close_handle */ desktop_destroy /* destroy */ @@ -139,6 +141,17 @@ static void winstation_destroy( struct o if (winstation->atom_table) release_object( winstation->atom_table ); }
+static unsigned int winstation_map_access( struct object *obj, unsigned int access ) +{ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | + WINSTA_ENUMERATE | WINSTA_READSCREEN; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | + WINSTA_WRITEATTRIBUTES; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS; + if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + /* retrieve the process window station, checking the handle access rights */ struct winstation *get_process_winstation( struct process *process, unsigned int access ) { @@ -239,6 +252,17 @@ static void desktop_destroy( struct obje release_object( desktop->winstation ); }
+static unsigned int desktop_map_access( struct object *obj, unsigned int access ) +{ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | DESKTOP_READOBJECTS | DESKTOP_ENUMERATE; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | + DESKTOP_HOOKCONTROL | DESKTOP_JOURNALRECORD | DESKTOP_JOURNALPLAYBACK | + DESKTOP_WRITEOBJECTS; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP; + if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + /* retrieve the thread desktop, checking the handle access rights */ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access ) {