ws2_32: Do not assume that an fd_set is bounded by FD_SETSIZE.
[wine.git] / server / winstation.c
blob854affead77951d65da167833b96b2a53aa480ed
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"
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"
42 #define DESKTOP_ALL_ACCESS 0x01ff
44 static struct list winstation_list = LIST_INIT(winstation_list);
46 static void winstation_dump( struct object *obj, int verbose );
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, struct object *root );
50 static void winstation_destroy( struct object *obj );
51 static void desktop_dump( struct object *obj, int verbose );
52 static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
53 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
54 static void desktop_destroy( struct object *obj );
56 static const WCHAR winstation_name[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
58 struct type_descr winstation_type =
60 { winstation_name, sizeof(winstation_name) }, /* name */
61 STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS, /* valid_access */
62 { /* mapping */
63 STANDARD_RIGHTS_READ | WINSTA_READSCREEN | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_ENUMDESKTOPS,
64 STANDARD_RIGHTS_WRITE | WINSTA_WRITEATTRIBUTES | WINSTA_CREATEDESKTOP | WINSTA_ACCESSCLIPBOARD,
65 STANDARD_RIGHTS_EXECUTE | WINSTA_EXITWINDOWS | WINSTA_ACCESSGLOBALATOMS,
66 STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS
70 static const struct object_ops winstation_ops =
72 sizeof(struct winstation), /* size */
73 &winstation_type, /* type */
74 winstation_dump, /* dump */
75 no_add_queue, /* add_queue */
76 NULL, /* remove_queue */
77 NULL, /* signaled */
78 NULL, /* satisfied */
79 no_signal, /* signal */
80 no_get_fd, /* get_fd */
81 default_map_access, /* map_access */
82 default_get_sd, /* get_sd */
83 default_set_sd, /* set_sd */
84 default_get_full_name, /* get_full_name */
85 winstation_lookup_name, /* lookup_name */
86 directory_link_name, /* link_name */
87 default_unlink_name, /* unlink_name */
88 no_open_file, /* open_file */
89 no_kernel_obj_list, /* get_kernel_obj_list */
90 winstation_close_handle, /* close_handle */
91 winstation_destroy /* destroy */
95 static const WCHAR desktop_name[] = {'D','e','s','k','t','o','p'};
97 struct type_descr desktop_type =
99 { desktop_name, sizeof(desktop_name) }, /* name */
100 STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS, /* valid_access */
101 { /* mapping */
102 STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS,
103 STANDARD_RIGHTS_WRITE | DESKTOP_WRITEOBJECTS | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD
104 | DESKTOP_HOOKCONTROL | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW,
105 STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP,
106 STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS
110 static const struct object_ops desktop_ops =
112 sizeof(struct desktop), /* size */
113 &desktop_type, /* type */
114 desktop_dump, /* dump */
115 no_add_queue, /* add_queue */
116 NULL, /* remove_queue */
117 NULL, /* signaled */
118 NULL, /* satisfied */
119 no_signal, /* signal */
120 no_get_fd, /* get_fd */
121 default_map_access, /* map_access */
122 default_get_sd, /* get_sd */
123 default_set_sd, /* set_sd */
124 default_get_full_name, /* get_full_name */
125 no_lookup_name, /* lookup_name */
126 desktop_link_name, /* link_name */
127 default_unlink_name, /* unlink_name */
128 no_open_file, /* open_file */
129 no_kernel_obj_list, /* get_kernel_obj_list */
130 desktop_close_handle, /* close_handle */
131 desktop_destroy /* destroy */
134 /* create a winstation object */
135 static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
136 unsigned int attr, unsigned int flags )
138 struct winstation *winstation;
140 if ((winstation = create_named_object( root, &winstation_ops, name, attr, NULL )))
142 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
144 /* initialize it if it didn't already exist */
145 winstation->flags = flags;
146 winstation->clipboard = NULL;
147 winstation->atom_table = NULL;
148 list_add_tail( &winstation_list, &winstation->entry );
149 list_init( &winstation->desktops );
150 if (!(winstation->desktop_names = create_namespace( 7 )))
152 release_object( winstation );
153 return NULL;
156 else clear_error();
158 return winstation;
161 static void winstation_dump( struct object *obj, int verbose )
163 struct winstation *winstation = (struct winstation *)obj;
165 fprintf( stderr, "Winstation flags=%x clipboard=%p atoms=%p\n",
166 winstation->flags, winstation->clipboard, winstation->atom_table );
169 static int winstation_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
171 return (process->winstation != handle);
174 static struct object *winstation_lookup_name( struct object *obj, struct unicode_str *name,
175 unsigned int attr, struct object *root )
177 struct winstation *winstation = (struct winstation *)obj;
178 struct object *found;
180 assert( obj->ops == &winstation_ops );
182 if (!name) return NULL; /* open the winstation itself */
184 if (get_path_element( name->str, name->len ) < name->len) /* no backslash allowed in name */
186 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
187 return NULL;
190 if ((found = find_object( winstation->desktop_names, name, attr )))
191 name->len = 0;
193 return found;
196 static void winstation_destroy( struct object *obj )
198 struct winstation *winstation = (struct winstation *)obj;
200 list_remove( &winstation->entry );
201 if (winstation->clipboard) release_object( winstation->clipboard );
202 if (winstation->atom_table) release_object( winstation->atom_table );
203 free( winstation->desktop_names );
206 /* retrieve the process window station, checking the handle access rights */
207 struct winstation *get_process_winstation( struct process *process, unsigned int access )
209 return (struct winstation *)get_handle_obj( process, process->winstation,
210 access, &winstation_ops );
213 /* retrieve a pointer to a desktop object */
214 struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, unsigned int access )
216 return (struct desktop *)get_handle_obj( process, handle, access, &desktop_ops );
219 /* create a desktop object */
220 static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
221 unsigned int flags, struct winstation *winstation )
223 struct desktop *desktop;
225 if ((desktop = create_named_object( &winstation->obj, &desktop_ops, name, attr, NULL )))
227 if (get_error() != STATUS_OBJECT_NAME_EXISTS)
229 /* initialize it if it didn't already exist */
230 desktop->flags = flags;
231 desktop->winstation = (struct winstation *)grab_object( winstation );
232 desktop->top_window = NULL;
233 desktop->msg_window = NULL;
234 desktop->global_hooks = NULL;
235 desktop->close_timeout = NULL;
236 desktop->foreground_input = NULL;
237 desktop->users = 0;
238 memset( &desktop->cursor, 0, sizeof(desktop->cursor) );
239 memset( desktop->keystate, 0, sizeof(desktop->keystate) );
240 list_add_tail( &winstation->desktops, &desktop->entry );
241 list_init( &desktop->hotkeys );
243 else clear_error();
245 return desktop;
248 static void desktop_dump( struct object *obj, int verbose )
250 struct desktop *desktop = (struct desktop *)obj;
252 fprintf( stderr, "Desktop flags=%x winstation=%p top_win=%p hooks=%p\n",
253 desktop->flags, desktop->winstation, desktop->top_window, desktop->global_hooks );
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 (get_path_element( name->name, name->len ) < name->len) /* 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 /* retrieve the thread desktop, checking the handle access rights */
299 struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
301 return get_desktop_obj( thread->process, thread->desktop, access );
304 static void close_desktop_timeout( void *private )
306 struct desktop *desktop = private;
308 desktop->close_timeout = NULL;
309 unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
310 post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
313 /* add a user of the desktop and cancel the close timeout */
314 static void add_desktop_user( struct desktop *desktop )
316 desktop->users++;
317 if (desktop->close_timeout)
319 remove_timeout_user( desktop->close_timeout );
320 desktop->close_timeout = NULL;
324 /* remove a user of the desktop and start the close timeout if necessary */
325 static void remove_desktop_user( struct desktop *desktop )
327 struct process *process;
328 assert( desktop->users > 0 );
329 desktop->users--;
331 /* if we have one remaining user, it has to be the manager of the desktop window */
332 if ((process = get_top_window_owner( desktop )) && desktop->users == process->running_threads && !desktop->close_timeout)
333 desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
336 /* set the thread default desktop handle */
337 void set_thread_default_desktop( struct thread *thread, struct desktop *desktop, obj_handle_t handle )
339 if (thread->desktop) return; /* nothing to do */
341 thread->desktop = handle;
342 if (!thread->process->is_system) add_desktop_user( desktop );
345 /* set the process default desktop handle */
346 void set_process_default_desktop( struct process *process, struct desktop *desktop,
347 obj_handle_t handle )
349 struct thread *thread;
351 if (process->desktop == handle) return; /* nothing to do */
353 process->desktop = handle;
355 /* set desktop for threads that don't have one yet */
356 LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
357 set_thread_default_desktop( thread, desktop, handle );
360 /* connect a process to its window station */
361 void connect_process_winstation( struct process *process, struct thread *parent_thread,
362 struct process *parent_process )
364 struct winstation *winstation = NULL;
365 struct desktop *desktop = NULL;
366 obj_handle_t handle;
368 /* check for an inherited winstation handle (don't ask...) */
369 if ((handle = find_inherited_handle( process, &winstation_ops )))
371 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
373 else if (parent_process->winstation)
375 handle = duplicate_handle( parent_process, parent_process->winstation,
376 process, 0, 0, DUPLICATE_SAME_ACCESS );
377 winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
379 if (!winstation) goto done;
380 process->winstation = handle;
382 if ((handle = find_inherited_handle( process, &desktop_ops )))
384 desktop = get_desktop_obj( process, handle, 0 );
385 if (!desktop || desktop->winstation != winstation) goto done;
387 else
389 if (parent_thread && parent_thread->desktop)
390 handle = parent_thread->desktop;
391 else if (parent_process->desktop)
392 handle = parent_process->desktop;
393 else
394 goto done;
396 desktop = get_desktop_obj( parent_process, handle, 0 );
398 if (!desktop || desktop->winstation != winstation) goto done;
400 handle = duplicate_handle( parent_process, handle, process, 0, 0, DUPLICATE_SAME_ACCESS );
402 if (handle) set_process_default_desktop( process, desktop, handle );
404 done:
405 if (desktop) release_object( desktop );
406 if (winstation) release_object( winstation );
407 clear_error();
410 /* close the desktop of a given process */
411 void close_process_desktop( struct process *process )
413 obj_handle_t handle;
415 if (!(handle = process->desktop)) return;
417 process->desktop = 0;
418 close_handle( process, handle );
421 /* release (and eventually close) the desktop of a given thread */
422 void release_thread_desktop( struct thread *thread, int close )
424 struct desktop *desktop;
425 obj_handle_t handle;
427 if (!(handle = thread->desktop)) return;
429 if (!thread->process->is_system)
431 if (!(desktop = get_desktop_obj( thread->process, handle, 0 ))) clear_error(); /* ignore errors */
432 else
434 remove_desktop_user( desktop );
435 release_object( desktop );
439 if (close)
441 thread->desktop = 0;
442 close_handle( thread->process, handle );
446 /* create a window station */
447 DECL_HANDLER(create_winstation)
449 struct winstation *winstation;
450 struct unicode_str name = get_req_unicode_str();
451 struct object *root = NULL;
453 reply->handle = 0;
454 if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir ))) return;
456 if ((winstation = create_winstation( root, &name, req->attributes, req->flags )))
458 reply->handle = alloc_handle( current->process, winstation, req->access, req->attributes );
459 release_object( winstation );
461 if (root) release_object( root );
464 /* open a handle to a window station */
465 DECL_HANDLER(open_winstation)
467 struct unicode_str name = get_req_unicode_str();
469 reply->handle = open_object( current->process, req->rootdir, req->access,
470 &winstation_ops, &name, req->attributes );
474 /* close a window station */
475 DECL_HANDLER(close_winstation)
477 struct winstation *winstation;
479 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
480 0, &winstation_ops )))
482 if (close_handle( current->process, req->handle )) set_error( STATUS_ACCESS_DENIED );
483 release_object( winstation );
488 /* get the process current window station */
489 DECL_HANDLER(get_process_winstation)
491 reply->handle = current->process->winstation;
495 /* set the process current window station */
496 DECL_HANDLER(set_process_winstation)
498 struct winstation *winstation;
500 if ((winstation = (struct winstation *)get_handle_obj( current->process, req->handle,
501 0, &winstation_ops )))
503 /* FIXME: should we close the old one? */
504 current->process->winstation = req->handle;
505 release_object( winstation );
509 /* create a desktop */
510 DECL_HANDLER(create_desktop)
512 struct desktop *desktop;
513 struct winstation *winstation;
514 struct unicode_str name = get_req_unicode_str();
516 reply->handle = 0;
517 if (!name.len)
519 set_error( STATUS_INVALID_HANDLE );
520 return;
522 if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
524 if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
526 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
527 release_object( desktop );
529 release_object( winstation );
533 /* open a handle to a desktop */
534 DECL_HANDLER(open_desktop)
536 struct winstation *winstation;
537 struct object *obj;
538 struct unicode_str name = get_req_unicode_str();
540 /* FIXME: check access rights */
541 if (!req->winsta)
542 winstation = get_process_winstation( current->process, 0 );
543 else
544 winstation = (struct winstation *)get_handle_obj( current->process, req->winsta, 0, &winstation_ops );
546 if (!winstation) return;
548 if ((obj = open_named_object( &winstation->obj, &desktop_ops, &name, req->attributes )))
550 reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
551 release_object( obj );
554 release_object( winstation );
557 /* open a handle to current input desktop */
558 DECL_HANDLER(open_input_desktop)
560 /* FIXME: check access rights */
561 struct winstation *winstation = get_process_winstation( current->process, 0 );
562 struct desktop *desktop;
564 if (!winstation) return;
566 if (!(winstation->flags & WSF_VISIBLE))
568 set_error( STATUS_ILLEGAL_FUNCTION );
569 release_object( winstation );
570 return;
573 if ((desktop = get_desktop_obj( current->process, current->process->desktop, 0 )))
575 reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
576 release_object( desktop );
578 release_object( winstation );
581 /* close a desktop */
582 DECL_HANDLER(close_desktop)
584 struct desktop *desktop;
586 /* make sure it is a desktop handle */
587 if ((desktop = (struct desktop *)get_handle_obj( current->process, req->handle,
588 0, &desktop_ops )))
590 if (close_handle( current->process, req->handle )) set_error( STATUS_DEVICE_BUSY );
591 release_object( desktop );
596 /* get the thread current desktop */
597 DECL_HANDLER(get_thread_desktop)
599 struct thread *thread;
601 if (!(thread = get_thread_from_id( req->tid ))) return;
602 reply->handle = thread->desktop;
603 release_object( thread );
607 /* set the thread current desktop */
608 DECL_HANDLER(set_thread_desktop)
610 struct desktop *old_desktop, *new_desktop;
611 struct winstation *winstation;
613 if (!(winstation = get_process_winstation( current->process, 0 /* FIXME: access rights? */ )))
614 return;
616 if (!(new_desktop = get_desktop_obj( current->process, req->handle, 0 )))
618 release_object( winstation );
619 return;
621 if (new_desktop->winstation != winstation)
623 set_error( STATUS_ACCESS_DENIED );
624 release_object( new_desktop );
625 release_object( winstation );
626 return;
629 /* check if we are changing to a new desktop */
631 if (!(old_desktop = get_desktop_obj( current->process, current->desktop, 0)))
632 clear_error(); /* ignore error */
634 /* when changing desktop, we can't have any users on the current one */
635 if (old_desktop != new_desktop && current->desktop_users > 0)
636 set_error( STATUS_DEVICE_BUSY );
637 else
639 current->desktop = req->handle; /* FIXME: should we close the old one? */
640 if (!current->process->is_system && old_desktop != new_desktop)
642 add_desktop_user( new_desktop );
643 if (old_desktop) remove_desktop_user( old_desktop );
647 if (!current->process->desktop)
648 set_process_default_desktop( current->process, new_desktop, req->handle );
650 if (old_desktop != new_desktop && current->queue) detach_thread_input( current );
652 if (old_desktop) release_object( old_desktop );
653 release_object( new_desktop );
654 release_object( winstation );
658 /* get/set information about a user object (window station or desktop) */
659 DECL_HANDLER(set_user_object_info)
661 struct object *obj;
662 data_size_t len;
664 if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
666 if (obj->ops == &desktop_ops)
668 struct desktop *desktop = (struct desktop *)obj;
669 reply->is_desktop = 1;
670 reply->old_obj_flags = desktop->flags;
671 if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags;
673 else if (obj->ops == &winstation_ops)
675 struct winstation *winstation = (struct winstation *)obj;
676 reply->is_desktop = 0;
677 reply->old_obj_flags = winstation->flags;
678 if (req->flags & SET_USER_OBJECT_SET_FLAGS) winstation->flags = req->obj_flags;
680 else
682 set_error( STATUS_OBJECT_TYPE_MISMATCH );
683 release_object( obj );
684 return;
686 if (obj->ops == &desktop_ops && get_reply_max_size() && (req->flags & SET_USER_OBJECT_GET_FULL_NAME))
688 struct desktop *desktop = (struct desktop *)obj;
689 data_size_t winstation_len, desktop_len;
690 const WCHAR *winstation_name = get_object_name( &desktop->winstation->obj, &winstation_len );
691 const WCHAR *desktop_name = get_object_name( obj, &desktop_len );
692 WCHAR *full_name;
694 if (!winstation_name) winstation_len = 0;
695 if (!desktop_name) desktop_len = 0;
696 len = winstation_len + desktop_len + sizeof(WCHAR);
697 if ((full_name = mem_alloc( len )))
699 memcpy( full_name, winstation_name, winstation_len );
700 full_name[winstation_len / sizeof(WCHAR)] = '\\';
701 memcpy( full_name + winstation_len / sizeof(WCHAR) + 1, desktop_name, desktop_len );
702 set_reply_data_ptr( full_name, min( len, get_reply_max_size() ));
705 else
707 const WCHAR *name = get_object_name( obj, &len );
708 if (name) set_reply_data( name, min( len, get_reply_max_size() ));
710 release_object( obj );
714 /* enumerate window stations */
715 DECL_HANDLER(enum_winstation)
717 unsigned int index = 0;
718 struct winstation *winsta;
719 const WCHAR *name;
720 data_size_t len;
722 LIST_FOR_EACH_ENTRY( winsta, &winstation_list, struct winstation, entry )
724 unsigned int access = WINSTA_ENUMERATE;
725 if (req->index > index++) continue;
726 if (!check_object_access( NULL, &winsta->obj, &access )) continue;
727 clear_error();
728 reply->next = index;
729 if ((name = get_object_name( &winsta->obj, &len )))
730 set_reply_data( name, min( len, get_reply_max_size() ));
731 return;
733 set_error( STATUS_NO_MORE_ENTRIES );
737 /* enumerate desktops */
738 DECL_HANDLER(enum_desktop)
740 struct winstation *winstation;
741 struct desktop *desktop;
742 unsigned int index = 0;
743 const WCHAR *name;
744 data_size_t len;
746 if (!(winstation = (struct winstation *)get_handle_obj( current->process, req->winstation,
747 WINSTA_ENUMDESKTOPS, &winstation_ops )))
748 return;
750 LIST_FOR_EACH_ENTRY( desktop, &winstation->desktops, struct desktop, entry )
752 unsigned int access = DESKTOP_ENUMERATE;
753 if (req->index > index++) continue;
754 if (!desktop->obj.name) continue;
755 if (!check_object_access( NULL, &desktop->obj, &access )) continue;
756 if ((name = get_object_name( &desktop->obj, &len )))
757 set_reply_data( name, min( len, get_reply_max_size() ));
758 release_object( winstation );
759 clear_error();
760 reply->next = index;
761 return;
764 release_object( winstation );
765 set_error( STATUS_NO_MORE_ENTRIES );