Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Server-side atom management |
| 3 | * |
| 4 | * Copyright (C) 1999, 2000 Alexandre Julliard |
| 5 | * Copyright (C) 2000 Turchanov Sergei |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
Alexandre Julliard | 5769d1d | 2002-04-26 19:05:15 +0000 | [diff] [blame] | 22 | #include "config.h" |
| 23 | #include "wine/port.h" |
| 24 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 25 | #include <assert.h> |
| 26 | #include <stdlib.h> |
| 27 | #include <stdio.h> |
Jeff Garzik | f46eb1d | 2001-03-21 20:30:46 +0000 | [diff] [blame] | 28 | #include <string.h> |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 29 | |
| 30 | #include "unicode.h" |
| 31 | #include "request.h" |
| 32 | #include "object.h" |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 33 | #include "process.h" |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 34 | |
| 35 | #define HASH_SIZE 37 |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 36 | #define MIN_HASH_SIZE 4 |
| 37 | #define MAX_HASH_SIZE 0x200 |
| 38 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 39 | #define MAX_ATOM_LEN 255 |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 40 | #define MIN_STR_ATOM 0xc000 |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 41 | #define MAX_ATOMS 0x4000 |
| 42 | |
| 43 | struct atom_entry |
| 44 | { |
| 45 | struct atom_entry *next; /* hash table list */ |
| 46 | struct atom_entry *prev; /* hash table list */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 47 | int count; /* reference count */ |
| 48 | int hash; /* string hash */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 49 | atom_t atom; /* atom handle */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 50 | WCHAR str[1]; /* atom string */ |
| 51 | }; |
| 52 | |
| 53 | struct atom_table |
| 54 | { |
| 55 | struct object obj; /* object header */ |
| 56 | int count; /* count of atom handles */ |
| 57 | int last; /* last handle in-use */ |
| 58 | struct atom_entry **handles; /* atom handles */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 59 | int entries_count; /* humber of hash entries */ |
| 60 | struct atom_entry **entries; /* hash table entries */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 63 | static void atom_table_dump( struct object *obj, int verbose ); |
| 64 | static void atom_table_destroy( struct object *obj ); |
| 65 | |
| 66 | static const struct object_ops atom_table_ops = |
| 67 | { |
| 68 | sizeof(struct atom_table), /* size */ |
| 69 | atom_table_dump, /* dump */ |
| 70 | no_add_queue, /* add_queue */ |
| 71 | NULL, /* remove_queue */ |
| 72 | NULL, /* signaled */ |
| 73 | NULL, /* satified */ |
Alexandre Julliard | 1ab243b | 2000-12-19 02:12:45 +0000 | [diff] [blame] | 74 | no_get_fd, /* get_fd */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 75 | atom_table_destroy /* destroy */ |
| 76 | }; |
| 77 | |
| 78 | static struct atom_table *global_table; |
| 79 | |
| 80 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 81 | /* copy an atom name from the request to a temporary area */ |
| 82 | static const WCHAR *copy_request_name(void) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 83 | { |
| 84 | static WCHAR buffer[MAX_ATOM_LEN+1]; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 85 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 86 | const WCHAR *str = get_req_data(); |
| 87 | size_t len = get_req_data_size(); |
| 88 | |
Alexandre Julliard | 9c2370b | 2000-08-30 00:00:48 +0000 | [diff] [blame] | 89 | if (len > MAX_ATOM_LEN*sizeof(WCHAR)) |
| 90 | { |
| 91 | set_error( STATUS_INVALID_PARAMETER ); |
| 92 | return NULL; |
| 93 | } |
| 94 | memcpy( buffer, str, len ); |
| 95 | buffer[len / sizeof(WCHAR)] = 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 96 | return buffer; |
| 97 | } |
| 98 | |
| 99 | /* create an atom table */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 100 | static struct atom_table *create_table(int entries_count) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 101 | { |
| 102 | struct atom_table *table; |
| 103 | |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 104 | if ((table = alloc_object( &atom_table_ops ))) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 105 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 106 | if ((entries_count < MIN_HASH_SIZE) || |
| 107 | (entries_count > MAX_HASH_SIZE)) entries_count = HASH_SIZE; |
| 108 | table->entries_count = entries_count; |
| 109 | if (!(table->entries = malloc( sizeof(*table->entries) * table->entries_count ))) |
| 110 | { |
| 111 | set_error( STATUS_NO_MEMORY ); |
| 112 | goto fail; |
| 113 | } |
| 114 | memset( table->entries, 0, sizeof(*table->entries) * table->entries_count ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 115 | table->count = 64; |
| 116 | table->last = -1; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 117 | if ((table->handles = mem_alloc( sizeof(*table->handles) * table->count ))) |
| 118 | return table; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 119 | fail: |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 120 | release_object( table ); |
| 121 | table = NULL; |
| 122 | } |
| 123 | return table; |
| 124 | } |
| 125 | |
| 126 | /* retrieve an entry pointer from its atom */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 127 | static struct atom_entry *get_atom_entry( struct atom_table *table, atom_t atom ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 128 | { |
| 129 | struct atom_entry *entry = NULL; |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 130 | if (table && (atom >= MIN_STR_ATOM) && (atom <= MIN_STR_ATOM + table->last)) |
| 131 | entry = table->handles[atom - MIN_STR_ATOM]; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 132 | if (!entry) set_error( STATUS_INVALID_HANDLE ); |
| 133 | return entry; |
| 134 | } |
| 135 | |
| 136 | /* add an atom entry in the table and return its handle */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 137 | static atom_t add_atom_entry( struct atom_table *table, struct atom_entry *entry ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 138 | { |
| 139 | int i; |
| 140 | for (i = 0; i <= table->last; i++) |
| 141 | if (!table->handles[i]) goto found; |
| 142 | if (i == table->count) |
| 143 | { |
| 144 | struct atom_entry **new_table = NULL; |
| 145 | int new_size = table->count + table->count / 2; |
| 146 | if (new_size > MAX_ATOMS) new_size = MAX_ATOMS; |
| 147 | if (new_size > table->count) |
| 148 | new_table = realloc( table->handles, sizeof(*table->handles) * new_size ); |
| 149 | if (!new_table) |
| 150 | { |
| 151 | set_error( STATUS_NO_MEMORY ); |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 152 | return 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 153 | } |
| 154 | table->count = new_size; |
| 155 | table->handles = new_table; |
| 156 | } |
| 157 | table->last = i; |
| 158 | found: |
| 159 | table->handles[i] = entry; |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 160 | entry->atom = i + MIN_STR_ATOM; |
| 161 | return entry->atom; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | /* compute the hash code for a string */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 165 | static int atom_hash( struct atom_table *table, const WCHAR *str ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 166 | { |
| 167 | int i; |
| 168 | WCHAR hash = 0; |
Alexandre Julliard | 7e495e1 | 2000-07-25 21:01:59 +0000 | [diff] [blame] | 169 | for (i = 0; str[i]; i++) hash ^= toupperW(str[i]) + i; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 170 | return hash % table->entries_count; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /* dump an atom table */ |
| 174 | static void atom_table_dump( struct object *obj, int verbose ) |
| 175 | { |
| 176 | int i; |
| 177 | struct atom_table *table = (struct atom_table *)obj; |
| 178 | assert( obj->ops == &atom_table_ops ); |
| 179 | |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 180 | fprintf( stderr, "Atom table size=%d entries=%d\n", |
| 181 | table->last + 1, table->entries_count ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 182 | if (!verbose) return; |
| 183 | for (i = 0; i <= table->last; i++) |
| 184 | { |
| 185 | struct atom_entry *entry = table->handles[i]; |
| 186 | if (!entry) continue; |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 187 | fprintf( stderr, " %04x: ref=%d hash=%d \"", entry->atom, entry->count, entry->hash ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 188 | dump_strW( entry->str, strlenW(entry->str), stderr, "\"\""); |
| 189 | fprintf( stderr, "\"\n" ); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /* destroy the atom table */ |
| 194 | static void atom_table_destroy( struct object *obj ) |
| 195 | { |
| 196 | int i; |
| 197 | struct atom_table *table = (struct atom_table *)obj; |
| 198 | assert( obj->ops == &atom_table_ops ); |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 199 | if (table->handles) |
| 200 | { |
| 201 | for (i = 0; i <= table->last; i++) free( table->handles[i] ); |
| 202 | free( table->handles ); |
| 203 | } |
| 204 | if (table->entries) free( table->entries ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | /* find an atom entry in its hash list */ |
| 208 | static struct atom_entry *find_atom_entry( struct atom_table *table, const WCHAR *str, int hash ) |
| 209 | { |
| 210 | struct atom_entry *entry = table->entries[hash]; |
| 211 | while (entry) |
| 212 | { |
| 213 | if (!strcmpiW( entry->str, str )) break; |
| 214 | entry = entry->next; |
| 215 | } |
| 216 | return entry; |
| 217 | } |
| 218 | |
| 219 | /* close the atom table; used on server exit */ |
| 220 | void close_atom_table(void) |
| 221 | { |
| 222 | if (global_table) release_object( global_table ); |
| 223 | } |
| 224 | |
| 225 | /* add an atom to the table */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 226 | static atom_t add_atom( struct atom_table *table, const WCHAR *str ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 227 | { |
| 228 | struct atom_entry *entry; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 229 | int hash = atom_hash( table, str ); |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 230 | atom_t atom = 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 231 | |
| 232 | if (!*str) |
| 233 | { |
| 234 | set_error( STATUS_OBJECT_NAME_INVALID ); |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 235 | return 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 236 | } |
| 237 | if ((entry = find_atom_entry( table, str, hash ))) /* exists already */ |
| 238 | { |
| 239 | entry->count++; |
| 240 | return entry->atom; |
| 241 | } |
| 242 | |
| 243 | if ((entry = mem_alloc( sizeof(*entry) + strlenW(str) * sizeof(WCHAR) ))) |
| 244 | { |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 245 | if ((atom = add_atom_entry( table, entry ))) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 246 | { |
| 247 | entry->prev = NULL; |
| 248 | if ((entry->next = table->entries[hash])) entry->next->prev = entry; |
| 249 | table->entries[hash] = entry; |
| 250 | entry->count = 1; |
| 251 | entry->hash = hash; |
| 252 | strcpyW( entry->str, str ); |
| 253 | } |
| 254 | else free( entry ); |
| 255 | } |
| 256 | else set_error( STATUS_NO_MEMORY ); |
| 257 | return atom; |
| 258 | } |
| 259 | |
| 260 | /* delete an atom from the table */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 261 | static void delete_atom( struct atom_table *table, atom_t atom ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 262 | { |
| 263 | struct atom_entry *entry = get_atom_entry( table, atom ); |
| 264 | if (entry && !--entry->count) |
| 265 | { |
| 266 | if (entry->next) entry->next->prev = entry->prev; |
| 267 | if (entry->prev) entry->prev->next = entry->next; |
| 268 | else table->entries[entry->hash] = entry->next; |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 269 | table->handles[atom - MIN_STR_ATOM] = NULL; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 270 | free( entry ); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | /* find an atom in the table */ |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 275 | static atom_t find_atom( struct atom_table *table, const WCHAR *str ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 276 | { |
| 277 | struct atom_entry *entry; |
| 278 | |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 279 | if (table && ((entry = find_atom_entry( table, str, atom_hash(table, str) )))) |
| 280 | return entry->atom; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 281 | if (!*str) set_error( STATUS_OBJECT_NAME_INVALID ); |
| 282 | else set_error( STATUS_OBJECT_NAME_NOT_FOUND ); |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 283 | return 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 286 | /* increment the ref count of a global atom; used for window properties */ |
| 287 | int grab_global_atom( atom_t atom ) |
| 288 | { |
Rein Klazes | 7e105b4 | 2002-01-31 23:34:18 +0000 | [diff] [blame] | 289 | if (atom >= MIN_STR_ATOM) |
| 290 | { |
| 291 | struct atom_entry *entry = get_atom_entry( global_table, atom ); |
| 292 | if (entry) entry->count++; |
| 293 | return (entry != NULL); |
| 294 | } |
| 295 | else return 1; |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | /* decrement the ref count of a global atom; used for window properties */ |
| 299 | void release_global_atom( atom_t atom ) |
| 300 | { |
Rein Klazes | 7e105b4 | 2002-01-31 23:34:18 +0000 | [diff] [blame] | 301 | if (atom >= MIN_STR_ATOM) delete_atom( global_table, atom ); |
Alexandre Julliard | d8a8c11 | 2001-10-12 18:45:29 +0000 | [diff] [blame] | 302 | } |
| 303 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 304 | /* add a global atom */ |
| 305 | DECL_HANDLER(add_atom) |
| 306 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 307 | struct atom_table **table_ptr = req->local ? ¤t->process->atom_table : &global_table; |
| 308 | |
| 309 | if (!*table_ptr) *table_ptr = create_table(0); |
Alexandre Julliard | 9c2370b | 2000-08-30 00:00:48 +0000 | [diff] [blame] | 310 | if (*table_ptr) |
| 311 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 312 | const WCHAR *name = copy_request_name(); |
| 313 | if (name) reply->atom = add_atom( *table_ptr, name ); |
Alexandre Julliard | 9c2370b | 2000-08-30 00:00:48 +0000 | [diff] [blame] | 314 | } |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | /* delete a global atom */ |
| 318 | DECL_HANDLER(delete_atom) |
| 319 | { |
Alexandre Julliard | 9c2370b | 2000-08-30 00:00:48 +0000 | [diff] [blame] | 320 | delete_atom( req->local ? current->process->atom_table : global_table, req->atom ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | /* find a global atom */ |
| 324 | DECL_HANDLER(find_atom) |
| 325 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 326 | const WCHAR *name = copy_request_name(); |
Alexandre Julliard | 9c2370b | 2000-08-30 00:00:48 +0000 | [diff] [blame] | 327 | if (name) |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 328 | reply->atom = find_atom( req->local ? current->process->atom_table : global_table, name ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | /* get global atom name */ |
| 332 | DECL_HANDLER(get_atom_name) |
| 333 | { |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 334 | struct atom_entry *entry; |
| 335 | size_t len = 0; |
| 336 | |
| 337 | reply->count = -1; |
| 338 | if ((entry = get_atom_entry( req->local ? current->process->atom_table : global_table, |
| 339 | req->atom ))) |
| 340 | { |
| 341 | reply->count = entry->count; |
| 342 | len = strlenW( entry->str ) * sizeof(WCHAR); |
| 343 | if (len <= get_reply_max_size()) set_reply_data( entry->str, len ); |
| 344 | else set_error( STATUS_BUFFER_OVERFLOW ); |
| 345 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | /* init the process atom table */ |
| 349 | DECL_HANDLER(init_atom_table) |
| 350 | { |
| 351 | if (!current->process->atom_table) |
| 352 | current->process->atom_table = create_table( req->entries ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 353 | } |