shlwapi: SHMapHandle should not set error when NULL is passed as hShared.
[wine.git] / server / winstation.c
bloba09ca03e3b0e982e73e602a81bbd4745e25611df
1 /*
2 * Server-side window stations and desktops handling
4 * Copyright (C) 2002, 2005 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdio.h>
25 #include <stdarg.h>
27 #include "ntstatus.h"
28 #define WIN32_NO_STATUS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "winternl.h"
34 #include "object.h"
35 #include "handle.h"
36 #include "request.h"
37 #include "process.h"
38 #include "user.h"
39 #include "file.h"
40 #include "security.h"
41 #include "wine/unicode.h"
44 static struct list winstation_list = LIST_INIT(winstation_list);
46 static void winstation_dump( struct object *obj, int verbose );
47 static struct object_type *winstation_get_type( struct object *obj );
48 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
49 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
50 unsigned int attr );
51 static void winstation_destroy( struct object *obj );
52 static unsigned int winstation_map_access( struct object *obj, unsigned int access );
53 static void desktop_dump( struct object *obj, int verbose );
54 static struct object_type *desktop_get_type( struct object *obj );
55 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
56 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
57 static void desktop_destroy( struct object *obj );
58 static unsigned int desktop_map_access( struct object *obj, unsigned int access );
60 static const struct object_ops winstation_ops =
62 sizeof(struct winstation), /* size */
63 winstation_dump, /* dump */
64 winstation_get_type, /* get_type */
65 no_add_queue, /* add_queue */
66 NULL, /* remove_queue */
67 NULL, /* signaled */
68 NULL, /* satisfied */
69 no_signal, /* signal */
70 no_get_fd, /* get_fd */
71 winstation_map_access, /* map_access */
72 default_get_sd, /* get_sd */
73 default_set_sd, /* set_sd */
74 winstation_lookup_name, /* lookup_name */
75 directory_link_name, /* link_name */
76 default_unlink_name, /* unlink_name */
77 no_open_file, /* open_file */
78 no_kernel_obj_list, /* get_kernel_obj_list */
79 winstation_close_handle, /* close_handle */
80 winstation_destroy /* destroy */
84 static const struct object_ops desktop_ops =
86 sizeof(struct desktop), /* size */
87 desktop_dump, /* dump */
88 desktop_get_type, /* get_type */
89 no_add_queue, /* add_queue */
90 NULL, /* remove_queue */
91 NULL, /* signaled */
92 NULL, /* satisfied */
93 no_signal, /* signal */
94 no_get_fd, /* get_fd */
95 desktop_map_access, /* map_access */
96 default_get_sd, /* get_sd */
97 default_set_sd, /* set_sd */
98 no_lookup_name, /* lookup_name */
99 desktop_link_name, /* link_name */
100 default_unlink_name, /* unlink_name */
101 no_open_file, /* open_file */
102 no_kernel_obj_list, /* get_kernel_obj_list */
103 desktop_close_handle, /* close_handle */
104 desktop_destroy /* destroy */
107 #define DESKTOP_ALL_ACCESS 0x01ff
109 /* create a winstation object */
110 static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
111 unsigned int attr, unsigned int flags )
113 struct winstation *winstation;
115 if ((winstation = create_named_object( root, &winstation_ops, name, attr, NULL )))
117 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
119 /* initialize it if it didn't already exist */
120 winstation->flags = flags;
121 winstation->clipboard = NULL;
122 winstation->atom_table = NULL;
123 list_add_tail( &winstation_list, &winstation->entry );
124 list_init( &winstation->desktops );
125 if (!(winstation->desktop_names = create_namespace( 7 )))
127 release_object( winstation );
128 return NULL;
131 else clear_error();
133 return winstation;
136 static void winstation_dump( struct object *obj, int verbose )
138 struct winstation *winstation = (struct winstation *)obj;
140 fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p\n",
141 winstation->flags, winstation->clipboard, winstation->atom_table );
144 static struct object_type *winstation_get_type( struct object *obj )
146 static const WCHAR name[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
147 static const struct unicode_str str = { name, sizeof(name) };
148 return get_object_type( &str );
151 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
153 return (process->winstation != handle);
156 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
157 unsigned int attr )
159 struct winstation *winstation = (struct winstation *)obj;
160 struct object *found;
162 assert( obj->ops == &winstation_ops );
164 if (!name) return NULL; /* open the winstation itself */
166 if (memchrW( name->str, '\\', name->len / sizeof(WCHAR) )) /* no backslash allowed in name */
168 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
169 return NULL;
172 if ((found = find_object( winstation->desktop_names, name, attr )))
173 name->len = 0;
175 return found;
178 static void winstation_destroy( struct object *obj )
180 struct winstation *winstation = (struct winstation *)obj;
182 list_remove( &winstation->entry );
183 if (winstation->clipboard) release_object( winstation->clipboard );
184 if (winstation->atom_table) release_object( winstation->atom_table );
185 free( winstation->desktop_names );
188 static unsigned int winstation_map_access( struct object *obj, unsigned int access )
190 if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES |
191 WINSTA_ENUMERATE | WINSTA_READSCREEN;
192 if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP |
193 WINSTA_WRITEATTRIBUTES;
194 if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS;
195 if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS;
196 return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
199 /* retrieve the process window station, checking the handle access rights */
200 struct winstation *get_process_winstation( struct process *process, unsigned int access )
202 return (struct winstation *)get_handle_obj( process, process->winstation,
203 access, &winstation_ops );
206 /* retrieve a pointer to a desktop object */
207 struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, unsigned int access )
209 return (struct desktop *)get_handle_obj( process, handle, access, &desktop_ops );
212 /* create a desktop object */
213 static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
214 unsigned int flags, struct winstation *winstation )
216 struct desktop *desktop;
218 if ((desktop = create_named_object( &winstation->obj, &desktop_ops, name, attr, NULL )))
220 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
222 /* initialize it if it didn't already exist */
223 desktop->flags = flags;
224 desktop->winstation = (struct winstation *)grab_object( winstation );
225 desktop->top_window = NULL;
226 desktop->msg_window = NULL;
227 desktop->global_hooks = NULL;
228 desktop->close_timeout = NULL;
229 desktop->foreground_input = NULL;
230 desktop->users = 0;
231 memset( &desktop->cursor, 0, sizeof(desktop->cursor) );
232 memset( desktop->keystate, 0, sizeof(desktop->keystate) );
233 list_add_tail( &winstation->desktops, &desktop->entry );
234 list_init( &desktop->hotkeys );
236 else clear_error();
238 return desktop;
241 static void desktop_dump( struct object *obj, int verbose )
243 struct desktop *desktop = (struct desktop *)obj;
245 fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p\n",
246 desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks );
249 static struct object_type *desktop_get_type( struct object *obj )
251 static const WCHAR name[] = {'D','e','s','k','t','o','p'};
252 static const struct unicode_str str = { name, sizeof(name) };
253 return get_object_type( &str );
256 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent )
258 struct winstation *winstation = (struct winstation *)parent;
260 if (parent->ops != &winstation_ops)
262 set_error( STATUS_OBJECT_TYPE_MISMATCH );
263 return 0;
265 if (memchrW( name->name, '\\', name->len / sizeof(WCHAR) )) /* no backslash allowed in name */
267 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
268 return 0;
270 namespace_add( winstation->desktop_names, name );
271 return 1;
274 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
276 struct thread *thread;
278 /* check if the handle is currently used by the process or one of its threads */
279 if (process->desktop == handle) return 0;
280 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
281 if (thread->desktop == handle) return 0;
282 return 1;
285 static void desktop_destroy( struct object *obj )
287 struct desktop *desktop = (struct desktop *)obj;
289 free_hotkeys( desktop, 0 );
290 if (desktop->top_window) destroy_window( desktop->top_window );
291 if (desktop->msg_window) destroy_window( desktop->msg_window );
292 if (desktop->global_hooks) release_object( desktop->global_hooks );
293 if (desktop->close_timeout) remove_timeout_user( desktop->close_timeout );
294 list_remove( &desktop->entry );
295 release_object( desktop->winstation );
298 static unsigned int desktop_map_access( struct object *obj, unsigned int access )
300 if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | DESKTOP_READOBJECTS | DESKTOP_ENUMERATE;
301 if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
302 DESKTOP_HOOKCONTROL | DESKTOP_JOURNALRECORD | DESKTOP_JOURNALPLAYBACK |
303 DESKTOP_WRITEOBJECTS;
304 if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP;
305 if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS;
306 return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
309 /* retrieve the thread desktop, checking the handle access rights */
310 struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
312 return get_desktop_obj( thread->process, thread->desktop, access );
315 static void close_desktop_timeout( void *private )
317 struct desktop *desktop = private;
319 desktop->close_timeout = NULL;
320 unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
321 post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
324 /* add a user of the desktop and cancel the close timeout */
325 static void add_desktop_user( struct desktop *desktop )
327 desktop->users++;
328 if (desktop->close_timeout)
330 remove_timeout_user( desktop->close_timeout );
331 desktop->close_timeout = NULL;
335 /* remove a user of the desktop and start the close timeout if necessary */
336 static void remove_desktop_user( struct desktop *desktop )
338 assert( desktop->users > 0 );
339 desktop->users--;
341 /* if we have one remaining user, it has to be the manager of the desktop window */
342 if (desktop->users == 1 && get_top_window_owner( desktop ))
344 assert( !desktop->close_timeout );
345 desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
349 /* set the process default desktop handle */
350 void set_process_default_desktop( struct process *process, struct desktop *desktop,
351 obj_handle_t handle )
353 struct thread *thread;
354 struct desktop *old_desktop;
356 if (process->desktop == handle) return; /* nothing to do */
358 if (!(old_desktop = get_desktop_obj( process, process->desktop, 0 ))) clear_error();
359 process->desktop = handle;
361 /* set desktop for threads that don't have one yet */
362 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
363 if (!thread->desktop) thread->desktop = handle;
365 if (!process->is_system && desktop != old_desktop)
367 add_desktop_user( desktop );
368 if (old_desktop) remove_desktop_user( old_desktop );
371 if (old_desktop) release_object( old_desktop );
374 /* connect a process to its window station */
375 void connect_process_winstation( struct process *process, struct thread *parent )
377 struct winstation *winstation = NULL;
378 struct desktop *desktop = NULL;
379 obj_handle_t handle;
381 /* check for an inherited winstation handle (don't ask...) */
382 if ((handle = find_inherited_handle( process, &winstation_ops )))
384 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
386 else if (parent && parent->process->winstation)
388 handle = duplicate_handle( parent->process, parent->process->winstation,
389 process, 0, 0, DUP_HANDLE_SAME_ACCESS );
390 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
392 if (!winstation) goto done;
393 process->winstation = handle;
395 if ((handle = find_inherited_handle( process, &desktop_ops )))
397 desktop = get_desktop_obj( process, handle, 0 );
398 if (!desktop || desktop->winstation != winstation) goto done;
400 else if (parent && parent->desktop)
402 desktop = get_desktop_obj( parent->process, parent->desktop, 0 );
403 if (!desktop || desktop->winstation != winstation) goto done;
404 handle = duplicate_handle( parent->process, parent->desktop,
405 process, 0, 0, DUP_HANDLE_SAME_ACCESS );
408 if (handle) set_process_default_desktop( process, desktop, handle );
410 done:
411 if (desktop) release_object( desktop );
412 if (winstation) release_object( winstation );
413 clear_error();
416 /* close the desktop of a given process */
417 void close_process_desktop( struct process *process )
419 struct desktop *desktop;
421 if (process->desktop && (desktop = get_desktop_obj( process, process->desktop, 0 )))
423 remove_desktop_user( desktop );
424 release_object( desktop );
426 clear_error(); /* ignore errors */
429 /* close the desktop of a given thread */
430 void close_thread_desktop( struct thread *thread )
432 obj_handle_t handle = thread->desktop;
434 thread->desktop = 0;
435 if (handle) close_handle( thread->process, handle );
438 /* create a window station */
439 DECL_HANDLER(create_winstation)
441 struct winstation *winstation;
442 struct unicode_str name = get_req_unicode_str();
443 struct object *root = NULL;
445 reply->handle = 0;
446 if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) return;
448 if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
450 reply->handle = alloc_handle( current->process, winstation, req->access, req->attributes );
451 release_object( winstation );
453 if (root) release_object( root );
456 /* open a handle to a window station */
457 DECL_HANDLER(open_winstation)
459 struct unicode_str name = get_req_unicode_str();
461 reply->handle = open_object( current->process, req->rootdir, req->access,
462 &winstation_ops, &name, req->attributes );
466 /* close a window station */
467 DECL_HANDLER(close_winstation)
469 struct winstation *winstation;
471 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
472 0, &winstation_ops )))
474 if (close_handle( current->process, req->handle )) set_error( STATUS_ACCESS_DENIED );
475 release_object( winstation );
480 /* get the process current window station */
481 DECL_HANDLER(get_process_winstation)
483 reply->handle = current->process->winstation;
487 /* set the process current window station */
488 DECL_HANDLER(set_process_winstation)
490 struct winstation *winstation;
492 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
493 0, &winstation_ops )))
495 /* FIXME: should we close the old one? */
496 current->process->winstation = req->handle;
497 release_object( winstation );
501 /* create a desktop */
502 DECL_HANDLER(create_desktop)
504 struct desktop *desktop;
505 struct winstation *winstation;
506 struct unicode_str name = get_req_unicode_str();
508 reply->handle = 0;
509 if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
511 if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
513 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
514 release_object( desktop );
516 release_object( winstation );
520 /* open a handle to a desktop */
521 DECL_HANDLER(open_desktop)
523 struct winstation *winstation;
524 struct object *obj;
525 struct unicode_str name = get_req_unicode_str();
527 /* FIXME: check access rights */
528 if (!req->winsta)
529 winstation = get_process_winstation( current->process, 0 );
530 else
531 winstation = (struct winstation *)get_handle_obj( current->process, req->winsta, 0, &winstation_ops );
533 if (!winstation) return;
535 if ((obj = open_named_object( &winstation->obj, &desktop_ops, &name, req->attributes )))
537 reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
538 release_object( obj );
541 release_object( winstation );
544 /* open a handle to current input desktop */
545 DECL_HANDLER(open_input_desktop)
547 /* FIXME: check access rights */
548 struct winstation *winstation = get_process_winstation( current->process, 0 );
549 struct desktop *desktop;
551 if (!winstation) return;
553 if (!(winstation->flags & WSF_VISIBLE))
555 set_error( STATUS_ILLEGAL_FUNCTION );
556 release_object( winstation );
557 return;
560 if ((desktop = get_desktop_obj( current->process, current->process->desktop, 0 )))
562 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
563 release_object( desktop );
565 release_object( winstation );
568 /* close a desktop */
569 DECL_HANDLER(close_desktop)
571 struct desktop *desktop;
573 /* make sure it is a desktop handle */
574 if ((desktop = (struct desktop *)get_handle_obj( current->process, req->handle,
575 0, &desktop_ops )))
577 if (close_handle( current->process, req->handle )) set_error( STATUS_DEVICE_BUSY );
578 release_object( desktop );
583 /* get the thread current desktop */
584 DECL_HANDLER(get_thread_desktop)
586 struct thread *thread;
588 if (!(thread = get_thread_from_id( req->tid ))) return;
589 reply->handle = thread->desktop;
590 release_object( thread );
594 /* set the thread current desktop */
595 DECL_HANDLER(set_thread_desktop)
597 struct desktop *old_desktop, *new_desktop;
598 struct winstation *winstation;
600 if (!(winstation = get_process_winstation( current->process, 0 /* FIXME: access rights? */ )))
601 return;
603 if (!(new_desktop = get_desktop_obj( current->process, req->handle, 0 )))
605 release_object( winstation );
606 return;
608 if (new_desktop->winstation != winstation)
610 set_error( STATUS_ACCESS_DENIED );
611 release_object( new_desktop );
612 release_object( winstation );
613 return;
616 /* check if we are changing to a new desktop */
618 if (!(old_desktop = get_desktop_obj( current->process, current->desktop, 0)))
619 clear_error(); /* ignore error */
621 /* when changing desktop, we can't have any users on the current one */
622 if (old_desktop != new_desktop && current->desktop_users > 0)
623 set_error( STATUS_DEVICE_BUSY );
624 else
625 current->desktop = req->handle; /* FIXME: should we close the old one? */
627 if (!current->process->desktop)
628 set_process_default_desktop( current->process, new_desktop, req->handle );
630 if (old_desktop != new_desktop && current->queue) detach_thread_input( current );
632 if (old_desktop) release_object( old_desktop );
633 release_object( new_desktop );
634 release_object( winstation );
638 /* get/set information about a user object (window station or desktop) */
639 DECL_HANDLER(set_user_object_info)
641 struct object *obj;
642 data_size_t len;
644 if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
646 if (obj->ops == &desktop_ops)
648 struct desktop *desktop = (struct desktop *)obj;
649 reply->is_desktop = 1;
650 reply->old_obj_flags = desktop->flags;
651 if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags;
653 else if (obj->ops == &winstation_ops)
655 struct winstation *winstation = (struct winstation *)obj;
656 reply->is_desktop = 0;
657 reply->old_obj_flags = winstation->flags;
658 if (req->flags & SET_USER_OBJECT_SET_FLAGS) winstation->flags = req->obj_flags;
660 else
662 set_error( STATUS_OBJECT_TYPE_MISMATCH );
663 release_object( obj );
664 return;
666 if (obj->ops == &desktop_ops && get_reply_max_size() && (req->flags & SET_USER_OBJECT_GET_FULL_NAME))
668 struct desktop *desktop = (struct desktop *)obj;
669 data_size_t winstation_len, desktop_len;
670 const WCHAR *winstation_name = get_object_name( &desktop->winstation->obj, &winstation_len );
671 const WCHAR *desktop_name = get_object_name( obj, &desktop_len );
672 WCHAR *full_name;
674 if (!winstation_name) winstation_len = 0;
675 if (!desktop_name) desktop_len = 0;
676 len = winstation_len + desktop_len + sizeof(WCHAR);
677 if ((full_name = mem_alloc( len )))
679 memcpy( full_name, winstation_name, winstation_len );
680 full_name[winstation_len / sizeof(WCHAR)] = '\\';
681 memcpy( full_name + winstation_len / sizeof(WCHAR) + 1, desktop_name, desktop_len );
682 set_reply_data_ptr( full_name, min( len, get_reply_max_size() ));
685 else
687 const WCHAR *name = get_object_name( obj, &len );
688 if (name) set_reply_data( name, min( len, get_reply_max_size() ));
690 release_object( obj );
694 /* enumerate window stations */
695 DECL_HANDLER(enum_winstation)
697 unsigned int index = 0;
698 struct winstation *winsta;
699 const WCHAR *name;
700 data_size_t len;
702 LIST_FOR_EACH_ENTRY( winsta, &winstation_list, struct winstation, entry )
704 unsigned int access = WINSTA_ENUMERATE;
705 if (req->index > index++) continue;
706 if (!check_object_access( &winsta->obj, &access )) continue;
707 clear_error();
708 reply->next = index;
709 if ((name = get_object_name( &winsta->obj, &len )))
710 set_reply_data( name, min( len, get_reply_max_size() ));
711 return;
713 set_error( STATUS_NO_MORE_ENTRIES );
717 /* enumerate desktops */
718 DECL_HANDLER(enum_desktop)
720 struct winstation *winstation;
721 struct desktop *desktop;
722 unsigned int index = 0;
723 const WCHAR *name;
724 data_size_t len;
726 if (!(winstation = (struct winstation *)get_handle_obj( current->process, req->winstation,
727 WINSTA_ENUMDESKTOPS, &winstation_ops )))
728 return;
730 LIST_FOR_EACH_ENTRY( desktop, &winstation->desktops, struct desktop, entry )
732 unsigned int access = DESKTOP_ENUMERATE;
733 if (req->index > index++) continue;
734 if (!desktop->obj.name) continue;
735 if (!check_object_access( &desktop->obj, &access )) continue;
736 if ((name = get_object_name( &desktop->obj, &len )))
737 set_reply_data( name, min( len, get_reply_max_size() ));
738 release_object( winstation );
739 clear_error();
740 reply->next = index;
741 return;
744 release_object( winstation );
745 set_error( STATUS_NO_MORE_ENTRIES );