Maarten Lankhorst : server: Make enum_desktop enumerate all the desktops on the window station with the DESKTOP_ENUMERATE right .

Alexandre Julliard julliard at winehq.org
Thu Apr 17 07:38:46 CDT 2008


Module: wine
Branch: master
Commit: 3fd1fc760046165e63146a2803b510079ee00035
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3fd1fc760046165e63146a2803b510079ee00035

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Tue Apr 15 16:38:58 2008 -0700

server: Make enum_desktop enumerate all the desktops on the window station with the DESKTOP_ENUMERATE right.

---

 server/winstation.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/server/winstation.c b/server/winstation.c
index cde4923..817fe77 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -659,28 +659,23 @@ DECL_HANDLER(enum_desktop)
 {
     struct winstation *winstation;
     struct desktop *desktop;
-    unsigned int index = req->index;
-    obj_handle_t handle;
+    unsigned int index = 0;
 
     if (!(winstation = (struct winstation *)get_handle_obj( current->process, req->winstation,
                                                             WINSTA_ENUMDESKTOPS, &winstation_ops )))
         return;
 
-    while ((handle = enumerate_handles( current->process, &desktop_ops, &index )))
+    LIST_FOR_EACH_ENTRY( desktop, &winstation->desktops, struct desktop, entry )
     {
-        if (!(desktop = get_desktop_obj( current->process, handle, DESKTOP_ENUMERATE )))
-            continue;
-
-        if (desktop->winstation == winstation)
-        {
-            set_reply_data_obj_name( &desktop->obj );
-            release_object( desktop );
-            release_object( winstation );
-            clear_error();
-            reply->next = index;
-            return;
-        }
-        release_object( desktop );
+        unsigned int access = DESKTOP_ENUMERATE;
+        if (req->index > index++) continue;
+        if (!desktop->obj.name) continue;
+        if (!check_object_access( &desktop->obj, &access )) continue;
+        set_reply_data_obj_name( &desktop->obj );
+        release_object( winstation );
+        clear_error();
+        reply->next = index;
+        return;
     }
 
     release_object( winstation );




More information about the wine-cvs mailing list