Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Atom table functions |
| 3 | * |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 4 | * Copyright 1993, 1994, 1995 Alexandre Julliard |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /* |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 8 | * Warning: The code assumes that LocalAlloc() returns a block aligned |
| 9 | * on a 4-bytes boundary (because of the shifting done in |
| 10 | * HANDLETOATOM). If this is not the case, the allocation code will |
| 11 | * have to be changed. |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <stdlib.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 15 | #include <stdio.h> |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 16 | #include <string.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 17 | #include <ctype.h> |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 18 | |
Jeremy White | d3e22d9 | 2000-02-10 19:03:02 +0000 | [diff] [blame] | 19 | #include "windef.h" |
| 20 | #include "wingdi.h" |
| 21 | #include "winuser.h" |
Patrik Stridvall | fdcfdb9 | 1999-06-12 14:55:11 +0000 | [diff] [blame] | 22 | #include "wine/winbase16.h" |
| 23 | #include "wine/winuser16.h" |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 24 | #include "winerror.h" |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 25 | #include "instance.h" |
| 26 | #include "ldt.h" |
| 27 | #include "stackframe.h" |
| 28 | #include "user.h" |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 29 | #include "debugtools.h" |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 30 | #include "server.h" |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 31 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 32 | DEFAULT_DEBUG_CHANNEL(atom); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 33 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 34 | #define DEFAULT_ATOMTABLE_SIZE 37 |
| 35 | #define MIN_STR_ATOM 0xc000 |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 36 | #define MAX_ATOM_LEN 255 |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 37 | |
Alexandre Julliard | 8bbf818 | 1996-09-13 16:50:47 +0000 | [diff] [blame] | 38 | #define ATOMTOHANDLE(atom) ((HANDLE16)(atom) << 2) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 39 | #define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2))) |
| 40 | |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 41 | typedef struct |
| 42 | { |
| 43 | HANDLE16 next; |
| 44 | WORD refCount; |
| 45 | BYTE length; |
| 46 | BYTE str[1]; |
| 47 | } ATOMENTRY; |
| 48 | |
| 49 | typedef struct |
| 50 | { |
| 51 | WORD size; |
| 52 | HANDLE16 entries[1]; |
| 53 | } ATOMTABLE; |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 55 | static WORD ATOM_UserDS = 0; /* USER data segment */ |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 56 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 57 | /*********************************************************************** |
| 58 | * ATOM_Init |
| 59 | * |
| 60 | * Global table initialisation. |
| 61 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 62 | BOOL ATOM_Init( WORD globalTableSel ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 63 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 64 | ATOM_UserDS = globalTableSel; |
| 65 | return TRUE; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | |
| 69 | /*********************************************************************** |
| 70 | * ATOM_GetTable |
| 71 | * |
| 72 | * Return a pointer to the atom table of a given segment, creating |
| 73 | * it if necessary. |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 74 | * |
| 75 | * RETURNS |
| 76 | * Pointer to table: Success |
| 77 | * NULL: Failure |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 78 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 79 | static ATOMTABLE *ATOM_GetTable( BOOL create /* [in] Create */ ) |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 80 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 81 | INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ); |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 82 | if (ptr->atomtable) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 83 | { |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 84 | ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable); |
| 85 | if (table->size) return table; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 86 | } |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 87 | if (!create) return NULL; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 88 | if (!InitAtomTable16( 0 )) return NULL; |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 89 | /* Reload ptr in case it moved in linear memory */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 90 | ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 91 | return (ATOMTABLE *)((char *)ptr + ptr->atomtable); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | |
| 95 | /*********************************************************************** |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 96 | * ATOM_Hash |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 97 | * RETURNS |
| 98 | * The hash value for the input string |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 99 | */ |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 100 | static WORD ATOM_Hash( |
| 101 | WORD entries, /* [in] Total number of entries */ |
| 102 | LPCSTR str, /* [in] Pointer to string to hash */ |
| 103 | WORD len /* [in] Length of string */ |
| 104 | ) { |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 105 | WORD i, hash = 0; |
| 106 | |
Alexandre Julliard | 1565709 | 1999-05-23 10:25:25 +0000 | [diff] [blame] | 107 | TRACE("%x, %s, %x\n", entries, str, len); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 108 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 109 | for (i = 0; i < len; i++) hash ^= toupper(str[i]) + i; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 110 | return hash % entries; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /*********************************************************************** |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 115 | * ATOM_IsIntAtomA |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 116 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 117 | static BOOL ATOM_IsIntAtomA(LPCSTR atomstr,WORD *atomid) |
| 118 | { |
| 119 | UINT atom = 0; |
| 120 | if (!HIWORD(atomstr)) atom = LOWORD(atomstr); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 121 | else |
| 122 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 123 | if (*atomstr++ != '#') return FALSE; |
| 124 | while (*atomstr >= '0' && *atomstr <= '9') |
| 125 | { |
| 126 | atom = atom * 10 + *atomstr - '0'; |
| 127 | atomstr++; |
| 128 | } |
| 129 | if (*atomstr) return FALSE; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 130 | } |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 131 | if (!atom || (atom >= MIN_STR_ATOM)) |
| 132 | { |
| 133 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 134 | atom = 0; |
| 135 | } |
| 136 | *atomid = atom; |
| 137 | return TRUE; |
| 138 | } |
| 139 | |
| 140 | |
| 141 | /*********************************************************************** |
| 142 | * ATOM_IsIntAtomW |
| 143 | */ |
| 144 | static BOOL ATOM_IsIntAtomW(LPCWSTR atomstr,WORD *atomid) |
| 145 | { |
| 146 | UINT atom = 0; |
| 147 | if (!HIWORD(atomstr)) atom = LOWORD(atomstr); |
| 148 | else |
| 149 | { |
| 150 | if (*atomstr++ != '#') return FALSE; |
| 151 | while (*atomstr >= '0' && *atomstr <= '9') |
| 152 | { |
| 153 | atom = atom * 10 + *atomstr - '0'; |
| 154 | atomstr++; |
| 155 | } |
| 156 | if (*atomstr) return FALSE; |
| 157 | } |
| 158 | if (!atom || (atom >= MIN_STR_ATOM)) |
| 159 | { |
| 160 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 161 | atom = 0; |
| 162 | } |
| 163 | *atomid = atom; |
| 164 | return TRUE; |
| 165 | } |
| 166 | |
| 167 | |
| 168 | /*********************************************************************** |
| 169 | * ATOM_MakePtr |
| 170 | * |
| 171 | * Make an ATOMENTRY pointer from a handle (obtained from GetAtomHandle()). |
| 172 | */ |
| 173 | static inline ATOMENTRY *ATOM_MakePtr( HANDLE16 handle /* [in] Handle */ ) |
| 174 | { |
| 175 | return (ATOMENTRY *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | |
| 179 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 180 | * InitAtomTable16 (KERNEL.68) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 181 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 182 | WORD WINAPI InitAtomTable16( WORD entries ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 183 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 184 | int i; |
| 185 | HANDLE16 handle; |
| 186 | ATOMTABLE *table; |
| 187 | |
| 188 | /* We consider the first table to be initialized as the global table. |
| 189 | * This works, as USER (both built-in and native) is the first one to |
| 190 | * register ... |
| 191 | */ |
| 192 | |
| 193 | if (!ATOM_UserDS) |
| 194 | { |
| 195 | ATOM_UserDS = CURRENT_DS; |
| 196 | /* return dummy local handle */ |
| 197 | return LocalAlloc16( LMEM_FIXED, 1 ); |
| 198 | } |
| 199 | |
| 200 | /* Allocate the table */ |
| 201 | |
Alexandre Julliard | 737fa07 | 1998-11-15 17:29:15 +0000 | [diff] [blame] | 202 | if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 203 | handle = LocalAlloc16( LMEM_FIXED, sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) ); |
| 204 | if (!handle) return 0; |
| 205 | table = (ATOMTABLE *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle ); |
| 206 | table->size = entries; |
| 207 | for (i = 0; i < entries; i++) table->entries[i] = 0; |
| 208 | |
| 209 | /* Store a pointer to the table in the instance data */ |
| 210 | |
| 211 | ((INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ))->atomtable = handle; |
| 212 | return handle; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 213 | } |
| 214 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 215 | /*********************************************************************** |
| 216 | * GetAtomHandle (KERNEL.73) |
| 217 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 218 | HANDLE16 WINAPI GetAtomHandle16( ATOM atom ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 219 | { |
| 220 | if (atom < MIN_STR_ATOM) return 0; |
| 221 | return ATOMTOHANDLE( atom ); |
| 222 | } |
| 223 | |
| 224 | |
| 225 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 226 | * AddAtom16 (KERNEL.70) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 227 | * |
| 228 | * Windows DWORD aligns the atom entry size. |
| 229 | * The remaining unused string space created by the alignment |
| 230 | * gets padded with '\0's in a certain way to ensure |
| 231 | * that at least one trailing '\0' remains. |
| 232 | * |
| 233 | * RETURNS |
| 234 | * Atom: Success |
| 235 | * 0: Failure |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 236 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 237 | ATOM WINAPI AddAtom16( LPCSTR str ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 238 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 239 | char buffer[MAX_ATOM_LEN+1]; |
| 240 | WORD hash; |
| 241 | HANDLE16 entry; |
| 242 | ATOMENTRY * entryPtr; |
| 243 | ATOMTABLE * table; |
| 244 | int len, ae_len; |
| 245 | WORD iatom; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 246 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 247 | if (ATOM_IsIntAtomA( str, &iatom )) return iatom; |
| 248 | |
| 249 | TRACE("%s\n",debugstr_a(buffer)); |
| 250 | |
| 251 | /* Make a copy of the string to be sure it doesn't move in linear memory. */ |
| 252 | lstrcpynA( buffer, str, sizeof(buffer) ); |
| 253 | |
| 254 | len = strlen( buffer ); |
| 255 | if (!(table = ATOM_GetTable( TRUE ))) return 0; |
Alexandre Julliard | bcb7f4e | 2000-02-19 20:51:29 +0000 | [diff] [blame] | 256 | if (CURRENT_DS == ATOM_UserDS) return GlobalAddAtomA( str ); |
| 257 | |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 258 | hash = ATOM_Hash( table->size, buffer, len ); |
| 259 | entry = table->entries[hash]; |
| 260 | while (entry) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 261 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 262 | entryPtr = ATOM_MakePtr( entry ); |
| 263 | if ((entryPtr->length == len) && |
| 264 | (!lstrncmpiA( entryPtr->str, buffer, len ))) |
| 265 | { |
| 266 | entryPtr->refCount++; |
| 267 | TRACE("-- existing 0x%x\n", entry); |
| 268 | return HANDLETOATOM( entry ); |
| 269 | } |
| 270 | entry = entryPtr->next; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 271 | } |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 272 | |
| 273 | ae_len = (sizeof(ATOMENTRY)+len+3) & ~3; |
| 274 | entry = LocalAlloc16( LMEM_FIXED, ae_len ); |
| 275 | if (!entry) return 0; |
| 276 | /* Reload the table ptr in case it moved in linear memory */ |
| 277 | table = ATOM_GetTable( FALSE ); |
| 278 | entryPtr = ATOM_MakePtr( entry ); |
| 279 | entryPtr->next = table->entries[hash]; |
| 280 | entryPtr->refCount = 1; |
| 281 | entryPtr->length = len; |
| 282 | /* Some applications _need_ the '\0' padding provided by this strncpy */ |
| 283 | strncpy( entryPtr->str, buffer, ae_len - sizeof(ATOMENTRY) + 1 ); |
| 284 | entryPtr->str[ae_len - sizeof(ATOMENTRY)] = '\0'; |
| 285 | table->entries[hash] = entry; |
| 286 | TRACE("-- new 0x%x\n", entry); |
| 287 | return HANDLETOATOM( entry ); |
| 288 | } |
| 289 | |
| 290 | |
| 291 | /*********************************************************************** |
| 292 | * DeleteAtom16 (KERNEL.71) |
| 293 | */ |
| 294 | ATOM WINAPI DeleteAtom16( ATOM atom ) |
| 295 | { |
| 296 | ATOMENTRY * entryPtr; |
| 297 | ATOMTABLE * table; |
| 298 | HANDLE16 entry, *prevEntry; |
| 299 | WORD hash; |
| 300 | |
| 301 | if (atom < MIN_STR_ATOM) return 0; /* Integer atom */ |
| 302 | if (CURRENT_DS == ATOM_UserDS) return GlobalDeleteAtom( atom ); |
| 303 | |
| 304 | TRACE("0x%x\n",atom); |
| 305 | |
| 306 | if (!(table = ATOM_GetTable( FALSE ))) return 0; |
| 307 | entry = ATOMTOHANDLE( atom ); |
| 308 | entryPtr = ATOM_MakePtr( entry ); |
| 309 | |
| 310 | /* Find previous atom */ |
| 311 | hash = ATOM_Hash( table->size, entryPtr->str, entryPtr->length ); |
| 312 | prevEntry = &table->entries[hash]; |
| 313 | while (*prevEntry && *prevEntry != entry) |
| 314 | { |
| 315 | ATOMENTRY * prevEntryPtr = ATOM_MakePtr( *prevEntry ); |
| 316 | prevEntry = &prevEntryPtr->next; |
| 317 | } |
| 318 | if (!*prevEntry) return atom; |
| 319 | |
| 320 | /* Delete atom */ |
| 321 | if (--entryPtr->refCount == 0) |
| 322 | { |
| 323 | *prevEntry = entryPtr->next; |
| 324 | LocalFree16( entry ); |
| 325 | } |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | |
| 330 | /*********************************************************************** |
| 331 | * FindAtom16 (KERNEL.69) |
| 332 | */ |
| 333 | ATOM WINAPI FindAtom16( LPCSTR str ) |
| 334 | { |
| 335 | ATOMTABLE * table; |
| 336 | WORD hash,iatom; |
| 337 | HANDLE16 entry; |
| 338 | int len; |
| 339 | |
| 340 | if (CURRENT_DS == ATOM_UserDS) return GlobalFindAtomA( str ); |
| 341 | |
| 342 | TRACE("%s\n",debugres_a(str)); |
| 343 | |
| 344 | if (ATOM_IsIntAtomA( str, &iatom )) return iatom; |
| 345 | if ((len = strlen( str )) > 255) len = 255; |
| 346 | if (!(table = ATOM_GetTable( FALSE ))) return 0; |
| 347 | hash = ATOM_Hash( table->size, str, len ); |
| 348 | entry = table->entries[hash]; |
| 349 | while (entry) |
| 350 | { |
| 351 | ATOMENTRY * entryPtr = ATOM_MakePtr( entry ); |
| 352 | if ((entryPtr->length == len) && |
| 353 | (!lstrncmpiA( entryPtr->str, str, len ))) |
| 354 | { |
| 355 | TRACE("-- found %x\n", entry); |
| 356 | return HANDLETOATOM( entry ); |
| 357 | } |
| 358 | entry = entryPtr->next; |
| 359 | } |
| 360 | TRACE("-- not found\n"); |
| 361 | return 0; |
| 362 | } |
| 363 | |
| 364 | |
| 365 | /*********************************************************************** |
| 366 | * GetAtomName16 (KERNEL.72) |
| 367 | */ |
| 368 | UINT16 WINAPI GetAtomName16( ATOM atom, LPSTR buffer, INT16 count ) |
| 369 | { |
| 370 | ATOMTABLE * table; |
| 371 | ATOMENTRY * entryPtr; |
| 372 | HANDLE16 entry; |
| 373 | char * strPtr; |
| 374 | UINT len; |
| 375 | char text[8]; |
| 376 | |
| 377 | if (CURRENT_DS == ATOM_UserDS) return GlobalGetAtomNameA( atom, buffer, count ); |
| 378 | |
| 379 | TRACE("%x\n",atom); |
| 380 | |
| 381 | if (!count) return 0; |
| 382 | if (atom < MIN_STR_ATOM) |
| 383 | { |
| 384 | sprintf( text, "#%d", atom ); |
| 385 | len = strlen(text); |
| 386 | strPtr = text; |
| 387 | } |
| 388 | else |
| 389 | { |
| 390 | if (!(table = ATOM_GetTable( FALSE ))) return 0; |
| 391 | entry = ATOMTOHANDLE( atom ); |
| 392 | entryPtr = ATOM_MakePtr( entry ); |
| 393 | len = entryPtr->length; |
| 394 | strPtr = entryPtr->str; |
| 395 | } |
| 396 | if (len >= count) len = count-1; |
| 397 | memcpy( buffer, strPtr, len ); |
| 398 | buffer[len] = '\0'; |
| 399 | return len; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 400 | } |
| 401 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 402 | /*********************************************************************** |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 403 | * InitAtomTable (KERNEL32.471) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 404 | */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 405 | BOOL WINAPI InitAtomTable( DWORD entries ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 406 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 407 | struct init_atom_table_request *req = get_req_buffer(); |
| 408 | req->entries = entries; |
| 409 | return !server_call( REQ_INIT_ATOM_TABLE ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 413 | static ATOM ATOM_AddAtomA( LPCSTR str, BOOL local ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 414 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 415 | ATOM atom = 0; |
| 416 | if (!ATOM_IsIntAtomA( str, &atom )) |
| 417 | { |
| 418 | struct add_atom_request *req = get_req_buffer(); |
| 419 | server_strcpyAtoW( req->name, str ); |
| 420 | req->local = local; |
| 421 | if (!server_call( REQ_ADD_ATOM )) atom = req->atom + MIN_STR_ATOM; |
| 422 | } |
| 423 | TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_a(str), atom ); |
| 424 | return atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | |
| 428 | /*********************************************************************** |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 429 | * GlobalAddAtomA (USER.268) (KERNEL32.313) |
| 430 | * |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 431 | * Adds a character string to the global atom table and returns a unique |
| 432 | * value identifying the string. |
| 433 | * |
| 434 | * RETURNS |
| 435 | * Atom: Success |
| 436 | * 0: Failure |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 437 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 438 | ATOM WINAPI GlobalAddAtomA( LPCSTR str /* [in] Pointer to string to add */ ) |
| 439 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 440 | return ATOM_AddAtomA( str, FALSE ); |
| 441 | } |
| 442 | |
| 443 | |
| 444 | /*********************************************************************** |
| 445 | * AddAtomA (KERNEL32.0) |
| 446 | * Adds a string to the atom table and returns the atom identifying the |
| 447 | * string. |
| 448 | * |
| 449 | * RETURNS |
| 450 | * Atom: Success |
| 451 | * 0: Failure |
| 452 | */ |
| 453 | ATOM WINAPI AddAtomA( LPCSTR str /* [in] Pointer to string to add */ ) |
| 454 | { |
| 455 | return ATOM_AddAtomA( str, TRUE ); |
| 456 | } |
| 457 | |
| 458 | |
| 459 | static ATOM ATOM_AddAtomW( LPCWSTR str, BOOL local ) |
| 460 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 461 | ATOM atom = 0; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 462 | if (!ATOM_IsIntAtomW( str, &atom )) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 463 | { |
| 464 | struct add_atom_request *req = get_req_buffer(); |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 465 | server_strcpyW( req->name, str ); |
| 466 | req->local = local; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 467 | if (!server_call( REQ_ADD_ATOM )) atom = req->atom + MIN_STR_ATOM; |
| 468 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 469 | TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_w(str), atom ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 470 | return atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | |
| 474 | /*********************************************************************** |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 475 | * GlobalAddAtomW (KERNEL32.314) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 476 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 477 | ATOM WINAPI GlobalAddAtomW( LPCWSTR str ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 478 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 479 | return ATOM_AddAtomW( str, FALSE ); |
| 480 | } |
| 481 | |
| 482 | |
| 483 | /*********************************************************************** |
| 484 | * AddAtomW (KERNEL32.1) |
| 485 | */ |
| 486 | ATOM WINAPI AddAtomW( LPCWSTR str ) |
| 487 | { |
| 488 | return ATOM_AddAtomW( str, TRUE ); |
| 489 | } |
| 490 | |
| 491 | |
| 492 | static ATOM ATOM_DeleteAtom( ATOM atom, BOOL local) |
| 493 | { |
| 494 | TRACE( "(%s) %x\n", local ? "local" : "glbal", atom ); |
| 495 | if (atom < MIN_STR_ATOM) atom = 0; |
| 496 | else |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 497 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 498 | struct delete_atom_request *req = get_req_buffer(); |
| 499 | req->atom = atom - MIN_STR_ATOM; |
| 500 | req->local = local; |
| 501 | if (!server_call( REQ_DELETE_ATOM )) atom = 0; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 502 | } |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 503 | return atom; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | |
| 507 | /*********************************************************************** |
| 508 | * GlobalDeleteAtom (USER.269) (KERNEL32.317) |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 509 | * Decrements the reference count of a string atom. If the count is |
| 510 | * zero, the string associated with the atom is removed from the table. |
| 511 | * |
| 512 | * RETURNS |
| 513 | * 0: Success |
| 514 | * Atom: Failure |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 515 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 516 | ATOM WINAPI GlobalDeleteAtom( ATOM atom /* [in] Atom to delete */ ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 517 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 518 | return ATOM_DeleteAtom( atom, FALSE); |
| 519 | } |
| 520 | |
| 521 | |
| 522 | /*********************************************************************** |
| 523 | * DeleteAtom (KERNEL32.69) |
| 524 | * Decrements the reference count of a string atom. If count becomes |
| 525 | * zero, the string associated with the atom is removed from the table. |
| 526 | * |
| 527 | * RETURNS |
| 528 | * 0: Success |
| 529 | * Atom: Failure |
| 530 | */ |
| 531 | ATOM WINAPI DeleteAtom( ATOM atom /* [in] Atom to delete */ ) |
| 532 | { |
| 533 | return ATOM_DeleteAtom( atom, TRUE ); |
| 534 | } |
| 535 | |
| 536 | |
| 537 | static ATOM ATOM_FindAtomA( LPCSTR str, BOOL local ) |
| 538 | { |
| 539 | ATOM atom = 0; |
| 540 | if (!ATOM_IsIntAtomA( str, &atom )) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 541 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 542 | struct find_atom_request *req = get_req_buffer(); |
| 543 | server_strcpyAtoW( req->name, str ); |
| 544 | req->local = local; |
| 545 | if (!server_call( REQ_FIND_ATOM )) atom = req->atom + MIN_STR_ATOM; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 546 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 547 | TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_a(str), atom ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 548 | return atom; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | |
| 552 | /*********************************************************************** |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 553 | * GlobalFindAtomA (USER.270) (KERNEL32.318) |
| 554 | * |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 555 | * Searches the atom table for the string and returns the atom |
| 556 | * associated with it. |
| 557 | * |
| 558 | * RETURNS |
| 559 | * Atom: Success |
| 560 | * 0: Failure |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 561 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 562 | ATOM WINAPI GlobalFindAtomA( LPCSTR str /* [in] Pointer to string to search for */ ) |
| 563 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 564 | return ATOM_FindAtomA( str, FALSE ); |
| 565 | } |
| 566 | |
| 567 | /*********************************************************************** |
| 568 | * FindAtomA (KERNEL32.117) |
| 569 | * Searches the local atom table for the string and returns the atom |
| 570 | * associated with that string. |
| 571 | * |
| 572 | * RETURNS |
| 573 | * Atom: Success |
| 574 | * 0: Failure |
| 575 | */ |
| 576 | ATOM WINAPI FindAtomA( LPCSTR str /* [in] Pointer to string to find */ ) |
| 577 | { |
| 578 | return ATOM_FindAtomA( str, TRUE ); |
| 579 | } |
| 580 | |
| 581 | |
| 582 | static ATOM ATOM_FindAtomW( LPCWSTR str, BOOL local ) |
| 583 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 584 | ATOM atom = 0; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 585 | if (!ATOM_IsIntAtomW( str, &atom )) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 586 | { |
| 587 | struct find_atom_request *req = get_req_buffer(); |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 588 | server_strcpyW( req->name, str ); |
| 589 | req->local = local; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 590 | if (!server_call( REQ_FIND_ATOM )) atom = req->atom + MIN_STR_ATOM; |
| 591 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 592 | TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_w(str), atom ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 593 | return atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | |
| 597 | /*********************************************************************** |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 598 | * GlobalFindAtomW (KERNEL32.319) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 599 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 600 | ATOM WINAPI GlobalFindAtomW( LPCWSTR str ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 601 | { |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 602 | return ATOM_FindAtomW( str, FALSE ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | |
| 606 | /*********************************************************************** |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 607 | * FindAtomW (KERNEL32.118) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 608 | */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 609 | ATOM WINAPI FindAtomW( LPCWSTR str ) |
| 610 | { |
| 611 | return ATOM_FindAtomW( str, TRUE ); |
| 612 | } |
| 613 | |
| 614 | |
| 615 | static UINT ATOM_GetAtomNameA( ATOM atom, LPSTR buffer, INT count, BOOL local ) |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 616 | { |
| 617 | INT len; |
| 618 | if (atom < MIN_STR_ATOM) |
| 619 | { |
| 620 | char name[8]; |
| 621 | if (!atom) |
| 622 | { |
| 623 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 624 | return 0; |
| 625 | } |
| 626 | len = sprintf( name, "#%d", atom ); |
| 627 | lstrcpynA( buffer, name, count ); |
| 628 | } |
| 629 | else |
| 630 | { |
| 631 | struct get_atom_name_request *req = get_req_buffer(); |
| 632 | req->atom = atom - MIN_STR_ATOM; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 633 | req->local = local; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 634 | if (server_call( REQ_GET_ATOM_NAME )) return 0; |
| 635 | lstrcpynWtoA( buffer, req->name, count ); |
| 636 | len = lstrlenW( req->name ); |
| 637 | } |
| 638 | if (count <= len) |
| 639 | { |
| 640 | SetLastError( ERROR_MORE_DATA ); |
| 641 | return 0; |
| 642 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 643 | TRACE( "(%s) %x -> %s\n", local ? "local" : "global", atom, debugstr_a(buffer) ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 644 | return len; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 645 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 646 | |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 647 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 648 | /*********************************************************************** |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 649 | * GlobalGetAtomNameA (USER.271) (KERNEL32.323) |
| 650 | * |
| 651 | * Retrieves a copy of the string associated with an atom. |
| 652 | * |
| 653 | * RETURNS |
| 654 | * Length of string in characters: Success |
| 655 | * 0: Failure |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 656 | */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 657 | UINT WINAPI GlobalGetAtomNameA( |
| 658 | ATOM atom, /* [in] Atom identifier */ |
| 659 | LPSTR buffer, /* [out] Pointer to buffer for atom string */ |
| 660 | INT count ) /* [in] Size of buffer */ |
| 661 | { |
| 662 | return ATOM_GetAtomNameA( atom, buffer, count, FALSE ); |
| 663 | } |
| 664 | |
| 665 | |
| 666 | /*********************************************************************** |
| 667 | * GetAtomNameA (KERNEL32.149) |
| 668 | * Retrieves a copy of the string associated with the atom. |
| 669 | * |
| 670 | * RETURNS |
| 671 | * Length of string: Success |
| 672 | * 0: Failure |
| 673 | */ |
| 674 | UINT WINAPI GetAtomNameA( |
| 675 | ATOM atom, /* [in] Atom */ |
| 676 | LPSTR buffer, /* [out] Pointer to string for atom string */ |
| 677 | INT count) /* [in] Size of buffer */ |
| 678 | { |
| 679 | return ATOM_GetAtomNameA( atom, buffer, count, TRUE ); |
| 680 | } |
| 681 | |
| 682 | |
| 683 | static UINT ATOM_GetAtomNameW( ATOM atom, LPWSTR buffer, INT count, BOOL local ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 684 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 685 | INT len; |
| 686 | if (atom < MIN_STR_ATOM) |
| 687 | { |
| 688 | char name[8]; |
| 689 | if (!atom) |
| 690 | { |
| 691 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 692 | return 0; |
| 693 | } |
| 694 | len = sprintf( name, "#%d", atom ); |
| 695 | lstrcpynAtoW( buffer, name, count ); |
| 696 | } |
| 697 | else |
| 698 | { |
| 699 | struct get_atom_name_request *req = get_req_buffer(); |
| 700 | req->atom = atom - MIN_STR_ATOM; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 701 | req->local = local; |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 702 | if (server_call( REQ_GET_ATOM_NAME )) return 0; |
| 703 | lstrcpynW( buffer, req->name, count ); |
| 704 | len = lstrlenW( req->name ); |
| 705 | } |
| 706 | if (count <= len) |
| 707 | { |
| 708 | SetLastError( ERROR_MORE_DATA ); |
| 709 | return 0; |
| 710 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 711 | TRACE( "(%s) %x -> %s\n", local ? "local" : "global", atom, debugstr_w(buffer) ); |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 712 | return len; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 713 | } |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame^] | 714 | |
| 715 | |
| 716 | /*********************************************************************** |
| 717 | * GlobalGetAtomNameW (KERNEL32.324) |
| 718 | */ |
| 719 | UINT WINAPI GlobalGetAtomNameW( ATOM atom, LPWSTR buffer, INT count ) |
| 720 | { |
| 721 | return ATOM_GetAtomNameW( atom, buffer, count, FALSE); |
| 722 | } |
| 723 | |
| 724 | |
| 725 | /*********************************************************************** |
| 726 | * GetAtomNameW (KERNEL32.150) |
| 727 | */ |
| 728 | UINT WINAPI GetAtomNameW( ATOM atom, LPWSTR buffer, INT count ) |
| 729 | { |
| 730 | return ATOM_GetAtomNameW( atom, buffer, count, TRUE ); |
| 731 | } |