winedump: Don't dump volatile keys from regf file.
[wine.git] / server / winstation.c
blob5903497d61ef199d77e5d54191b016ccd64cb589
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"
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <sys/types.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"
33 #include "ntuser.h"
35 #include "object.h"
36 #include "handle.h"
37 #include "request.h"
38 #include "process.h"
39 #include "user.h"
40 #include "file.h"
41 #include "security.h"
43 #define DESKTOP_ALL_ACCESS 0x01ff
45 static struct list winstation_list = LIST_INIT(winstation_list);
47 static void winstation_dump( struct object *obj, int verbose );
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, struct object *root );
51 static void winstation_destroy( struct object *obj );
52 static void desktop_dump( struct object *obj, int verbose );
53 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
54 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
55 static void desktop_destroy( struct object *obj );
57 static const WCHAR winstation_name[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
59 struct type_descr winstation_type =
61 { winstation_name, sizeof(winstation_name) }, /* name */
62 STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS, /* valid_access */
63 { /* mapping */
64 STANDARD_RIGHTS_READ | WINSTA_READSCREEN | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_ENUMDESKTOPS,
65 STANDARD_RIGHTS_WRITE | WINSTA_WRITEATTRIBUTES | WINSTA_CREATEDESKTOP | WINSTA_ACCESSCLIPBOARD,
66 STANDARD_RIGHTS_EXECUTE | WINSTA_EXITWINDOWS | WINSTA_ACCESSGLOBALATOMS,
67 STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS
71 static const struct object_ops winstation_ops =
73 sizeof(struct winstation), /* size */
74 &winstation_type, /* type */
75 winstation_dump, /* dump */
76 no_add_queue, /* add_queue */
77 NULL, /* remove_queue */
78 NULL, /* signaled */
79 NULL, /* satisfied */
80 no_signal, /* signal */
81 no_get_fd, /* get_fd */
82 default_map_access, /* map_access */
83 default_get_sd, /* get_sd */
84 default_set_sd, /* set_sd */
85 default_get_full_name, /* get_full_name */
86 winstation_lookup_name, /* lookup_name */
87 directory_link_name, /* link_name */
88 default_unlink_name, /* unlink_name */
89 no_open_file, /* open_file */
90 no_kernel_obj_list, /* get_kernel_obj_list */
91 winstation_close_handle, /* close_handle */
92 winstation_destroy /* destroy */
96 static const WCHAR desktop_name[] = {'D','e','s','k','t','o','p'};
98 struct type_descr desktop_type =
100 { desktop_name, sizeof(desktop_name) }, /* name */
101 STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS, /* valid_access */
102 { /* mapping */
103 STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS,
104 STANDARD_RIGHTS_WRITE | DESKTOP_WRITEOBJECTS | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD
105 | DESKTOP_HOOKCONTROL | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW,
106 STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP,
107 STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS
111 static const struct object_ops desktop_ops =
113 sizeof(struct desktop), /* size */
114 &desktop_type, /* type */
115 desktop_dump, /* dump */
116 no_add_queue, /* add_queue */
117 NULL, /* remove_queue */
118 NULL, /* signaled */
119 NULL, /* satisfied */
120 no_signal, /* signal */
121 no_get_fd, /* get_fd */
122 default_map_access, /* map_access */
123 default_get_sd, /* get_sd */
124 default_set_sd, /* set_sd */
125 default_get_full_name, /* get_full_name */
126 no_lookup_name, /* lookup_name */
127 desktop_link_name, /* link_name */
128 default_unlink_name, /* unlink_name */
129 no_open_file, /* open_file */
130 no_kernel_obj_list, /* get_kernel_obj_list */
131 desktop_close_handle, /* close_handle */
132 desktop_destroy /* destroy */
135 /* create a winstation object */
136 static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
137 unsigned int attr, unsigned int flags )
139 struct winstation *winstation;
141 if ((winstation = create_named_object( root, &winstation_ops, name, attr, NULL )))
143 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
145 /* initialize it if it didn't already exist */
146 winstation->flags = flags;
147 winstation->clipboard = NULL;
148 winstation->atom_table = NULL;
149 list_add_tail( &winstation_list, &winstation->entry );
150 list_init( &winstation->desktops );
151 if (!(winstation->desktop_names = create_namespace( 7 )))
153 release_object( winstation );
154 return NULL;
157 else clear_error();
159 return winstation;
162 static void winstation_dump( struct object *obj, int verbose )
164 struct winstation *winstation = (struct winstation *)obj;
166 fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p\n",
167 winstation->flags, winstation->clipboard, winstation->atom_table );
170 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
172 return (process->winstation != handle);
175 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
176 unsigned int attr, struct object *root )
178 struct winstation *winstation = (struct winstation *)obj;
179 struct object *found;
181 assert( obj->ops == &winstation_ops );
183 if (!name) return NULL; /* open the winstation itself */
185 if (get_path_element( name->str, name->len ) < name->len) /* no backslash allowed in name */
187 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
188 return NULL;
191 if ((found = find_object( winstation->desktop_names, name, attr )))
192 name->len = 0;
194 return found;
197 static void winstation_destroy( struct object *obj )
199 struct winstation *winstation = (struct winstation *)obj;
201 list_remove( &winstation->entry );
202 if (winstation->clipboard) release_object( winstation->clipboard );
203 if (winstation->atom_table) release_object( winstation->atom_table );
204 free( winstation->desktop_names );
207 /* retrieve the process window station, checking the handle access rights */
208 struct winstation *get_process_winstation( struct process *process, unsigned int access )
210 return (struct winstation *)get_handle_obj( process, process->winstation,
211 access, &winstation_ops );
214 /* retrieve a pointer to a desktop object */
215 struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, unsigned int access )
217 return (struct desktop *)get_handle_obj( process, handle, access, &desktop_ops );
220 /* create a desktop object */
221 static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
222 unsigned int flags, struct winstation *winstation )
224 struct desktop *desktop;
226 if ((desktop = create_named_object( &winstation->obj, &desktop_ops, name, attr, NULL )))
228 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
230 /* initialize it if it didn't already exist */
231 desktop->flags = flags;
232 desktop->winstation = (struct winstation *)grab_object( winstation );
233 desktop->top_window = NULL;
234 desktop->msg_window = NULL;
235 desktop->global_hooks = NULL;
236 desktop->close_timeout = NULL;
237 desktop->foreground_input = NULL;
238 desktop->users = 0;
239 memset( &desktop->cursor, 0, sizeof(desktop->cursor) );
240 memset( desktop->keystate, 0, sizeof(desktop->keystate) );
241 list_add_tail( &winstation->desktops, &desktop->entry );
242 list_init( &desktop->hotkeys );
244 else
246 desktop->flags |= (flags & DF_WINE_CREATE_DESKTOP);
247 clear_error();
250 return desktop;
253 static void desktop_dump( struct object *obj, int verbose )
255 struct desktop *desktop = (struct desktop *)obj;
257 fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p\n",
258 desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks );
261 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent )
263 struct winstation *winstation = (struct winstation *)parent;
265 if (parent->ops != &winstation_ops)
267 set_error( STATUS_OBJECT_TYPE_MISMATCH );
268 return 0;
270 if (get_path_element( name->name, name->len ) < name->len) /* no backslash allowed in name */
272 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
273 return 0;
275 namespace_add( winstation->desktop_names, name );
276 return 1;
279 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
281 struct thread *thread;
283 /* check if the handle is currently used by the process or one of its threads */
284 if (process->desktop == handle) return 0;
285 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
286 if (thread->desktop == handle) return 0;
287 return 1;
290 static void desktop_destroy( struct object *obj )
292 struct desktop *desktop = (struct desktop *)obj;
294 free_hotkeys( desktop, 0 );
295 if (desktop->top_window) free_window_handle( desktop->top_window );
296 if (desktop->msg_window) free_window_handle( desktop->msg_window );
297 if (desktop->global_hooks) release_object( desktop->global_hooks );
298 if (desktop->close_timeout) remove_timeout_user( desktop->close_timeout );
299 list_remove( &desktop->entry );
300 release_object( desktop->winstation );
303 /* retrieve the thread desktop, checking the handle access rights */
304 struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
306 return get_desktop_obj( thread->process, thread->desktop, access );
309 static void close_desktop_timeout( void *private )
311 struct desktop *desktop = private;
313 desktop->close_timeout = NULL;
314 unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
315 post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
318 /* add a user of the desktop and cancel the close timeout */
319 static void add_desktop_user( struct desktop *desktop )
321 desktop->users++;
322 if (desktop->close_timeout)
324 remove_timeout_user( desktop->close_timeout );
325 desktop->close_timeout = NULL;
329 /* remove a user of the desktop and start the close timeout if necessary */
330 static void remove_desktop_user( struct desktop *desktop )
332 struct process *process;
333 assert( desktop->users > 0 );
334 desktop->users--;
336 /* if we have one remaining user, it has to be the manager of the desktop window */
337 if ((process = get_top_window_owner( desktop )) && desktop->users == process->running_threads && !desktop->close_timeout)
338 desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
341 /* set the thread default desktop handle */
342 void set_thread_default_desktop( struct thread *thread, struct desktop *desktop, obj_handle_t handle )
344 if (thread->desktop) return; /* nothing to do */
346 thread->desktop = handle;
347 if (!thread->process->is_system) add_desktop_user( desktop );
350 /* set the process default desktop handle */
351 void set_process_default_desktop( struct process *process, struct desktop *desktop,
352 obj_handle_t handle )
354 struct thread *thread;
356 if (process->desktop == handle) return; /* nothing to do */
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 set_thread_default_desktop( thread, desktop, handle );
365 /* connect a process to its window station */
366 void connect_process_winstation( struct process *process, struct thread *parent_thread,
367 struct process *parent_process )
369 struct winstation *winstation = NULL;
370 struct desktop *desktop = NULL;
371 obj_handle_t handle;
373 /* check for an inherited winstation handle (don't ask...) */
374 if ((handle = find_inherited_handle( process, &winstation_ops )))
376 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
378 else if (parent_process->winstation)
380 handle = duplicate_handle( parent_process, parent_process->winstation,
381 process, 0, 0, DUPLICATE_SAME_ACCESS );
382 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
384 if (!winstation) goto done;
385 process->winstation = handle;
387 if ((handle = find_inherited_handle( process, &desktop_ops )))
389 desktop = get_desktop_obj( process, handle, 0 );
390 if (!desktop || desktop->winstation != winstation) goto done;
392 else
394 if (parent_thread && parent_thread->desktop)
395 handle = parent_thread->desktop;
396 else if (parent_process->desktop)
397 handle = parent_process->desktop;
398 else
399 goto done;
401 desktop = get_desktop_obj( parent_process, handle, 0 );
403 if (!desktop || desktop->winstation != winstation) goto done;
405 handle = duplicate_handle( parent_process, handle, process, 0, 0, DUPLICATE_SAME_ACCESS );
407 if (handle) set_process_default_desktop( process, desktop, handle );
409 done:
410 if (desktop) release_object( desktop );
411 if (winstation) release_object( winstation );
412 clear_error();
415 /* close the desktop of a given process */
416 void close_process_desktop( struct process *process )
418 obj_handle_t handle;
420 if (!(handle = process->desktop)) return;
422 process->desktop = 0;
423 close_handle( process, handle );
426 /* release (and eventually close) the desktop of a given thread */
427 void release_thread_desktop( struct thread *thread, int close )
429 struct desktop *desktop;
430 obj_handle_t handle;
432 if (!(handle = thread->desktop)) return;
434 if (!thread->process->is_system)
436 if (!(desktop = get_desktop_obj( thread->process, handle, 0 ))) clear_error(); /* ignore errors */
437 else
439 remove_desktop_user( desktop );
440 release_object( desktop );
444 if (close)
446 thread->desktop = 0;
447 close_handle( thread->process, handle );
451 /* create a window station */
452 DECL_HANDLER(create_winstation)
454 struct winstation *winstation;
455 struct unicode_str name = get_req_unicode_str();
456 struct object *root = NULL;
458 reply->handle = 0;
459 if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) return;
461 if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
463 reply->handle = alloc_handle( current->process, winstation, req->access, req->attributes );
464 release_object( winstation );
466 if (root) release_object( root );
469 /* open a handle to a window station */
470 DECL_HANDLER(open_winstation)
472 struct unicode_str name = get_req_unicode_str();
474 reply->handle = open_object( current->process, req->rootdir, req->access,
475 &winstation_ops, &name, req->attributes );
479 /* close a window station */
480 DECL_HANDLER(close_winstation)
482 struct winstation *winstation;
484 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
485 0, &winstation_ops )))
487 if (close_handle( current->process, req->handle )) set_error( STATUS_ACCESS_DENIED );
488 release_object( winstation );
493 /* get the process current window station */
494 DECL_HANDLER(get_process_winstation)
496 reply->handle = current->process->winstation;
500 /* set the process current window station */
501 DECL_HANDLER(set_process_winstation)
503 struct winstation *winstation;
505 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
506 0, &winstation_ops )))
508 /* FIXME: should we close the old one? */
509 current->process->winstation = req->handle;
510 release_object( winstation );
514 /* create a desktop */
515 DECL_HANDLER(create_desktop)
517 struct desktop *desktop;
518 struct winstation *winstation;
519 struct unicode_str name = get_req_unicode_str();
521 reply->handle = 0;
522 if (!name.len)
524 set_error( STATUS_INVALID_HANDLE );
525 return;
527 if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
529 if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
531 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
532 release_object( desktop );
534 release_object( winstation );
538 /* open a handle to a desktop */
539 DECL_HANDLER(open_desktop)
541 struct winstation *winstation;
542 struct object *obj;
543 struct unicode_str name = get_req_unicode_str();
545 /* FIXME: check access rights */
546 if (!req->winsta)
547 winstation = get_process_winstation( current->process, 0 );
548 else
549 winstation = (struct winstation *)get_handle_obj( current->process, req->winsta, 0, &winstation_ops );
551 if (!winstation) return;
553 if ((obj = open_named_object( &winstation->obj, &desktop_ops, &name, req->attributes )))
555 reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
556 release_object( obj );
559 release_object( winstation );
562 /* open a handle to current input desktop */
563 DECL_HANDLER(open_input_desktop)
565 /* FIXME: check access rights */
566 struct winstation *winstation = get_process_winstation( current->process, 0 );
567 struct desktop *desktop;
569 if (!winstation) return;
571 if (!(winstation->flags & WSF_VISIBLE))
573 set_error( STATUS_ILLEGAL_FUNCTION );
574 release_object( winstation );
575 return;
578 if ((desktop = get_desktop_obj( current->process, current->process->desktop, 0 )))
580 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
581 release_object( desktop );
583 release_object( winstation );
586 /* close a desktop */
587 DECL_HANDLER(close_desktop)
589 struct desktop *desktop;
591 /* make sure it is a desktop handle */
592 if ((desktop = (struct desktop *)get_handle_obj( current->process, req->handle,
593 0, &desktop_ops )))
595 if (close_handle( current->process, req->handle )) set_error( STATUS_DEVICE_BUSY );
596 release_object( desktop );
601 /* get the thread current desktop */
602 DECL_HANDLER(get_thread_desktop)
604 struct thread *thread;
606 if (!(thread = get_thread_from_id( req->tid ))) return;
607 reply->handle = thread->desktop;
608 release_object( thread );
612 /* set the thread current desktop */
613 DECL_HANDLER(set_thread_desktop)
615 struct desktop *old_desktop, *new_desktop;
616 struct winstation *winstation;
618 if (!(winstation = get_process_winstation( current->process, 0 /* FIXME: access rights? */ )))
619 return;
621 if (!(new_desktop = get_desktop_obj( current->process, req->handle, 0 )))
623 release_object( winstation );
624 return;
626 if (new_desktop->winstation != winstation)
628 set_error( STATUS_ACCESS_DENIED );
629 release_object( new_desktop );
630 release_object( winstation );
631 return;
634 /* check if we are changing to a new desktop */
636 if (!(old_desktop = get_desktop_obj( current->process, current->desktop, 0)))
637 clear_error(); /* ignore error */
639 /* when changing desktop, we can't have any users on the current one */
640 if (old_desktop != new_desktop && current->desktop_users > 0)
641 set_error( STATUS_DEVICE_BUSY );
642 else
644 current->desktop = req->handle; /* FIXME: should we close the old one? */
645 if (!current->process->is_system && old_desktop != new_desktop)
647 add_desktop_user( new_desktop );
648 if (old_desktop) remove_desktop_user( old_desktop );
652 if (!current->process->desktop)
653 set_process_default_desktop( current->process, new_desktop, req->handle );
655 if (old_desktop != new_desktop && current->queue) detach_thread_input( current );
657 if (old_desktop) release_object( old_desktop );
658 release_object( new_desktop );
659 release_object( winstation );
663 /* get/set information about a user object (window station or desktop) */
664 DECL_HANDLER(set_user_object_info)
666 struct object *obj;
667 data_size_t len;
669 if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
671 if (obj->ops == &desktop_ops)
673 struct desktop *desktop = (struct desktop *)obj;
674 reply->is_desktop = 1;
675 reply->old_obj_flags = desktop->flags;
676 if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags;
678 else if (obj->ops == &winstation_ops)
680 struct winstation *winstation = (struct winstation *)obj;
681 reply->is_desktop = 0;
682 reply->old_obj_flags = winstation->flags;
683 if (req->flags & SET_USER_OBJECT_SET_FLAGS) winstation->flags = req->obj_flags;
685 else
687 set_error( STATUS_OBJECT_TYPE_MISMATCH );
688 release_object( obj );
689 return;
691 if (obj->ops == &desktop_ops && get_reply_max_size() && (req->flags & SET_USER_OBJECT_GET_FULL_NAME))
693 struct desktop *desktop = (struct desktop *)obj;
694 data_size_t winstation_len, desktop_len;
695 const WCHAR *winstation_name = get_object_name( &desktop->winstation->obj, &winstation_len );
696 const WCHAR *desktop_name = get_object_name( obj, &desktop_len );
697 WCHAR *full_name;
699 if (!winstation_name) winstation_len = 0;
700 if (!desktop_name) desktop_len = 0;
701 len = winstation_len + desktop_len + sizeof(WCHAR);
702 if ((full_name = mem_alloc( len )))
704 memcpy( full_name, winstation_name, winstation_len );
705 full_name[winstation_len / sizeof(WCHAR)] = '\\';
706 memcpy( full_name + winstation_len / sizeof(WCHAR) + 1, desktop_name, desktop_len );
707 set_reply_data_ptr( full_name, min( len, get_reply_max_size() ));
710 else
712 const WCHAR *name = get_object_name( obj, &len );
713 if (name) set_reply_data( name, min( len, get_reply_max_size() ));
715 release_object( obj );
719 /* enumerate window stations */
720 DECL_HANDLER(enum_winstation)
722 unsigned int index = 0;
723 struct winstation *winsta;
724 const WCHAR *name;
725 data_size_t len;
727 LIST_FOR_EACH_ENTRY( winsta, &winstation_list, struct winstation, entry )
729 unsigned int access = WINSTA_ENUMERATE;
730 if (req->index > index++) continue;
731 if (!check_object_access( NULL, &winsta->obj, &access )) continue;
732 clear_error();
733 reply->next = index;
734 if ((name = get_object_name( &winsta->obj, &len )))
735 set_reply_data( name, min( len, get_reply_max_size() ));
736 return;
738 set_error( STATUS_NO_MORE_ENTRIES );
742 /* enumerate desktops */
743 DECL_HANDLER(enum_desktop)
745 struct winstation *winstation;
746 struct desktop *desktop;
747 unsigned int index = 0;
748 const WCHAR *name;
749 data_size_t len;
751 if (!(winstation = (struct winstation *)get_handle_obj( current->process, req->winstation,
752 WINSTA_ENUMDESKTOPS, &winstation_ops )))
753 return;
755 LIST_FOR_EACH_ENTRY( desktop, &winstation->desktops, struct desktop, entry )
757 unsigned int access = DESKTOP_ENUMERATE;
758 if (req->index > index++) continue;
759 if (!desktop->obj.name) continue;
760 if (!check_object_access( NULL, &desktop->obj, &access )) continue;
761 if ((name = get_object_name( &desktop->obj, &len )))
762 set_reply_data( name, min( len, get_reply_max_size() ));
763 release_object( winstation );
764 clear_error();
765 reply->next = index;
766 return;
769 release_object( winstation );
770 set_error( STATUS_NO_MORE_ENTRIES );