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
22 #include "wine/port.h"
28 #define WIN32_NO_STATUS
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
,
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 */
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 */
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
);
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
,
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
);
171 if ((found
= find_object( winstation
->desktop_names
, name
, attr
)))
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
;
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
);
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
);
264 if (get_path_element( name
->name
, name
->len
) < name
->len
) /* no backslash allowed in name */
266 set_error( STATUS_OBJECT_PATH_SYNTAX_BAD
);
269 namespace_add( winstation
->desktop_names
, name
);
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;
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
)
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 );
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
;
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
;
402 if (parent_thread
&& parent_thread
->desktop
)
403 handle
= parent_thread
->desktop
;
404 else if (parent_process
->desktop
)
405 handle
= parent_process
->desktop
;
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
);
418 if (desktop
) release_object( desktop
);
419 if (winstation
) release_object( winstation
);
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
;
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
;
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();
518 set_error( STATUS_INVALID_HANDLE
);
521 if ((winstation
= get_process_winstation( current
->process
, WINSTA_CREATEDESKTOP
)))
523 if ((desktop
= create_desktop( &name
, req
->attributes
, req
->flags
, winstation
)))
525 reply
->handle
= alloc_handle( current
->process
, desktop
, req
->access
, req
->attributes
);
526 release_object( desktop
);
528 release_object( winstation
);
532 /* open a handle to a desktop */
533 DECL_HANDLER(open_desktop
)
535 struct winstation
*winstation
;
537 struct unicode_str name
= get_req_unicode_str();
539 /* FIXME: check access rights */
541 winstation
= get_process_winstation( current
->process
, 0 );
543 winstation
= (struct winstation
*)get_handle_obj( current
->process
, req
->winsta
, 0, &winstation_ops
);
545 if (!winstation
) return;
547 if ((obj
= open_named_object( &winstation
->obj
, &desktop_ops
, &name
, req
->attributes
)))
549 reply
->handle
= alloc_handle( current
->process
, obj
, req
->access
, req
->attributes
);
550 release_object( obj
);
553 release_object( winstation
);
556 /* open a handle to current input desktop */
557 DECL_HANDLER(open_input_desktop
)
559 /* FIXME: check access rights */
560 struct winstation
*winstation
= get_process_winstation( current
->process
, 0 );
561 struct desktop
*desktop
;
563 if (!winstation
) return;
565 if (!(winstation
->flags
& WSF_VISIBLE
))
567 set_error( STATUS_ILLEGAL_FUNCTION
);
568 release_object( winstation
);
572 if ((desktop
= get_desktop_obj( current
->process
, current
->process
->desktop
, 0 )))
574 reply
->handle
= alloc_handle( current
->process
, desktop
, req
->access
, req
->attributes
);
575 release_object( desktop
);
577 release_object( winstation
);
580 /* close a desktop */
581 DECL_HANDLER(close_desktop
)
583 struct desktop
*desktop
;
585 /* make sure it is a desktop handle */
586 if ((desktop
= (struct desktop
*)get_handle_obj( current
->process
, req
->handle
,
589 if (close_handle( current
->process
, req
->handle
)) set_error( STATUS_DEVICE_BUSY
);
590 release_object( desktop
);
595 /* get the thread current desktop */
596 DECL_HANDLER(get_thread_desktop
)
598 struct thread
*thread
;
600 if (!(thread
= get_thread_from_id( req
->tid
))) return;
601 reply
->handle
= thread
->desktop
;
602 release_object( thread
);
606 /* set the thread current desktop */
607 DECL_HANDLER(set_thread_desktop
)
609 struct desktop
*old_desktop
, *new_desktop
;
610 struct winstation
*winstation
;
612 if (!(winstation
= get_process_winstation( current
->process
, 0 /* FIXME: access rights? */ )))
615 if (!(new_desktop
= get_desktop_obj( current
->process
, req
->handle
, 0 )))
617 release_object( winstation
);
620 if (new_desktop
->winstation
!= winstation
)
622 set_error( STATUS_ACCESS_DENIED
);
623 release_object( new_desktop
);
624 release_object( winstation
);
628 /* check if we are changing to a new desktop */
630 if (!(old_desktop
= get_desktop_obj( current
->process
, current
->desktop
, 0)))
631 clear_error(); /* ignore error */
633 /* when changing desktop, we can't have any users on the current one */
634 if (old_desktop
!= new_desktop
&& current
->desktop_users
> 0)
635 set_error( STATUS_DEVICE_BUSY
);
637 current
->desktop
= req
->handle
; /* FIXME: should we close the old one? */
639 if (!current
->process
->desktop
)
640 set_process_default_desktop( current
->process
, new_desktop
, req
->handle
);
642 if (old_desktop
!= new_desktop
&& current
->queue
) detach_thread_input( current
);
644 if (old_desktop
) release_object( old_desktop
);
645 release_object( new_desktop
);
646 release_object( winstation
);
650 /* get/set information about a user object (window station or desktop) */
651 DECL_HANDLER(set_user_object_info
)
656 if (!(obj
= get_handle_obj( current
->process
, req
->handle
, 0, NULL
))) return;
658 if (obj
->ops
== &desktop_ops
)
660 struct desktop
*desktop
= (struct desktop
*)obj
;
661 reply
->is_desktop
= 1;
662 reply
->old_obj_flags
= desktop
->flags
;
663 if (req
->flags
& SET_USER_OBJECT_SET_FLAGS
) desktop
->flags
= req
->obj_flags
;
665 else if (obj
->ops
== &winstation_ops
)
667 struct winstation
*winstation
= (struct winstation
*)obj
;
668 reply
->is_desktop
= 0;
669 reply
->old_obj_flags
= winstation
->flags
;
670 if (req
->flags
& SET_USER_OBJECT_SET_FLAGS
) winstation
->flags
= req
->obj_flags
;
674 set_error( STATUS_OBJECT_TYPE_MISMATCH
);
675 release_object( obj
);
678 if (obj
->ops
== &desktop_ops
&& get_reply_max_size() && (req
->flags
& SET_USER_OBJECT_GET_FULL_NAME
))
680 struct desktop
*desktop
= (struct desktop
*)obj
;
681 data_size_t winstation_len
, desktop_len
;
682 const WCHAR
*winstation_name
= get_object_name( &desktop
->winstation
->obj
, &winstation_len
);
683 const WCHAR
*desktop_name
= get_object_name( obj
, &desktop_len
);
686 if (!winstation_name
) winstation_len
= 0;
687 if (!desktop_name
) desktop_len
= 0;
688 len
= winstation_len
+ desktop_len
+ sizeof(WCHAR
);
689 if ((full_name
= mem_alloc( len
)))
691 memcpy( full_name
, winstation_name
, winstation_len
);
692 full_name
[winstation_len
/ sizeof(WCHAR
)] = '\\';
693 memcpy( full_name
+ winstation_len
/ sizeof(WCHAR
) + 1, desktop_name
, desktop_len
);
694 set_reply_data_ptr( full_name
, min( len
, get_reply_max_size() ));
699 const WCHAR
*name
= get_object_name( obj
, &len
);
700 if (name
) set_reply_data( name
, min( len
, get_reply_max_size() ));
702 release_object( obj
);
706 /* enumerate window stations */
707 DECL_HANDLER(enum_winstation
)
709 unsigned int index
= 0;
710 struct winstation
*winsta
;
714 LIST_FOR_EACH_ENTRY( winsta
, &winstation_list
, struct winstation
, entry
)
716 unsigned int access
= WINSTA_ENUMERATE
;
717 if (req
->index
> index
++) continue;
718 if (!check_object_access( &winsta
->obj
, &access
)) continue;
721 if ((name
= get_object_name( &winsta
->obj
, &len
)))
722 set_reply_data( name
, min( len
, get_reply_max_size() ));
725 set_error( STATUS_NO_MORE_ENTRIES
);
729 /* enumerate desktops */
730 DECL_HANDLER(enum_desktop
)
732 struct winstation
*winstation
;
733 struct desktop
*desktop
;
734 unsigned int index
= 0;
738 if (!(winstation
= (struct winstation
*)get_handle_obj( current
->process
, req
->winstation
,
739 WINSTA_ENUMDESKTOPS
, &winstation_ops
)))
742 LIST_FOR_EACH_ENTRY( desktop
, &winstation
->desktops
, struct desktop
, entry
)
744 unsigned int access
= DESKTOP_ENUMERATE
;
745 if (req
->index
> index
++) continue;
746 if (!desktop
->obj
.name
) continue;
747 if (!check_object_access( &desktop
->obj
, &access
)) continue;
748 if ((name
= get_object_name( &desktop
->obj
, &len
)))
749 set_reply_data( name
, min( len
, get_reply_max_size() ));
750 release_object( winstation
);
756 release_object( winstation
);
757 set_error( STATUS_NO_MORE_ENTRIES
);