object.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. /*
  2. * Server-side objects
  3. *
  4. * Copyright (C) 1998 Alexandre Julliard
  5. *
  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.
  10. *
  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.
  15. *
  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
  19. */
  20. #include "config.h"
  21. #include <assert.h>
  22. #include <limits.h>
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include <unistd.h>
  27. #include <stdarg.h>
  28. #include <sys/types.h>
  29. #ifdef HAVE_VALGRIND_MEMCHECK_H
  30. #include <valgrind/memcheck.h>
  31. #endif
  32. #include "ntstatus.h"
  33. #define WIN32_NO_STATUS
  34. #include "winternl.h"
  35. #include "file.h"
  36. #include "process.h"
  37. #include "thread.h"
  38. #include "unicode.h"
  39. #include "security.h"
  40. struct namespace
  41. {
  42. unsigned int hash_size; /* size of hash table */
  43. struct list names[1]; /* array of hash entry lists */
  44. };
  45. struct type_descr no_type =
  46. {
  47. { NULL, 0 }, /* name */
  48. STANDARD_RIGHTS_REQUIRED, /* valid_access */
  49. { /* mapping */
  50. STANDARD_RIGHTS_READ,
  51. STANDARD_RIGHTS_WRITE,
  52. STANDARD_RIGHTS_EXECUTE,
  53. STANDARD_RIGHTS_REQUIRED
  54. },
  55. };
  56. #ifdef DEBUG_OBJECTS
  57. static struct list object_list = LIST_INIT(object_list);
  58. void dump_objects(void)
  59. {
  60. struct object *ptr;
  61. LIST_FOR_EACH_ENTRY( ptr, &object_list, struct object, obj_list )
  62. {
  63. fprintf( stderr, "%p:%d: ", ptr, ptr->refcount );
  64. dump_object_name( ptr );
  65. ptr->ops->dump( ptr, 1 );
  66. }
  67. }
  68. void close_objects(void)
  69. {
  70. /* release the permanent objects */
  71. for (;;)
  72. {
  73. struct object *obj;
  74. int found = 0;
  75. LIST_FOR_EACH_ENTRY( obj, &object_list, struct object, obj_list )
  76. {
  77. if (!(found = obj->is_permanent)) continue;
  78. obj->is_permanent = 0;
  79. release_object( obj );
  80. break;
  81. }
  82. if (!found) break;
  83. }
  84. dump_objects(); /* dump any remaining objects */
  85. }
  86. #endif /* DEBUG_OBJECTS */
  87. /*****************************************************************/
  88. /* mark a block of memory as uninitialized for debugging purposes */
  89. static inline void mark_block_uninitialized( void *ptr, size_t size )
  90. {
  91. memset( ptr, 0x55, size );
  92. #if defined(VALGRIND_MAKE_MEM_UNDEFINED)
  93. VALGRIND_DISCARD( VALGRIND_MAKE_MEM_UNDEFINED( ptr, size ));
  94. #elif defined(VALGRIND_MAKE_WRITABLE)
  95. VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size ));
  96. #endif
  97. }
  98. /* malloc replacement */
  99. void *mem_alloc( size_t size )
  100. {
  101. void *ptr = malloc( size );
  102. if (ptr) mark_block_uninitialized( ptr, size );
  103. else set_error( STATUS_NO_MEMORY );
  104. return ptr;
  105. }
  106. /* duplicate a block of memory */
  107. void *memdup( const void *data, size_t len )
  108. {
  109. void *ptr = malloc( len );
  110. if (ptr) memcpy( ptr, data, len );
  111. else set_error( STATUS_NO_MEMORY );
  112. return ptr;
  113. }
  114. /*****************************************************************/
  115. void namespace_add( struct namespace *namespace, struct object_name *ptr )
  116. {
  117. unsigned int hash = hash_strW( ptr->name, ptr->len, namespace->hash_size );
  118. list_add_head( &namespace->names[hash], &ptr->entry );
  119. }
  120. /* allocate a name for an object */
  121. static struct object_name *alloc_name( const struct unicode_str *name )
  122. {
  123. struct object_name *ptr;
  124. if ((ptr = mem_alloc( sizeof(*ptr) + name->len - sizeof(ptr->name) )))
  125. {
  126. ptr->len = name->len;
  127. ptr->parent = NULL;
  128. memcpy( ptr->name, name->str, name->len );
  129. }
  130. return ptr;
  131. }
  132. /* get the name of an existing object */
  133. const WCHAR *get_object_name( struct object *obj, data_size_t *len )
  134. {
  135. struct object_name *ptr = obj->name;
  136. if (!ptr) return NULL;
  137. *len = ptr->len;
  138. return ptr->name;
  139. }
  140. /* get the full path name of an existing object */
  141. WCHAR *default_get_full_name( struct object *obj, data_size_t *ret_len )
  142. {
  143. static const WCHAR backslash = '\\';
  144. struct object *ptr = obj;
  145. data_size_t len = 0;
  146. char *ret;
  147. while (ptr && ptr->name)
  148. {
  149. struct object_name *name = ptr->name;
  150. len += name->len + sizeof(WCHAR);
  151. ptr = name->parent;
  152. }
  153. if (!len) return NULL;
  154. if (!(ret = malloc( len ))) return NULL;
  155. *ret_len = len;
  156. while (obj && obj->name)
  157. {
  158. struct object_name *name = obj->name;
  159. memcpy( ret + len - name->len, name->name, name->len );
  160. len -= name->len + sizeof(WCHAR);
  161. memcpy( ret + len, &backslash, sizeof(WCHAR) );
  162. obj = name->parent;
  163. }
  164. return (WCHAR *)ret;
  165. }
  166. /* allocate and initialize an object */
  167. void *alloc_object( const struct object_ops *ops )
  168. {
  169. struct object *obj = mem_alloc( ops->size );
  170. if (obj)
  171. {
  172. obj->refcount = 1;
  173. obj->handle_count = 0;
  174. obj->is_permanent = 0;
  175. obj->ops = ops;
  176. obj->name = NULL;
  177. obj->sd = NULL;
  178. list_init( &obj->wait_queue );
  179. #ifdef DEBUG_OBJECTS
  180. list_add_head( &object_list, &obj->obj_list );
  181. #endif
  182. obj->ops->type->obj_count++;
  183. obj->ops->type->obj_max = max( obj->ops->type->obj_max, obj->ops->type->obj_count );
  184. return obj;
  185. }
  186. return NULL;
  187. }
  188. /* free an object once it has been destroyed */
  189. static void free_object( struct object *obj )
  190. {
  191. free( obj->sd );
  192. obj->ops->type->obj_count--;
  193. #ifdef DEBUG_OBJECTS
  194. list_remove( &obj->obj_list );
  195. memset( obj, 0xaa, obj->ops->size );
  196. #endif
  197. free( obj );
  198. }
  199. /* find an object by name starting from the specified root */
  200. /* if it doesn't exist, its parent is returned, and name_left contains the remaining name */
  201. struct object *lookup_named_object( struct object *root, const struct unicode_str *name,
  202. unsigned int attr, struct unicode_str *name_left )
  203. {
  204. struct object *obj, *parent;
  205. struct unicode_str name_tmp = *name, *ptr = &name_tmp;
  206. if (root)
  207. {
  208. /* if root is specified path shouldn't start with backslash */
  209. if (name_tmp.len && name_tmp.str[0] == '\\')
  210. {
  211. set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
  212. return NULL;
  213. }
  214. parent = grab_object( root );
  215. }
  216. else
  217. {
  218. if (!name_tmp.len || name_tmp.str[0] != '\\')
  219. {
  220. set_error( STATUS_OBJECT_PATH_SYNTAX_BAD );
  221. return NULL;
  222. }
  223. /* skip leading backslash */
  224. name_tmp.str++;
  225. name_tmp.len -= sizeof(WCHAR);
  226. parent = root = get_root_directory();
  227. }
  228. if (!name_tmp.len) ptr = NULL; /* special case for empty path */
  229. clear_error();
  230. while ((obj = parent->ops->lookup_name( parent, ptr, attr, root )))
  231. {
  232. /* move to the next element */
  233. release_object ( parent );
  234. parent = obj;
  235. }
  236. if (get_error())
  237. {
  238. release_object( parent );
  239. return NULL;
  240. }
  241. if (name_left) *name_left = name_tmp;
  242. return parent;
  243. }
  244. /* return length of first path element in name */
  245. data_size_t get_path_element( const WCHAR *name, data_size_t len )
  246. {
  247. data_size_t i;
  248. for (i = 0; i < len / sizeof(WCHAR); i++) if (name[i] == '\\') break;
  249. return i * sizeof(WCHAR);
  250. }
  251. static struct object *create_object( struct object *parent, const struct object_ops *ops,
  252. const struct unicode_str *name, unsigned int attributes,
  253. const struct security_descriptor *sd )
  254. {
  255. struct object *obj;
  256. struct object_name *name_ptr;
  257. if (!(name_ptr = alloc_name( name ))) return NULL;
  258. if (!(obj = alloc_object( ops ))) goto failed;
  259. if (sd && !default_set_sd( obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
  260. DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION ))
  261. goto failed;
  262. if (!obj->ops->link_name( obj, name_ptr, parent )) goto failed;
  263. name_ptr->obj = obj;
  264. obj->name = name_ptr;
  265. return obj;
  266. failed:
  267. if (obj) free_object( obj );
  268. free( name_ptr );
  269. return NULL;
  270. }
  271. /* create an object as named child under the specified parent */
  272. void *create_named_object( struct object *parent, const struct object_ops *ops,
  273. const struct unicode_str *name, unsigned int attributes,
  274. const struct security_descriptor *sd )
  275. {
  276. struct object *obj, *new_obj;
  277. struct unicode_str new_name;
  278. clear_error();
  279. if (!name || !name->len)
  280. {
  281. if (!(new_obj = alloc_object( ops ))) return NULL;
  282. if (sd && !default_set_sd( new_obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
  283. DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION ))
  284. {
  285. free_object( new_obj );
  286. return NULL;
  287. }
  288. goto done;
  289. }
  290. if (!(obj = lookup_named_object( parent, name, attributes, &new_name ))) return NULL;
  291. if (!new_name.len)
  292. {
  293. if (attributes & OBJ_OPENIF && obj->ops == ops)
  294. set_error( STATUS_OBJECT_NAME_EXISTS );
  295. else
  296. {
  297. release_object( obj );
  298. obj = NULL;
  299. if (attributes & OBJ_OPENIF)
  300. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  301. else
  302. set_error( STATUS_OBJECT_NAME_COLLISION );
  303. }
  304. return obj;
  305. }
  306. new_obj = create_object( obj, ops, &new_name, attributes, sd );
  307. release_object( obj );
  308. done:
  309. if (attributes & OBJ_PERMANENT)
  310. {
  311. make_object_permanent( new_obj );
  312. grab_object( new_obj );
  313. }
  314. return new_obj;
  315. }
  316. /* open a object by name under the specified parent */
  317. void *open_named_object( struct object *parent, const struct object_ops *ops,
  318. const struct unicode_str *name, unsigned int attributes )
  319. {
  320. struct unicode_str name_left;
  321. struct object *obj;
  322. if ((obj = lookup_named_object( parent, name, attributes, &name_left )))
  323. {
  324. if (name_left.len) /* not fully parsed */
  325. set_error( STATUS_OBJECT_NAME_NOT_FOUND );
  326. else if (ops && obj->ops != ops)
  327. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  328. else
  329. return obj;
  330. release_object( obj );
  331. }
  332. return NULL;
  333. }
  334. /* recursive helper for dump_object_name */
  335. static void dump_name( struct object *obj )
  336. {
  337. struct object_name *name = obj->name;
  338. if (!name) return;
  339. if (name->parent) dump_name( name->parent );
  340. fputs( "\\\\", stderr );
  341. dump_strW( name->name, name->len, stderr, "[]" );
  342. }
  343. /* dump the name of an object to stderr */
  344. void dump_object_name( struct object *obj )
  345. {
  346. if (!obj->name) return;
  347. fputc( '[', stderr );
  348. dump_name( obj );
  349. fputs( "] ", stderr );
  350. }
  351. /* unlink a named object from its namespace, without freeing the object itself */
  352. void unlink_named_object( struct object *obj )
  353. {
  354. struct object_name *name_ptr = obj->name;
  355. if (!name_ptr) return;
  356. obj->name = NULL;
  357. obj->ops->unlink_name( obj, name_ptr );
  358. if (name_ptr->parent) release_object( name_ptr->parent );
  359. free( name_ptr );
  360. }
  361. /* grab an object (i.e. increment its refcount) and return the object */
  362. struct object *grab_object( void *ptr )
  363. {
  364. struct object *obj = (struct object *)ptr;
  365. assert( obj->refcount < INT_MAX );
  366. obj->refcount++;
  367. return obj;
  368. }
  369. /* release an object (i.e. decrement its refcount) */
  370. void release_object( void *ptr )
  371. {
  372. struct object *obj = (struct object *)ptr;
  373. assert( obj->refcount );
  374. if (!--obj->refcount)
  375. {
  376. assert( !obj->handle_count );
  377. /* if the refcount is 0, nobody can be in the wait queue */
  378. assert( list_empty( &obj->wait_queue ));
  379. free_kernel_objects( obj );
  380. unlink_named_object( obj );
  381. obj->ops->destroy( obj );
  382. free_object( obj );
  383. }
  384. }
  385. /* find an object by its name; the refcount is incremented */
  386. struct object *find_object( const struct namespace *namespace, const struct unicode_str *name,
  387. unsigned int attributes )
  388. {
  389. const struct list *list;
  390. struct list *p;
  391. if (!name || !name->len) return NULL;
  392. list = &namespace->names[ hash_strW( name->str, name->len, namespace->hash_size ) ];
  393. LIST_FOR_EACH( p, list )
  394. {
  395. const struct object_name *ptr = LIST_ENTRY( p, struct object_name, entry );
  396. if (ptr->len != name->len) continue;
  397. if (attributes & OBJ_CASE_INSENSITIVE)
  398. {
  399. if (!memicmp_strW( ptr->name, name->str, name->len ))
  400. return grab_object( ptr->obj );
  401. }
  402. else
  403. {
  404. if (!memcmp( ptr->name, name->str, name->len ))
  405. return grab_object( ptr->obj );
  406. }
  407. }
  408. return NULL;
  409. }
  410. /* find an object by its index; the refcount is incremented */
  411. struct object *find_object_index( const struct namespace *namespace, unsigned int index )
  412. {
  413. unsigned int i;
  414. /* FIXME: not efficient at all */
  415. for (i = 0; i < namespace->hash_size; i++)
  416. {
  417. const struct object_name *ptr;
  418. LIST_FOR_EACH_ENTRY( ptr, &namespace->names[i], const struct object_name, entry )
  419. {
  420. if (!index--) return grab_object( ptr->obj );
  421. }
  422. }
  423. return NULL;
  424. }
  425. /* allocate a namespace */
  426. struct namespace *create_namespace( unsigned int hash_size )
  427. {
  428. struct namespace *namespace;
  429. unsigned int i;
  430. namespace = mem_alloc( sizeof(*namespace) + (hash_size - 1) * sizeof(namespace->names[0]) );
  431. if (namespace)
  432. {
  433. namespace->hash_size = hash_size;
  434. for (i = 0; i < hash_size; i++) list_init( &namespace->names[i] );
  435. }
  436. return namespace;
  437. }
  438. /* functions for unimplemented/default object operations */
  439. int no_add_queue( struct object *obj, struct wait_queue_entry *entry )
  440. {
  441. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  442. return 0;
  443. }
  444. void no_satisfied( struct object *obj, struct wait_queue_entry *entry )
  445. {
  446. }
  447. int no_signal( struct object *obj, unsigned int access )
  448. {
  449. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  450. return 0;
  451. }
  452. struct fd *no_get_fd( struct object *obj )
  453. {
  454. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  455. return NULL;
  456. }
  457. unsigned int default_map_access( struct object *obj, unsigned int access )
  458. {
  459. return map_access( access, &obj->ops->type->mapping );
  460. }
  461. struct security_descriptor *default_get_sd( struct object *obj )
  462. {
  463. return obj->sd;
  464. }
  465. int set_sd_defaults_from_token( struct object *obj, const struct security_descriptor *sd,
  466. unsigned int set_info, struct token *token )
  467. {
  468. struct security_descriptor new_sd, *new_sd_ptr;
  469. int present;
  470. const struct sid *owner = NULL, *group = NULL;
  471. const struct acl *sacl, *dacl;
  472. struct acl *replaced_sacl = NULL;
  473. char *ptr;
  474. if (!set_info) return 1;
  475. new_sd.control = sd->control & ~SE_SELF_RELATIVE;
  476. if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len)
  477. {
  478. owner = sd_get_owner( sd );
  479. new_sd.owner_len = sd->owner_len;
  480. }
  481. else if (obj->sd && obj->sd->owner_len)
  482. {
  483. owner = sd_get_owner( obj->sd );
  484. new_sd.owner_len = obj->sd->owner_len;
  485. }
  486. else if (token)
  487. {
  488. owner = token_get_user( token );
  489. new_sd.owner_len = sid_len( owner );
  490. }
  491. else new_sd.owner_len = 0;
  492. if (set_info & GROUP_SECURITY_INFORMATION && sd->group_len)
  493. {
  494. group = sd_get_group( sd );
  495. new_sd.group_len = sd->group_len;
  496. }
  497. else if (obj->sd && obj->sd->group_len)
  498. {
  499. group = sd_get_group( obj->sd );
  500. new_sd.group_len = obj->sd->group_len;
  501. }
  502. else if (token)
  503. {
  504. group = token_get_primary_group( token );
  505. new_sd.group_len = sid_len( group );
  506. }
  507. else new_sd.group_len = 0;
  508. sacl = sd_get_sacl( sd, &present );
  509. if (set_info & SACL_SECURITY_INFORMATION && present)
  510. {
  511. new_sd.control |= SE_SACL_PRESENT;
  512. new_sd.sacl_len = sd->sacl_len;
  513. }
  514. else if (set_info & LABEL_SECURITY_INFORMATION && present)
  515. {
  516. const struct acl *old_sacl = NULL;
  517. if (obj->sd && obj->sd->control & SE_SACL_PRESENT) old_sacl = sd_get_sacl( obj->sd, &present );
  518. if (!(replaced_sacl = replace_security_labels( old_sacl, sacl ))) return 0;
  519. new_sd.control |= SE_SACL_PRESENT;
  520. new_sd.sacl_len = replaced_sacl->size;
  521. sacl = replaced_sacl;
  522. }
  523. else
  524. {
  525. if (obj->sd) sacl = sd_get_sacl( obj->sd, &present );
  526. if (obj->sd && present)
  527. {
  528. new_sd.control |= SE_SACL_PRESENT;
  529. new_sd.sacl_len = obj->sd->sacl_len;
  530. }
  531. else
  532. new_sd.sacl_len = 0;
  533. }
  534. dacl = sd_get_dacl( sd, &present );
  535. if (set_info & DACL_SECURITY_INFORMATION && present)
  536. {
  537. new_sd.control |= SE_DACL_PRESENT;
  538. new_sd.dacl_len = sd->dacl_len;
  539. }
  540. else
  541. {
  542. if (obj->sd) dacl = sd_get_dacl( obj->sd, &present );
  543. if (obj->sd && present)
  544. {
  545. new_sd.control |= SE_DACL_PRESENT;
  546. new_sd.dacl_len = obj->sd->dacl_len;
  547. }
  548. else if (token)
  549. {
  550. dacl = token_get_default_dacl( token );
  551. new_sd.control |= SE_DACL_PRESENT;
  552. new_sd.dacl_len = dacl->size;
  553. }
  554. else new_sd.dacl_len = 0;
  555. }
  556. ptr = mem_alloc( sizeof(new_sd) + new_sd.owner_len + new_sd.group_len +
  557. new_sd.sacl_len + new_sd.dacl_len );
  558. if (!ptr)
  559. {
  560. free( replaced_sacl );
  561. return 0;
  562. }
  563. new_sd_ptr = (struct security_descriptor*)ptr;
  564. memcpy( ptr, &new_sd, sizeof(new_sd) );
  565. ptr += sizeof(new_sd);
  566. memcpy( ptr, owner, new_sd.owner_len );
  567. ptr += new_sd.owner_len;
  568. memcpy( ptr, group, new_sd.group_len );
  569. ptr += new_sd.group_len;
  570. memcpy( ptr, sacl, new_sd.sacl_len );
  571. ptr += new_sd.sacl_len;
  572. memcpy( ptr, dacl, new_sd.dacl_len );
  573. free( replaced_sacl );
  574. free( obj->sd );
  575. obj->sd = new_sd_ptr;
  576. return 1;
  577. }
  578. /** Set the security descriptor using the current primary token for defaults. */
  579. int default_set_sd( struct object *obj, const struct security_descriptor *sd,
  580. unsigned int set_info )
  581. {
  582. return set_sd_defaults_from_token( obj, sd, set_info, current->process->token );
  583. }
  584. WCHAR *no_get_full_name( struct object *obj, data_size_t *ret_len )
  585. {
  586. return NULL;
  587. }
  588. struct object *no_lookup_name( struct object *obj, struct unicode_str *name,
  589. unsigned int attr, struct object *root )
  590. {
  591. if (!name) set_error( STATUS_OBJECT_TYPE_MISMATCH );
  592. return NULL;
  593. }
  594. int no_link_name( struct object *obj, struct object_name *name, struct object *parent )
  595. {
  596. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  597. return 0;
  598. }
  599. void default_unlink_name( struct object *obj, struct object_name *name )
  600. {
  601. list_remove( &name->entry );
  602. }
  603. struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
  604. unsigned int options )
  605. {
  606. set_error( STATUS_OBJECT_TYPE_MISMATCH );
  607. return NULL;
  608. }
  609. int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
  610. {
  611. return 1; /* ok to close */
  612. }
  613. void no_destroy( struct object *obj )
  614. {
  615. }