prntvpt: Initialize ticket from printer defaults.
[wine.git] / server / winstation.c
blob43d112334d48614c5b198a73ed5e0331d29e7a05
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"
43 static struct list winstation_list = LIST_INIT(winstation_list);
45 static void winstation_dump( struct object *obj, int verbose );
46 static struct object_type *winstation_get_type( struct object *obj );
47 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
48 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
49 unsigned int attr );
50 static void winstation_destroy( struct object *obj );
51 static unsigned int winstation_map_access( struct object *obj, unsigned int access );
52 static void desktop_dump( struct object *obj, int verbose );
53 static struct object_type *desktop_get_type( struct object *obj );
54 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
55 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
56 static void desktop_destroy( struct object *obj );
57 static unsigned int desktop_map_access( struct object *obj, unsigned int access );
59 static const struct object_ops winstation_ops =
61 sizeof(struct winstation), /* size */
62 winstation_dump, /* dump */
63 winstation_get_type, /* get_type */
64 no_add_queue, /* add_queue */
65 NULL, /* remove_queue */
66 NULL, /* signaled */
67 NULL, /* satisfied */
68 no_signal, /* signal */
69 no_get_fd, /* get_fd */
70 winstation_map_access, /* map_access */
71 default_get_sd, /* get_sd */
72 default_set_sd, /* set_sd */
73 winstation_lookup_name, /* lookup_name */
74 directory_link_name, /* link_name */
75 default_unlink_name, /* unlink_name */
76 no_open_file, /* open_file */
77 no_kernel_obj_list, /* get_kernel_obj_list */
78 winstation_close_handle, /* close_handle */
79 winstation_destroy /* destroy */
83 static const struct object_ops desktop_ops =
85 sizeof(struct desktop), /* size */
86 desktop_dump, /* dump */
87 desktop_get_type, /* get_type */
88 no_add_queue, /* add_queue */
89 NULL, /* remove_queue */
90 NULL, /* signaled */
91 NULL, /* satisfied */
92 no_signal, /* signal */
93 no_get_fd, /* get_fd */
94 desktop_map_access, /* map_access */
95 default_get_sd, /* get_sd */
96 default_set_sd, /* set_sd */
97 no_lookup_name, /* lookup_name */
98 desktop_link_name, /* link_name */
99 default_unlink_name, /* unlink_name */
100 no_open_file, /* open_file */
101 no_kernel_obj_list, /* get_kernel_obj_list */
102 desktop_close_handle, /* close_handle */
103 desktop_destroy /* destroy */
106 #define DESKTOP_ALL_ACCESS 0x01ff
108 /* create a winstation object */
109 static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
110 unsigned int attr, unsigned int flags )
112 struct winstation *winstation;
114 if ((winstation = create_named_object( root, &winstation_ops, name, attr, NULL )))
116 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
118 /* initialize it if it didn't already exist */
119 winstation->flags = flags;
120 winstation->clipboard = NULL;
121 winstation->atom_table = NULL;
122 list_add_tail( &winstation_list, &winstation->entry );
123 list_init( &winstation->desktops );
124 if (!(winstation->desktop_names = create_namespace( 7 )))
126 release_object( winstation );
127 return NULL;
130 else clear_error();
132 return winstation;
135 static void winstation_dump( struct object *obj, int verbose )
137 struct winstation *winstation = (struct winstation *)obj;
139 fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p\n",
140 winstation->flags, winstation->clipboard, winstation->atom_table );
143 static struct object_type *winstation_get_type( struct object *obj )
145 static const WCHAR name[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
146 static const struct unicode_str str = { name, sizeof(name) };
147 return get_object_type( &str );
150 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
152 return (process->winstation != handle);
155 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
156 unsigned int attr )
158 struct winstation *winstation = (struct winstation *)obj;
159 struct object *found;
161 assert( obj->ops == &winstation_ops );
163 if (!name) return NULL; /* open the winstation itself */
165 if (get_path_element( name->str, name->len ) < name->len) /* no backslash allowed in name */
167 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
168 return NULL;
171 if ((found = find_object( winstation->desktop_names, name, attr )))
172 name->len = 0;
174 return found;
177 static void winstation_destroy( struct object *obj )
179 struct winstation *winstation = (struct winstation *)obj;
181 list_remove( &winstation->entry );
182 if (winstation->clipboard) release_object( winstation->clipboard );
183 if (winstation->atom_table) release_object( winstation->atom_table );
184 free( winstation->desktop_names );
187 static unsigned int winstation_map_access( struct object *obj, unsigned int access )
189 if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES |
190 WINSTA_ENUMERATE | WINSTA_READSCREEN;
191 if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP |
192 WINSTA_WRITEATTRIBUTES;
193 if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS;
194 if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS;
195 return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
198 /* retrieve the process window station, checking the handle access rights */
199 struct winstation *get_process_winstation( struct process *process, unsigned int access )
201 return (struct winstation *)get_handle_obj( process, process->winstation,
202 access, &winstation_ops );
205 /* retrieve a pointer to a desktop object */
206 struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, unsigned int access )
208 return (struct desktop *)get_handle_obj( process, handle, access, &desktop_ops );
211 /* create a desktop object */
212 static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
213 unsigned int flags, struct winstation *winstation )
215 struct desktop *desktop;
217 if ((desktop = create_named_object( &winstation->obj, &desktop_ops, name, attr, NULL )))
219 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
221 /* initialize it if it didn't already exist */
222 desktop->flags = flags;
223 desktop->winstation = (struct winstation *)grab_object( winstation );
224 desktop->top_window = NULL;
225 desktop->msg_window = NULL;
226 desktop->global_hooks = NULL;
227 desktop->close_timeout = NULL;
228 desktop->foreground_input = NULL;
229 desktop->users = 0;
230 memset( &desktop->cursor, 0, sizeof(desktop->cursor) );
231 memset( desktop->keystate, 0, sizeof(desktop->keystate) );
232 list_add_tail( &winstation->desktops, &desktop->entry );
233 list_init( &desktop->hotkeys );
235 else clear_error();
237 return desktop;
240 static void desktop_dump( struct object *obj, int verbose )
242 struct desktop *desktop = (struct desktop *)obj;
244 fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p\n",
245 desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks );
248 static struct object_type *desktop_get_type( struct object *obj )
250 static const WCHAR name[] = {'D','e','s','k','t','o','p'};
251 static const struct unicode_str str = { name, sizeof(name) };
252 return get_object_type( &str );
255 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent )
257 struct winstation *winstation = (struct winstation *)parent;
259 if (parent->ops != &winstation_ops)
261 set_error( STATUS_OBJECT_TYPE_MISMATCH );
262 return 0;
264 if (get_path_element( name->name, name->len ) < name->len) /* no backslash allowed in name */
266 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
267 return 0;
269 namespace_add( winstation->desktop_names, name );
270 return 1;
273 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
275 struct thread *thread;
277 /* check if the handle is currently used by the process or one of its threads */
278 if (process->desktop == handle) return 0;
279 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
280 if (thread->desktop == handle) return 0;
281 return 1;
284 static void desktop_destroy( struct object *obj )
286 struct desktop *desktop = (struct desktop *)obj;
288 free_hotkeys( desktop, 0 );
289 if (desktop->top_window) destroy_window( desktop->top_window );
290 if (desktop->msg_window) destroy_window( desktop->msg_window );
291 if (desktop->global_hooks) release_object( desktop->global_hooks );
292 if (desktop->close_timeout) remove_timeout_user( desktop->close_timeout );
293 list_remove( &desktop->entry );
294 release_object( desktop->winstation );
297 static unsigned int desktop_map_access( struct object *obj, unsigned int access )
299 if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | DESKTOP_READOBJECTS | DESKTOP_ENUMERATE;
300 if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
301 DESKTOP_HOOKCONTROL | DESKTOP_JOURNALRECORD | DESKTOP_JOURNALPLAYBACK |
302 DESKTOP_WRITEOBJECTS;
303 if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP;
304 if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS;
305 return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
308 /* retrieve the thread desktop, checking the handle access rights */
309 struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
311 return get_desktop_obj( thread->process, thread->desktop, access );
314 static void close_desktop_timeout( void *private )
316 struct desktop *desktop = private;
318 desktop->close_timeout = NULL;
319 unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
320 post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
323 /* add a user of the desktop and cancel the close timeout */
324 static void add_desktop_user( struct desktop *desktop )
326 desktop->users++;
327 if (desktop->close_timeout)
329 remove_timeout_user( desktop->close_timeout );
330 desktop->close_timeout = NULL;
334 /* remove a user of the desktop and start the close timeout if necessary */
335 static void remove_desktop_user( struct desktop *desktop )
337 assert( desktop->users > 0 );
338 desktop->users--;
340 /* if we have one remaining user, it has to be the manager of the desktop window */
341 if (desktop->users == 1 && get_top_window_owner( desktop ))
343 assert( !desktop->close_timeout );
344 desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
348 /* set the process default desktop handle */
349 void set_process_default_desktop( struct process *process, struct desktop *desktop,
350 obj_handle_t handle )
352 struct thread *thread;
353 struct desktop *old_desktop;
355 if (process->desktop == handle) return; /* nothing to do */
357 if (!(old_desktop = get_desktop_obj( process, process->desktop, 0 ))) clear_error();
358 process->desktop = handle;
360 /* set desktop for threads that don't have one yet */
361 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
362 if (!thread->desktop) thread->desktop = handle;
364 if (!process->is_system && desktop != old_desktop)
366 add_desktop_user( desktop );
367 if (old_desktop) remove_desktop_user( old_desktop );
370 if (old_desktop) release_object( old_desktop );
373 /* connect a process to its window station */
374 void connect_process_winstation( struct process *process, struct thread *parent_thread,
375 struct process *parent_process )
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_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
402 if (parent_thread && parent_thread->desktop)
403 handle = parent_thread->desktop;
404 else if (parent_process->desktop)
405 handle = parent_process->desktop;
406 else
407 goto done;
409 desktop = get_desktop_obj( parent_process, handle, 0 );
411 if (!desktop || desktop->winstation != winstation) goto done;
413 handle = duplicate_handle( parent_process, handle, process, 0, 0, DUP_HANDLE_SAME_ACCESS );
415 if (handle) set_process_default_desktop( process, desktop, handle );
417 done:
418 if (desktop) release_object( desktop );
419 if (winstation) release_object( winstation );
420 clear_error();
423 /* close the desktop of a given process */
424 void close_process_desktop( struct process *process )
426 struct desktop *desktop;
428 if (process->desktop && (desktop = get_desktop_obj( process, process->desktop, 0 )))
430 remove_desktop_user( desktop );
431 release_object( desktop );
433 clear_error(); /* ignore errors */
436 /* close the desktop of a given thread */
437 void close_thread_desktop( struct thread *thread )
439 obj_handle_t handle = thread->desktop;
441 thread->desktop = 0;
442 if (handle) close_handle( thread->process, handle );
445 /* create a window station */
446 DECL_HANDLER(create_winstation)
448 struct winstation *winstation;
449 struct unicode_str name = get_req_unicode_str();
450 struct object *root = NULL;
452 reply->handle = 0;
453 if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) return;
455 if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
457 reply->handle = alloc_handle( current->process, winstation, req->access, req->attributes );
458 release_object( winstation );
460 if (root) release_object( root );
463 /* open a handle to a window station */
464 DECL_HANDLER(open_winstation)
466 struct unicode_str name = get_req_unicode_str();
468 reply->handle = open_object( current->process, req->rootdir, req->access,
469 &winstation_ops, &name, req->attributes );
473 /* close a window station */
474 DECL_HANDLER(close_winstation)
476 struct winstation *winstation;
478 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
479 0, &winstation_ops )))
481 if (close_handle( current->process, req->handle )) set_error( STATUS_ACCESS_DENIED );
482 release_object( winstation );
487 /* get the process current window station */
488 DECL_HANDLER(get_process_winstation)
490 reply->handle = current->process->winstation;
494 /* set the process current window station */
495 DECL_HANDLER(set_process_winstation)
497 struct winstation *winstation;
499 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
500 0, &winstation_ops )))
502 /* FIXME: should we close the old one? */
503 current->process->winstation = req->handle;
504 release_object( winstation );
508 /* create a desktop */
509 DECL_HANDLER(create_desktop)
511 struct desktop *desktop;
512 struct winstation *winstation;
513 struct unicode_str name = get_req_unicode_str();
515 reply->handle = 0;
516 if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
518 if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
520 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
521 release_object( desktop );
523 release_object( winstation );
527 /* open a handle to a desktop */
528 DECL_HANDLER(open_desktop)
530 struct winstation *winstation;
531 struct object *obj;
532 struct unicode_str name = get_req_unicode_str();
534 /* FIXME: check access rights */
535 if (!req->winsta)
536 winstation = get_process_winstation( current->process, 0 );
537 else
538 winstation = (struct winstation *)get_handle_obj( current->process, req->winsta, 0, &winstation_ops );
540 if (!winstation) return;
542 if ((obj = open_named_object( &winstation->obj, &desktop_ops, &name, req->attributes )))
544 reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
545 release_object( obj );
548 release_object( winstation );
551 /* open a handle to current input desktop */
552 DECL_HANDLER(open_input_desktop)
554 /* FIXME: check access rights */
555 struct winstation *winstation = get_process_winstation( current->process, 0 );
556 struct desktop *desktop;
558 if (!winstation) return;
560 if (!(winstation->flags & WSF_VISIBLE))
562 set_error( STATUS_ILLEGAL_FUNCTION );
563 release_object( winstation );
564 return;
567 if ((desktop = get_desktop_obj( current->process, current->process->desktop, 0 )))
569 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
570 release_object( desktop );
572 release_object( winstation );
575 /* close a desktop */
576 DECL_HANDLER(close_desktop)
578 struct desktop *desktop;
580 /* make sure it is a desktop handle */
581 if ((desktop = (struct desktop *)get_handle_obj( current->process, req->handle,
582 0, &desktop_ops )))
584 if (close_handle( current->process, req->handle )) set_error( STATUS_DEVICE_BUSY );
585 release_object( desktop );
590 /* get the thread current desktop */
591 DECL_HANDLER(get_thread_desktop)
593 struct thread *thread;
595 if (!(thread = get_thread_from_id( req->tid ))) return;
596 reply->handle = thread->desktop;
597 release_object( thread );
601 /* set the thread current desktop */
602 DECL_HANDLER(set_thread_desktop)
604 struct desktop *old_desktop, *new_desktop;
605 struct winstation *winstation;
607 if (!(winstation = get_process_winstation( current->process, 0 /* FIXME: access rights? */ )))
608 return;
610 if (!(new_desktop = get_desktop_obj( current->process, req->handle, 0 )))
612 release_object( winstation );
613 return;
615 if (new_desktop->winstation != winstation)
617 set_error( STATUS_ACCESS_DENIED );
618 release_object( new_desktop );
619 release_object( winstation );
620 return;
623 /* check if we are changing to a new desktop */
625 if (!(old_desktop = get_desktop_obj( current->process, current->desktop, 0)))
626 clear_error(); /* ignore error */
628 /* when changing desktop, we can't have any users on the current one */
629 if (old_desktop != new_desktop && current->desktop_users > 0)
630 set_error( STATUS_DEVICE_BUSY );
631 else
632 current->desktop = req->handle; /* FIXME: should we close the old one? */
634 if (!current->process->desktop)
635 set_process_default_desktop( current->process, new_desktop, req->handle );
637 if (old_desktop != new_desktop && current->queue) detach_thread_input( current );
639 if (old_desktop) release_object( old_desktop );
640 release_object( new_desktop );
641 release_object( winstation );
645 /* get/set information about a user object (window station or desktop) */
646 DECL_HANDLER(set_user_object_info)
648 struct object *obj;
649 data_size_t len;
651 if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
653 if (obj->ops == &desktop_ops)
655 struct desktop *desktop = (struct desktop *)obj;
656 reply->is_desktop = 1;
657 reply->old_obj_flags = desktop->flags;
658 if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags;
660 else if (obj->ops == &winstation_ops)
662 struct winstation *winstation = (struct winstation *)obj;
663 reply->is_desktop = 0;
664 reply->old_obj_flags = winstation->flags;
665 if (req->flags & SET_USER_OBJECT_SET_FLAGS) winstation->flags = req->obj_flags;
667 else
669 set_error( STATUS_OBJECT_TYPE_MISMATCH );
670 release_object( obj );
671 return;
673 if (obj->ops == &desktop_ops && get_reply_max_size() && (req->flags & SET_USER_OBJECT_GET_FULL_NAME))
675 struct desktop *desktop = (struct desktop *)obj;
676 data_size_t winstation_len, desktop_len;
677 const WCHAR *winstation_name = get_object_name( &desktop->winstation->obj, &winstation_len );
678 const WCHAR *desktop_name = get_object_name( obj, &desktop_len );
679 WCHAR *full_name;
681 if (!winstation_name) winstation_len = 0;
682 if (!desktop_name) desktop_len = 0;
683 len = winstation_len + desktop_len + sizeof(WCHAR);
684 if ((full_name = mem_alloc( len )))
686 memcpy( full_name, winstation_name, winstation_len );
687 full_name[winstation_len / sizeof(WCHAR)] = '\\';
688 memcpy( full_name + winstation_len / sizeof(WCHAR) + 1, desktop_name, desktop_len );
689 set_reply_data_ptr( full_name, min( len, get_reply_max_size() ));
692 else
694 const WCHAR *name = get_object_name( obj, &len );
695 if (name) set_reply_data( name, min( len, get_reply_max_size() ));
697 release_object( obj );
701 /* enumerate window stations */
702 DECL_HANDLER(enum_winstation)
704 unsigned int index = 0;
705 struct winstation *winsta;
706 const WCHAR *name;
707 data_size_t len;
709 LIST_FOR_EACH_ENTRY( winsta, &winstation_list, struct winstation, entry )
711 unsigned int access = WINSTA_ENUMERATE;
712 if (req->index > index++) continue;
713 if (!check_object_access( &winsta->obj, &access )) continue;
714 clear_error();
715 reply->next = index;
716 if ((name = get_object_name( &winsta->obj, &len )))
717 set_reply_data( name, min( len, get_reply_max_size() ));
718 return;
720 set_error( STATUS_NO_MORE_ENTRIES );
724 /* enumerate desktops */
725 DECL_HANDLER(enum_desktop)
727 struct winstation *winstation;
728 struct desktop *desktop;
729 unsigned int index = 0;
730 const WCHAR *name;
731 data_size_t len;
733 if (!(winstation = (struct winstation *)get_handle_obj( current->process, req->winstation,
734 WINSTA_ENUMDESKTOPS, &winstation_ops )))
735 return;
737 LIST_FOR_EACH_ENTRY( desktop, &winstation->desktops, struct desktop, entry )
739 unsigned int access = DESKTOP_ENUMERATE;
740 if (req->index > index++) continue;
741 if (!desktop->obj.name) continue;
742 if (!check_object_access( &desktop->obj, &access )) continue;
743 if ((name = get_object_name( &desktop->obj, &len )))
744 set_reply_data( name, min( len, get_reply_max_size() ));
745 release_object( winstation );
746 clear_error();
747 reply->next = index;
748 return;
751 release_object( winstation );
752 set_error( STATUS_NO_MORE_ENTRIES );