winmm/tests: Add some tests for MMIO_PARSE with long file names.
[wine.git] / server / directory.c
blobca9f978ff7fb03a7188e5fda72e2edbbf7b4ef12
1 /*
2 * Server-side directory object management
4 * Copyright (C) 2005 Vitaliy Margolen
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 "config.h"
23 #include "wine/port.h"
25 #include <assert.h>
26 #include <stdarg.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <sys/types.h>
31 #include "ntstatus.h"
32 #define WIN32_NO_STATUS
33 #include "winternl.h"
34 #include "ddk/wdm.h"
36 #include "handle.h"
37 #include "request.h"
38 #include "process.h"
39 #include "file.h"
40 #include "unicode.h"
42 #define HASH_SIZE 7 /* default hash size */
44 struct object_type
46 struct object obj; /* object header */
49 static void object_type_dump( struct object *obj, int verbose );
50 static struct object_type *object_type_get_type( struct object *obj );
52 static const struct object_ops object_type_ops =
54 sizeof(struct object_type), /* size */
55 object_type_dump, /* dump */
56 object_type_get_type, /* get_type */
57 no_add_queue, /* add_queue */
58 NULL, /* remove_queue */
59 NULL, /* signaled */
60 NULL, /* satisfied */
61 no_signal, /* signal */
62 no_get_fd, /* get_fd */
63 no_map_access, /* map_access */
64 default_get_sd, /* get_sd */
65 default_set_sd, /* set_sd */
66 default_get_full_name, /* get_full_name */
67 no_lookup_name, /* lookup_name */
68 directory_link_name, /* link_name */
69 default_unlink_name, /* unlink_name */
70 no_open_file, /* open_file */
71 no_kernel_obj_list, /* get_kernel_obj_list */
72 no_close_handle, /* close_handle */
73 no_destroy /* destroy */
77 struct directory
79 struct object obj; /* object header */
80 struct namespace *entries; /* directory's name space */
83 static void directory_dump( struct object *obj, int verbose );
84 static struct object_type *directory_get_type( struct object *obj );
85 static struct object *directory_lookup_name( struct object *obj, struct unicode_str *name,
86 unsigned int attr, struct object *root );
87 static void directory_destroy( struct object *obj );
89 static const struct object_ops directory_ops =
91 sizeof(struct directory), /* size */
92 directory_dump, /* dump */
93 directory_get_type, /* get_type */
94 no_add_queue, /* add_queue */
95 NULL, /* remove_queue */
96 NULL, /* signaled */
97 NULL, /* satisfied */
98 no_signal, /* signal */
99 no_get_fd, /* get_fd */
100 default_fd_map_access, /* map_access */
101 default_get_sd, /* get_sd */
102 default_set_sd, /* set_sd */
103 default_get_full_name, /* get_full_name */
104 directory_lookup_name, /* lookup_name */
105 directory_link_name, /* link_name */
106 default_unlink_name, /* unlink_name */
107 no_open_file, /* open_file */
108 no_kernel_obj_list, /* get_kernel_obj_list */
109 no_close_handle, /* close_handle */
110 directory_destroy /* destroy */
113 static struct directory *root_directory;
114 static struct directory *dir_objtype;
117 static void object_type_dump( struct object *obj, int verbose )
119 fputs( "Object type\n", stderr );
122 static struct object_type *object_type_get_type( struct object *obj )
124 static const WCHAR name[] = {'O','b','j','e','c','t','T','y','p','e'};
125 static const struct unicode_str str = { name, sizeof(name) };
126 return get_object_type( &str );
129 static void directory_dump( struct object *obj, int verbose )
131 fputs( "Directory\n", stderr );
134 static struct object_type *directory_get_type( struct object *obj )
136 static const WCHAR name[] = {'D','i','r','e','c','t','o','r','y'};
137 static const struct unicode_str str = { name, sizeof(name) };
138 return get_object_type( &str );
141 static struct object *directory_lookup_name( struct object *obj, struct unicode_str *name,
142 unsigned int attr, struct object *root )
144 struct directory *dir = (struct directory *)obj;
145 struct object *found;
146 struct unicode_str tmp;
148 assert( obj->ops == &directory_ops );
150 if (!name) return NULL; /* open the directory itself */
152 tmp.str = name->str;
153 tmp.len = get_path_element( name->str, name->len );
155 if ((found = find_object( dir->entries, &tmp, attr )))
157 /* Skip trailing \\ and move to the next element */
158 if (tmp.len < name->len)
160 tmp.len += sizeof(WCHAR);
161 name->str += tmp.len / sizeof(WCHAR);
162 name->len -= tmp.len;
164 else
166 name->str = NULL;
167 name->len = 0;
169 return found;
172 if (name->str) /* not the last element */
174 if (tmp.len == 0) /* Double backslash */
175 set_error( STATUS_OBJECT_NAME_INVALID );
176 else if (tmp.len < name->len) /* Path still has backslashes */
177 set_error( STATUS_OBJECT_PATH_NOT_FOUND );
179 return NULL;
182 int directory_link_name( struct object *obj, struct object_name *name, struct object *parent )
184 struct directory *dir = (struct directory *)parent;
186 if (parent->ops != &directory_ops)
188 set_error( STATUS_OBJECT_TYPE_MISMATCH );
189 return 0;
191 namespace_add( dir->entries, name );
192 name->parent = grab_object( parent );
193 return 1;
196 static void directory_destroy( struct object *obj )
198 struct directory *dir = (struct directory *)obj;
199 assert( obj->ops == &directory_ops );
200 free( dir->entries );
203 static struct directory *create_directory( struct object *root, const struct unicode_str *name,
204 unsigned int attr, unsigned int hash_size,
205 const struct security_descriptor *sd )
207 struct directory *dir;
209 if ((dir = create_named_object( root, &directory_ops, name, attr, sd )) &&
210 get_error() != STATUS_OBJECT_NAME_EXISTS)
212 if (!(dir->entries = create_namespace( hash_size )))
214 release_object( dir );
215 return NULL;
218 return dir;
221 struct object *get_root_directory(void)
223 return grab_object( root_directory );
226 /* return a directory object for creating/opening some object; no access rights are required */
227 struct object *get_directory_obj( struct process *process, obj_handle_t handle )
229 return get_handle_obj( process, handle, 0, &directory_ops );
232 /* retrieve an object type, creating it if needed */
233 struct object_type *get_object_type( const struct unicode_str *name )
235 struct object_type *type;
237 if ((type = create_named_object( &dir_objtype->obj, &object_type_ops, name,
238 OBJ_OPENIF | OBJ_PERMANENT, NULL )))
239 clear_error();
240 return type;
243 /* Global initialization */
245 static void create_session( unsigned int id )
247 /* directories */
248 static const WCHAR dir_sessionsW[] = {'S','e','s','s','i','o','n','s'};
249 static const WCHAR dir_bnolinksW[] = {'B','N','O','L','I','N','K','S'};
250 static const WCHAR dir_bnoW[] = {'B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s'};
251 static const WCHAR dir_dosdevicesW[] = {'D','o','s','D','e','v','i','c','e','s'};
252 static const WCHAR dir_windowsW[] = {'W','i','n','d','o','w','s'};
253 static const WCHAR dir_winstationsW[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n','s'};
254 static const struct unicode_str dir_sessions_str = {dir_sessionsW, sizeof(dir_sessionsW)};
255 static const struct unicode_str dir_bnolinks_str = {dir_bnolinksW, sizeof(dir_bnolinksW)};
256 static const struct unicode_str dir_bno_str = {dir_bnoW, sizeof(dir_bnoW)};
257 static const struct unicode_str dir_dosdevices_str = {dir_dosdevicesW, sizeof(dir_dosdevicesW)};
258 static const struct unicode_str dir_windows_str = {dir_windowsW, sizeof(dir_windowsW)};
259 static const struct unicode_str dir_winstations_str = {dir_winstationsW, sizeof(dir_winstationsW)};
261 /* symlinks */
262 static const WCHAR link_globalW[] = {'G','l','o','b','a','l'};
263 static const WCHAR link_localW[] = {'L','o','c','a','l'};
264 static const WCHAR link_sessionW[] = {'S','e','s','s','i','o','n'};
265 static const struct unicode_str link_global_str = {link_globalW, sizeof(link_globalW)};
266 static const struct unicode_str link_local_str = {link_localW, sizeof(link_localW)};
267 static const struct unicode_str link_session_str = {link_sessionW, sizeof(link_sessionW)};
269 static struct directory *dir_bno_global, *dir_sessions, *dir_bnolinks;
270 struct directory *dir_id, *dir_bno, *dir_dosdevices, *dir_windows, *dir_winstation;
271 struct object *link_global, *link_local, *link_session, *link_bno, *link_windows;
272 struct unicode_str id_str;
273 char id_strA[10];
274 WCHAR *id_strW;
276 if (!id)
278 dir_bno_global = create_directory( &root_directory->obj, &dir_bno_str, OBJ_PERMANENT, HASH_SIZE, NULL );
279 dir_sessions = create_directory( &root_directory->obj, &dir_sessions_str, OBJ_PERMANENT, HASH_SIZE, NULL );
280 dir_bnolinks = create_directory( &dir_sessions->obj, &dir_bnolinks_str, OBJ_PERMANENT, HASH_SIZE, NULL );
281 release_object( dir_bno_global );
282 release_object( dir_bnolinks );
283 release_object( dir_sessions );
286 sprintf( id_strA, "%u", id );
287 id_strW = ascii_to_unicode_str( id_strA, &id_str );
288 dir_id = create_directory( &dir_sessions->obj, &id_str, 0, HASH_SIZE, NULL );
289 dir_dosdevices = create_directory( &dir_id->obj, &dir_dosdevices_str, OBJ_PERMANENT, HASH_SIZE, NULL );
291 /* for session 0, directories are created under the root */
292 if (!id)
294 dir_bno = (struct directory *)grab_object( dir_bno_global );
295 dir_windows = create_directory( &root_directory->obj, &dir_windows_str, 0, HASH_SIZE, NULL );
296 link_bno = create_obj_symlink( &dir_id->obj, &dir_bno_str, OBJ_PERMANENT, &dir_bno->obj, NULL );
297 link_windows = create_obj_symlink( &dir_id->obj, &dir_windows_str, OBJ_PERMANENT, &dir_windows->obj, NULL );
298 release_object( link_bno );
299 release_object( link_windows );
301 else
303 /* use a larger hash table for this one since it can contain a lot of objects */
304 dir_bno = create_directory( &dir_id->obj, &dir_bno_str, 0, 37, NULL );
305 dir_windows = create_directory( &dir_id->obj, &dir_windows_str, 0, HASH_SIZE, NULL );
307 dir_winstation = create_directory( &dir_windows->obj, &dir_winstations_str, OBJ_PERMANENT, HASH_SIZE, NULL );
309 link_global = create_obj_symlink( &dir_bno->obj, &link_global_str, OBJ_PERMANENT, &dir_bno_global->obj, NULL );
310 link_local = create_obj_symlink( &dir_bno->obj, &link_local_str, OBJ_PERMANENT, &dir_bno->obj, NULL );
311 link_session = create_obj_symlink( &dir_bno->obj, &link_session_str, OBJ_PERMANENT, &dir_bnolinks->obj, NULL );
312 link_bno = create_obj_symlink( &dir_bnolinks->obj, &id_str, OBJ_PERMANENT, &dir_bno->obj, NULL );
313 release_object( link_global );
314 release_object( link_local );
315 release_object( link_session );
316 release_object( link_bno );
318 release_object( dir_dosdevices );
319 release_object( dir_winstation );
320 release_object( dir_windows );
321 release_object( dir_bno );
322 release_object( dir_id );
323 free( id_strW );
326 void init_directories( struct fd *intl_fd )
328 /* Directories */
329 static const WCHAR dir_globalW[] = {'?','?'};
330 static const WCHAR dir_driverW[] = {'D','r','i','v','e','r'};
331 static const WCHAR dir_deviceW[] = {'D','e','v','i','c','e'};
332 static const WCHAR dir_objtypeW[] = {'O','b','j','e','c','t','T','y','p','e','s'};
333 static const WCHAR dir_kernelW[] = {'K','e','r','n','e','l','O','b','j','e','c','t','s'};
334 static const WCHAR dir_nlsW[] = {'N','L','S'};
335 static const struct unicode_str dir_global_str = {dir_globalW, sizeof(dir_globalW)};
336 static const struct unicode_str dir_driver_str = {dir_driverW, sizeof(dir_driverW)};
337 static const struct unicode_str dir_device_str = {dir_deviceW, sizeof(dir_deviceW)};
338 static const struct unicode_str dir_objtype_str = {dir_objtypeW, sizeof(dir_objtypeW)};
339 static const struct unicode_str dir_kernel_str = {dir_kernelW, sizeof(dir_kernelW)};
340 static const struct unicode_str dir_nls_str = {dir_nlsW, sizeof(dir_nlsW)};
342 /* symlinks */
343 static const WCHAR link_dosdevW[] = {'D','o','s','D','e','v','i','c','e','s'};
344 static const WCHAR link_globalW[] = {'G','l','o','b','a','l'};
345 static const WCHAR link_nulW[] = {'N','U','L'};
346 static const WCHAR link_pipeW[] = {'P','I','P','E'};
347 static const WCHAR link_mailslotW[] = {'M','A','I','L','S','L','O','T'};
348 static const WCHAR link_coninW[] = {'C','O','N','I','N','$'};
349 static const WCHAR link_conoutW[] = {'C','O','N','O','U','T','$'};
350 static const WCHAR link_conW[] = {'C','O','N'};
351 static const WCHAR link_currentinW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v',
352 '\\','C','u','r','r','e','n','t','I','n'};
353 static const WCHAR link_currentoutW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v',
354 '\\','C','u','r','r','e','n','t','O','u','t'};
355 static const WCHAR link_consoleW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v',
356 '\\','C','o','n','s','o','l','e'};
357 static const struct unicode_str link_dosdev_str = {link_dosdevW, sizeof(link_dosdevW)};
358 static const struct unicode_str link_global_str = {link_globalW, sizeof(link_globalW)};
359 static const struct unicode_str link_nul_str = {link_nulW, sizeof(link_nulW)};
360 static const struct unicode_str link_pipe_str = {link_pipeW, sizeof(link_pipeW)};
361 static const struct unicode_str link_mailslot_str = {link_mailslotW, sizeof(link_mailslotW)};
362 static const struct unicode_str link_con_str = {link_conW, sizeof(link_conW)};
363 static const struct unicode_str link_conin_str = {link_coninW, sizeof(link_coninW)};
364 static const struct unicode_str link_conout_str = {link_conoutW, sizeof(link_conoutW)};
365 static const struct unicode_str link_currentin_str = {link_currentinW, sizeof(link_currentinW)};
366 static const struct unicode_str link_currentout_str = {link_currentoutW, sizeof(link_currentoutW)};
367 static const struct unicode_str link_console_str = {link_consoleW, sizeof(link_consoleW)};
369 /* devices */
370 static const WCHAR named_pipeW[] = {'N','a','m','e','d','P','i','p','e'};
371 static const WCHAR mailslotW[] = {'M','a','i','l','S','l','o','t'};
372 static const WCHAR condrvW[] = {'C','o','n','D','r','v'};
373 static const WCHAR nullW[] = {'N','u','l','l'};
374 static const WCHAR afdW[] = {'A','f','d'};
375 static const struct unicode_str named_pipe_str = {named_pipeW, sizeof(named_pipeW)};
376 static const struct unicode_str mailslot_str = {mailslotW, sizeof(mailslotW)};
377 static const struct unicode_str condrv_str = {condrvW, sizeof(condrvW)};
378 static const struct unicode_str null_str = {nullW, sizeof(nullW)};
379 static const struct unicode_str afd_str = {afdW, sizeof(afdW)};
381 /* events */
382 static const WCHAR event_low_memW[] = {'L','o','w','M','e','m','o','r','y','C','o','n','d','i','t','i','o','n'};
383 static const WCHAR event_low_pagedW[] = {'L','o','w','P','a','g','e','d','P','o','o','l','C','o','n','d','i','t','i','o','n'};
384 static const WCHAR event_low_nonpgW[] = {'L','o','w','N','o','n','P','a','g','e','d','P','o','o','l','C','o','n','d','i','t','i','o','n'};
385 static const WCHAR event_high_memW[] = {'H','i','g','h','M','e','m','o','r','y','C','o','n','d','i','t','i','o','n'};
386 static const WCHAR event_high_pagedW[] = {'H','i','g','h','P','a','g','e','d','P','o','o','l','C','o','n','d','i','t','i','o','n'};
387 static const WCHAR event_high_nonpgW[] = {'H','i','g','h','N','o','n','P','a','g','e','d','P','o','o','l','C','o','n','d','i','t','i','o','n'};
388 static const WCHAR keyed_event_crit_sectW[] = {'C','r','i','t','S','e','c','O','u','t','O','f','M','e','m','o','r','y','E','v','e','n','t'};
389 static const struct unicode_str kernel_events[] =
391 { event_low_memW, sizeof(event_low_memW) },
392 { event_low_pagedW, sizeof(event_low_pagedW) },
393 { event_low_nonpgW, sizeof(event_low_nonpgW) },
394 { event_high_memW, sizeof(event_high_memW) },
395 { event_high_pagedW, sizeof(event_high_pagedW) },
396 { event_high_nonpgW, sizeof(event_high_nonpgW) }
398 static const struct unicode_str keyed_event_crit_sect_str = {keyed_event_crit_sectW, sizeof(keyed_event_crit_sectW)};
400 /* mappings */
401 static const WCHAR intlW[] = {'N','l','s','S','e','c','t','i','o','n','L','A','N','G','_','I','N','T','L'};
402 static const WCHAR user_dataW[] = {'_','_','w','i','n','e','_','u','s','e','r','_','s','h','a','r','e','d','_','d','a','t','a'};
403 static const struct unicode_str intl_str = {intlW, sizeof(intlW)};
404 static const struct unicode_str user_data_str = {user_dataW, sizeof(user_dataW)};
406 struct directory *dir_driver, *dir_device, *dir_global, *dir_kernel, *dir_nls;
407 struct object *named_pipe_device, *mailslot_device, *null_device;
408 unsigned int i;
410 root_directory = create_directory( NULL, NULL, OBJ_PERMANENT, HASH_SIZE, NULL );
411 dir_driver = create_directory( &root_directory->obj, &dir_driver_str, OBJ_PERMANENT, HASH_SIZE, NULL );
412 dir_device = create_directory( &root_directory->obj, &dir_device_str, OBJ_PERMANENT, HASH_SIZE, NULL );
413 dir_objtype = create_directory( &root_directory->obj, &dir_objtype_str, OBJ_PERMANENT, HASH_SIZE, NULL );
414 dir_kernel = create_directory( &root_directory->obj, &dir_kernel_str, OBJ_PERMANENT, HASH_SIZE, NULL );
415 dir_global = create_directory( &root_directory->obj, &dir_global_str, OBJ_PERMANENT, HASH_SIZE, NULL );
416 dir_nls = create_directory( &root_directory->obj, &dir_nls_str, OBJ_PERMANENT, HASH_SIZE, NULL );
418 /* devices */
419 named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str, OBJ_PERMANENT, NULL );
420 mailslot_device = create_mailslot_device( &dir_device->obj, &mailslot_str, OBJ_PERMANENT, NULL );
421 null_device = create_unix_device( &dir_device->obj, &null_str, OBJ_PERMANENT, NULL, "/dev/null" );
422 release_object( create_console_device( &dir_device->obj, &condrv_str, OBJ_PERMANENT, NULL ));
423 release_object( create_socket_device( &dir_device->obj, &afd_str, OBJ_PERMANENT, NULL ));
425 /* sessions */
426 create_session( 0 );
427 create_session( 1 );
429 /* symlinks */
430 release_object( create_obj_symlink( &root_directory->obj, &link_dosdev_str, OBJ_PERMANENT, &dir_global->obj, NULL ));
431 release_object( create_obj_symlink( &dir_global->obj, &link_global_str, OBJ_PERMANENT, &dir_global->obj, NULL ));
432 release_object( create_obj_symlink( &dir_global->obj, &link_nul_str, OBJ_PERMANENT, null_device, NULL ));
433 release_object( create_obj_symlink( &dir_global->obj, &link_pipe_str, OBJ_PERMANENT, named_pipe_device, NULL ));
434 release_object( create_obj_symlink( &dir_global->obj, &link_mailslot_str, OBJ_PERMANENT, mailslot_device, NULL ));
435 release_object( create_symlink( &dir_global->obj, &link_conin_str, OBJ_PERMANENT, &link_currentin_str, NULL ));
436 release_object( create_symlink( &dir_global->obj, &link_conout_str, OBJ_PERMANENT, &link_currentout_str, NULL ));
437 release_object( create_symlink( &dir_global->obj, &link_con_str, OBJ_PERMANENT, &link_console_str, NULL ));
439 /* events */
440 for (i = 0; i < ARRAY_SIZE( kernel_events ); i++)
441 release_object( create_event( &dir_kernel->obj, &kernel_events[i], OBJ_PERMANENT, 1, 0, NULL ));
442 release_object( create_keyed_event( &dir_kernel->obj, &keyed_event_crit_sect_str, OBJ_PERMANENT, NULL ));
444 /* mappings */
445 release_object( create_fd_mapping( &dir_nls->obj, &intl_str, intl_fd, OBJ_PERMANENT, NULL ));
446 release_object( create_user_data_mapping( &dir_kernel->obj, &user_data_str, OBJ_PERMANENT, NULL ));
447 release_object( intl_fd );
449 release_object( named_pipe_device );
450 release_object( mailslot_device );
451 release_object( null_device );
452 release_object( root_directory );
453 release_object( dir_driver );
454 release_object( dir_device );
455 release_object( dir_objtype );
456 release_object( dir_kernel );
457 release_object( dir_nls );
458 release_object( dir_global );
461 /* create a directory object */
462 DECL_HANDLER(create_directory)
464 struct unicode_str name;
465 struct object *root;
466 struct directory *dir;
467 const struct security_descriptor *sd;
468 const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
470 if (!objattr) return;
472 if ((dir = create_directory( root, &name, objattr->attributes, HASH_SIZE, sd )))
474 reply->handle = alloc_handle( current->process, dir, req->access, objattr->attributes );
475 release_object( dir );
478 if (root) release_object( root );
481 /* open a directory object */
482 DECL_HANDLER(open_directory)
484 struct unicode_str name = get_req_unicode_str();
486 reply->handle = open_object( current->process, req->rootdir, req->access,
487 &directory_ops, &name, req->attributes );
490 /* get a directory entry by index */
491 DECL_HANDLER(get_directory_entry)
493 struct directory *dir = (struct directory *)get_handle_obj( current->process, req->handle,
494 DIRECTORY_QUERY, &directory_ops );
495 if (dir)
497 struct object *obj = find_object_index( dir->entries, req->index );
498 if (obj)
500 data_size_t name_len, type_len = 0;
501 const WCHAR *type_name = NULL;
502 const WCHAR *name = get_object_name( obj, &name_len );
503 struct object_type *type = obj->ops->get_type( obj );
505 if (type) type_name = get_object_name( &type->obj, &type_len );
507 if (name_len + type_len <= get_reply_max_size())
509 void *ptr = set_reply_data_size( name_len + type_len );
510 if (ptr)
512 reply->name_len = name_len;
513 memcpy( ptr, name, name_len );
514 memcpy( (char *)ptr + name_len, type_name, type_len );
517 else set_error( STATUS_BUFFER_OVERFLOW );
519 if (type) release_object( type );
520 release_object( obj );
522 release_object( dir );
526 /* query object type name information */
527 DECL_HANDLER(get_object_type)
529 struct object *obj;
530 struct object_type *type;
531 const WCHAR *name;
533 if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
535 if ((type = obj->ops->get_type( obj )))
537 if ((name = get_object_name( &type->obj, &reply->total )))
538 set_reply_data( name, min( reply->total, get_reply_max_size() ) );
539 release_object( type );
541 release_object( obj );