ReactOS  0.4.14-dev-376-gaedba84
atom.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for atom.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS RtlpInitAtomTableLock (PRTL_ATOM_TABLE AtomTable)
 
VOID RtlpDestroyAtomTableLock (PRTL_ATOM_TABLE AtomTable)
 
BOOLEAN RtlpLockAtomTable (PRTL_ATOM_TABLE AtomTable)
 
VOID RtlpUnlockAtomTable (PRTL_ATOM_TABLE AtomTable)
 
BOOLEAN RtlpCreateAtomHandleTable (PRTL_ATOM_TABLE AtomTable)
 
VOID RtlpDestroyAtomHandleTable (PRTL_ATOM_TABLE AtomTable)
 
PRTL_ATOM_TABLE RtlpAllocAtomTable (ULONG Size)
 
VOID RtlpFreeAtomTable (PRTL_ATOM_TABLE AtomTable)
 
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry (ULONG Size)
 
VOID RtlpFreeAtomTableEntry (PRTL_ATOM_TABLE_ENTRY Entry)
 
BOOLEAN RtlpCreateAtomHandle (PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
 
VOID RtlpFreeAtomHandle (PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
 
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry (PRTL_ATOM_TABLE AtomTable, ULONG Index)
 
static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName (IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
 
static BOOLEAN RtlpCheckIntegerAtom (PWSTR AtomName, PUSHORT AtomValue)
 
NTSTATUS NTAPI RtlCreateAtomTable (IN ULONG TableSize, IN OUT PRTL_ATOM_TABLE *AtomTable)
 
NTSTATUS NTAPI RtlDestroyAtomTable (IN PRTL_ATOM_TABLE AtomTable)
 
NTSTATUS NTAPI RtlEmptyAtomTable (PRTL_ATOM_TABLE AtomTable, BOOLEAN DeletePinned)
 
NTSTATUS NTAPI RtlAddAtomToAtomTable (IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM Atom)
 
NTSTATUS NTAPI RtlDeleteAtomFromAtomTable (IN PRTL_ATOM_TABLE AtomTable, IN RTL_ATOM Atom)
 
NTSTATUS NTAPI RtlLookupAtomInAtomTable (IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM Atom)
 
NTSTATUS NTAPI RtlPinAtomInAtomTable (IN PRTL_ATOM_TABLE AtomTable, IN RTL_ATOM Atom)
 
NTSTATUS NTAPI RtlQueryAtomInAtomTable (PRTL_ATOM_TABLE AtomTable, RTL_ATOM Atom, PULONG RefCount, PULONG PinCount, PWSTR AtomName, PULONG NameLength)
 
NTSTATUS NTAPI RtlQueryAtomListInAtomTable (IN PRTL_ATOM_TABLE AtomTable, IN ULONG MaxAtomCount, OUT ULONG *AtomCount, OUT RTL_ATOM *AtomList)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file atom.c.

Function Documentation

◆ RtlAddAtomToAtomTable()

NTSTATUS NTAPI RtlAddAtomToAtomTable ( IN PRTL_ATOM_TABLE  AtomTable,
IN PWSTR  AtomName,
OUT PRTL_ATOM  Atom 
)

Definition at line 308 of file atom.c.

311 {
312  USHORT AtomValue;
313  PRTL_ATOM_TABLE_ENTRY *HashLink;
316 
317  DPRINT("RtlAddAtomToAtomTable (AtomTable %p AtomName %S Atom %p)\n",
318  AtomTable, AtomName, Atom);
319 
320  if (RtlpCheckIntegerAtom (AtomName, &AtomValue))
321  {
322  /* integer atom */
323  if (AtomValue >= 0xC000)
324  {
326  }
327  else if (Atom != NULL)
328  {
329  *Atom = (RTL_ATOM)AtomValue;
330  }
331 
332  return Status;
333  }
334 
335  RtlpLockAtomTable(AtomTable);
336 
337  /* string atom, hash it and try to find an existing atom with the same name */
338  Entry = RtlpHashAtomName(AtomTable, AtomName, &HashLink);
339 
340  if (Entry != NULL)
341  {
342  /* found another atom, increment the reference counter unless it's pinned */
343 
344  if (!(Entry->Flags & RTL_ATOM_IS_PINNED))
345  {
346  if (++Entry->ReferenceCount == 0)
347  {
348  /* FIXME - references overflowed, pin the atom? */
349  Entry->Flags |= RTL_ATOM_IS_PINNED;
350  }
351  }
352 
353  if (Atom != NULL)
354  {
355  *Atom = (RTL_ATOM)Entry->Atom;
356  }
357  }
358  else
359  {
360  /* couldn't find an existing atom, HashLink now points to either the
361  HashLink pointer of the previous atom or to the bucket so we can
362  simply add it to the list */
363  if (HashLink != NULL)
364  {
365  ULONG AtomNameLen = (ULONG)wcslen(AtomName);
366 
367  if (AtomNameLen > RTL_MAXIMUM_ATOM_LENGTH)
368  {
370  goto end;
371  }
372 
374  sizeof(Entry->Name) +
375  (AtomNameLen + 1) * sizeof(WCHAR));
376  if (Entry != NULL)
377  {
378  Entry->HashLink = NULL;
379  Entry->ReferenceCount = 1;
380  Entry->Flags = 0x0;
381 
382  Entry->NameLength = (UCHAR)AtomNameLen;
383  RtlCopyMemory(Entry->Name,
384  AtomName,
385  (AtomNameLen + 1) * sizeof(WCHAR));
386 
387  if (RtlpCreateAtomHandle(AtomTable, Entry))
388  {
389  /* append the atom to the list */
390  *HashLink = Entry;
391 
392  if (Atom != NULL)
393  {
394  *Atom = (RTL_ATOM)Entry->Atom;
395  }
396  }
397  else
398  {
401  }
402  }
403  else
404  {
406  }
407  }
408  else
409  {
410  /* The caller supplied an empty atom name! */
412  }
413  }
414 end:
415  RtlpUnlockAtomTable(AtomTable);
416 
417  return Status;
418 }
Definition: rtltypes.h:1642
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
unsigned short RTL_ATOM
Definition: atom.c:42
struct _Entry Entry
Definition: kefuncs.h:640
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:434
GLuint GLuint end
Definition: gl.h:1545
_Out_ RTL_ATOM * Atom
Definition: class.h:54
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
Definition: libsupp.c:426
#define RTL_ATOM_IS_PINNED
Definition: rtltypes.h:377
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
BOOLEAN RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:456
static ULONG
Definition: atom.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RTL_MAXIMUM_ATOM_LENGTH
Definition: rtltypes.h:36
unsigned char UCHAR
Definition: xmlstorage.h:181
static BOOLEAN RtlpCheckIntegerAtom(PWSTR AtomName, PUSHORT AtomValue)
Definition: atom.c:86
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
Definition: atom.c:39
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
base of all file and directory entries
Definition: entries.h:82

Referenced by InternalAddAtom(), and NtAddAtom().

◆ RtlCreateAtomTable()

NTSTATUS NTAPI RtlCreateAtomTable ( IN ULONG  TableSize,
IN OUT PRTL_ATOM_TABLE AtomTable 
)

Definition at line 150 of file atom.c.

153 {
156 
157  DPRINT("RtlCreateAtomTable(TableSize %lu AtomTable %p)\n",
158  TableSize, AtomTable);
159 
160  if (*AtomTable != NULL)
161  {
162  return STATUS_SUCCESS;
163  }
164 
165  /* Use default if size was incorrect */
166  if (TableSize <= 1) TableSize = 37;
167 
168  /* allocate atom table */
170  sizeof(RTL_ATOM_TABLE));
171  if (Table == NULL)
172  {
173  return STATUS_NO_MEMORY;
174  }
175 
176  /* initialize atom table */
177  Table->NumberOfBuckets = TableSize;
178 
180  if (!NT_SUCCESS(Status))
181  {
183  return Status;
184  }
185 
187  {
190  return STATUS_NO_MEMORY;
191  }
192 
193  *AtomTable = Table;
194  return STATUS_SUCCESS;
195 }
Definition: rtltypes.h:1642
ASMGENDATA Table[]
Definition: genincdata.c:61
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS RtlpInitAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:362
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN RtlpCreateAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:394
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct atom_table * RTL_ATOM_TABLE
Definition: atom.c:43
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:370
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:3971
PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size)
Definition: libsupp.c:410
return STATUS_SUCCESS
Definition: btrfs.c:2938
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:418

Referenced by ExpGetGlobalAtomTable(), InitAtomTable(), and InternalInitAtomTable().

◆ RtlDeleteAtomFromAtomTable()

NTSTATUS NTAPI RtlDeleteAtomFromAtomTable ( IN PRTL_ATOM_TABLE  AtomTable,
IN RTL_ATOM  Atom 
)

Definition at line 426 of file atom.c.

429 {
432 
433  DPRINT("RtlDeleteAtomFromAtomTable (AtomTable %p Atom %x)\n",
434  AtomTable, Atom);
435 
436  if (Atom >= 0xC000)
437  {
438  RtlpLockAtomTable(AtomTable);
439 
440  Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
441 
442  if (Entry != NULL && Entry->Atom == (USHORT)Atom)
443  {
444  if (!(Entry->Flags & RTL_ATOM_IS_PINNED))
445  {
446  if (--Entry->ReferenceCount == 0)
447  {
448  PRTL_ATOM_TABLE_ENTRY *HashLink;
449 
450  /* it's time to delete the atom. we need to unlink it from
451  the list. The easiest way is to take the atom name and
452  hash it again, this way we get the pointer to either
453  the hash bucket or the previous atom that links to the
454  one we want to delete. This way we can easily bypass
455  this item. */
456  if (RtlpHashAtomName(AtomTable, Entry->Name, &HashLink) != NULL)
457  {
458  /* bypass this atom */
459  *HashLink = Entry->HashLink;
460 
461  RtlpFreeAtomHandle(AtomTable, Entry);
462 
464  }
465  else
466  {
467  /* WTF?! This should never happen!!! */
468  ASSERT(FALSE);
469  }
470  }
471  }
472  else
473  {
474  /* tried to delete a pinned atom, do nothing and return
475  STATUS_WAS_LOCKED, which is NOT a failure code! */
477  }
478  }
479  else
480  {
482  }
483 
484  RtlpUnlockAtomTable(AtomTable);
485  }
486 
487  return Status;
488 }
Definition: rtltypes.h:1642
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:434
_Out_ RTL_ATOM * Atom
Definition: class.h:54
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define RTL_ATOM_IS_PINNED
Definition: rtltypes.h:377
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:442
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:492
Status
Definition: gdiplustypes.h:24
#define STATUS_WAS_LOCKED
Definition: ntstatus.h:139
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
Definition: atom.c:39
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82

Referenced by InternalDeleteAtom(), and NtDeleteAtom().

◆ RtlDestroyAtomTable()

NTSTATUS NTAPI RtlDestroyAtomTable ( IN PRTL_ATOM_TABLE  AtomTable)

Definition at line 203 of file atom.c.

205 {
206  PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
207  PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry;
208 
209  DPRINT("RtlDestroyAtomTable (AtomTable %p)\n", AtomTable);
210 
211  if (!RtlpLockAtomTable(AtomTable))
212  {
213  return (STATUS_INVALID_PARAMETER);
214  }
215 
216  /* delete all atoms */
217  LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
218  for (CurrentBucket = AtomTable->Buckets;
219  CurrentBucket != LastBucket;
220  CurrentBucket++)
221  {
222  NextEntry = *CurrentBucket;
223  *CurrentBucket = NULL;
224 
225  while (NextEntry != NULL)
226  {
227  CurrentEntry = NextEntry;
228  NextEntry = NextEntry->HashLink;
229 
230  /* no need to delete the atom handle, the handles will all be freed
231  up when destroying the atom handle table! */
232 
233  RtlpFreeAtomTableEntry(CurrentEntry);
234  }
235  }
236 
237  RtlpDestroyAtomHandleTable(AtomTable);
238 
239  RtlpUnlockAtomTable(AtomTable);
240 
241  RtlpDestroyAtomTableLock(AtomTable);
242 
243  RtlpFreeAtomTable(AtomTable);
244 
245  return STATUS_SUCCESS;
246 }
Definition: rtltypes.h:1642
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:434
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:370
struct _RTL_ATOM_TABLE_ENTRY * HashLink
Definition: rtltypes.h:1644
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:404
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
return STATUS_SUCCESS
Definition: btrfs.c:2938
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:418

Referenced by IntWinStaObjectDelete(), and main().

◆ RtlEmptyAtomTable()

NTSTATUS NTAPI RtlEmptyAtomTable ( PRTL_ATOM_TABLE  AtomTable,
BOOLEAN  DeletePinned 
)

Definition at line 254 of file atom.c.

257 {
258  PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
259  PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry, *PtrEntry;
260 
261  DPRINT("RtlEmptyAtomTable (AtomTable %p DeletePinned %x)\n",
262  AtomTable, DeletePinned);
263 
264  if (RtlpLockAtomTable(AtomTable) == FALSE)
265  {
266  return (STATUS_INVALID_PARAMETER);
267  }
268 
269  /* delete all atoms */
270  LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
271  for (CurrentBucket = AtomTable->Buckets;
272  CurrentBucket != LastBucket;
273  CurrentBucket++)
274  {
275  NextEntry = *CurrentBucket;
276  PtrEntry = CurrentBucket;
277 
278  while (NextEntry != NULL)
279  {
280  CurrentEntry = NextEntry;
281  NextEntry = NextEntry->HashLink;
282 
283  if (DeletePinned || !(CurrentEntry->Flags & RTL_ATOM_IS_PINNED))
284  {
285  *PtrEntry = NextEntry;
286 
287  RtlpFreeAtomHandle(AtomTable, CurrentEntry);
288 
289  RtlpFreeAtomTableEntry(CurrentEntry);
290  }
291  else
292  {
293  PtrEntry = &CurrentEntry->HashLink;
294  }
295  }
296  }
297 
298  RtlpUnlockAtomTable(AtomTable);
299 
300  return STATUS_SUCCESS;
301 }
Definition: rtltypes.h:1642
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
UCHAR Flags
Definition: rtltypes.h:1648
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:434
#define RTL_ATOM_IS_PINNED
Definition: rtltypes.h:377
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:442
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
struct _RTL_ATOM_TABLE_ENTRY * HashLink
Definition: rtltypes.h:1644
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ RtlLookupAtomInAtomTable()

NTSTATUS NTAPI RtlLookupAtomInAtomTable ( IN PRTL_ATOM_TABLE  AtomTable,
IN PWSTR  AtomName,
OUT PRTL_ATOM  Atom 
)

Definition at line 495 of file atom.c.

498 {
499  PRTL_ATOM_TABLE_ENTRY Entry, *HashLink;
500  USHORT AtomValue;
501  RTL_ATOM FoundAtom = 0;
503 
504  DPRINT("RtlLookupAtomInAtomTable (AtomTable %p AtomName %S Atom %p)\n",
505  AtomTable, AtomName, Atom);
506 
507  if (RtlpCheckIntegerAtom (AtomName, &AtomValue))
508  {
509  /* integer atom */
510  if (AtomValue >= 0xC000)
511  {
513  }
514  else if (Atom != NULL)
515  {
516  *Atom = (RTL_ATOM)AtomValue;
517  }
518 
519  return Status;
520  }
521 
522  RtlpLockAtomTable(AtomTable);
524 
525  /* string atom */
526  Entry = RtlpHashAtomName(AtomTable, AtomName, &HashLink);
527  if (Entry != NULL)
528  {
530  FoundAtom = (RTL_ATOM)Entry->Atom;
531  }
532 
533  RtlpUnlockAtomTable(AtomTable);
534  if (NT_SUCCESS(Status) && Atom != NULL)
535  {
536  *Atom = FoundAtom;
537  }
538  return Status;
539 }
Definition: rtltypes.h:1642
unsigned short RTL_ATOM
Definition: atom.c:42
struct _Entry Entry
Definition: kefuncs.h:640
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_Out_ RTL_ATOM * Atom
Definition: class.h:54
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static BOOLEAN RtlpCheckIntegerAtom(PWSTR AtomName, PUSHORT AtomValue)
Definition: atom.c:86
Status
Definition: gdiplustypes.h:24
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
Definition: atom.c:39
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82

Referenced by InternalFindAtom(), and NtFindAtom().

◆ RtlpAllocAtomTable()

PRTL_ATOM_TABLE RtlpAllocAtomTable ( ULONG  Size)

Definition at line 410 of file libsupp.c.

411 {
412  return (PRTL_ATOM_TABLE)RtlAllocateHeap(RtlGetProcessHeap(),
414  Size);
415 }
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by RtlCreateAtomTable().

◆ RtlpAllocAtomTableEntry()

PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry ( ULONG  Size)

Definition at line 426 of file libsupp.c.

427 {
428  return (PRTL_ATOM_TABLE_ENTRY)RtlAllocateHeap(RtlGetProcessHeap(),
430  Size);
431 }
Definition: rtltypes.h:1642
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by RtlAddAtomToAtomTable().

◆ RtlpCheckIntegerAtom()

static BOOLEAN RtlpCheckIntegerAtom ( PWSTR  AtomName,
PUSHORT  AtomValue 
)
static

Definition at line 86 of file atom.c.

89 {
90  UNICODE_STRING AtomString;
91  ULONG LongValue;
92  USHORT LoValue;
93  PWCHAR p;
94 
95  DPRINT("RtlpCheckIntegerAtom(AtomName '%S' AtomValue %p)\n",
96  AtomName, AtomValue);
97 
98  if (!((ULONG_PTR)AtomName & 0xFFFF0000))
99  {
100  LoValue = (USHORT)((ULONG_PTR)AtomName & 0xFFFF);
101 
102  if (LoValue == 0)
103  LoValue = 0xC000;
104 
105  if (AtomValue != NULL)
106  *AtomValue = LoValue;
107 
108  return TRUE;
109  }
110 
111  /*
112  * AtomName cannot be NULL because this
113  * case was caught by the previous test.
114  */
115  ASSERT(AtomName != NULL);
116 
117  if (*AtomName != L'#')
118  return FALSE;
119 
120  p = AtomName;
121  p++;
122  while (*p)
123  {
124  if ((*p < L'0') || (*p > L'9'))
125  return FALSE;
126  p++;
127  }
128 
129  p = AtomName;
130  p++;
131  RtlInitUnicodeString(&AtomString, p);
132 
133  DPRINT("AtomString: %wZ\n", &AtomString);
134 
135  RtlUnicodeStringToInteger(&AtomString, 10, &LongValue);
136 
137  DPRINT("LongValue: %lu\n", LongValue);
138 
139  *AtomValue = (USHORT)(LongValue & 0x0000FFFF);
140 
141  return TRUE;
142 }
#define TRUE
Definition: types.h:120
uint16_t * PWCHAR
Definition: typedefs.h:54
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by RtlAddAtomToAtomTable(), and RtlLookupAtomInAtomTable().

◆ RtlpCreateAtomHandle()

BOOLEAN RtlpCreateAtomHandle ( PRTL_ATOM_TABLE  AtomTable,
PRTL_ATOM_TABLE_ENTRY  Entry 
)

Definition at line 456 of file libsupp.c.

457 {
458  ULONG HandleIndex;
459  PRTL_HANDLE_TABLE_ENTRY RtlHandle;
460 
461  RtlHandle = RtlAllocateHandle(&AtomTable->RtlHandleTable,
462  &HandleIndex);
463  if (RtlHandle != NULL)
464  {
465  PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
466 
467  /* FIXME - Handle Indexes >= 0xC000 ?! */
468  if (HandleIndex < 0xC000)
469  {
470  Entry->HandleIndex = (USHORT)HandleIndex;
471  Entry->Atom = 0xC000 + (USHORT)HandleIndex;
472 
473  AtomHandle->AtomEntry = Entry;
474  AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
475 
476  return TRUE;
477  }
478  else
479  {
480  /* set the valid flag, otherwise RtlFreeHandle will fail! */
481  AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
482 
483  RtlFreeHandle(&AtomTable->RtlHandleTable,
484  RtlHandle);
485  }
486  }
487 
488  return FALSE;
489 }
#define RTL_HANDLE_VALID
Definition: rtltypes.h:372
struct _RTL_ATOM_HANDLE * PRTL_ATOM_HANDLE
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
smooth NULL
Definition: ftsmooth.c:416
PRTL_ATOM_TABLE_ENTRY AtomEntry
Definition: libsupp.c:358
NTSYSAPI PRTL_HANDLE_TABLE_ENTRY NTAPI RtlAllocateHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _Inout_ PULONG Index)
NTSYSAPI BOOLEAN NTAPI RtlFreeHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
unsigned short USHORT
Definition: pedump.c:61
ULONG Flags
Definition: rtltypes.h:1244
unsigned int ULONG
Definition: retypes.h:1
Definition: rtltypes.h:1240
RTL_HANDLE_TABLE_ENTRY Handle
Definition: libsupp.c:357
base of all file and directory entries
Definition: entries.h:82

Referenced by RtlAddAtomToAtomTable().

◆ RtlpCreateAtomHandleTable()

BOOLEAN RtlpCreateAtomHandleTable ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 394 of file libsupp.c.

395 {
397  sizeof(RTL_ATOM_HANDLE),
398  &AtomTable->RtlHandleTable);
399 
400  return TRUE;
401 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlInitializeHandleTable(_In_ ULONG TableSize, _In_ ULONG HandleSize, _In_ PRTL_HANDLE_TABLE HandleTable)

Referenced by RtlCreateAtomTable().

◆ RtlpDestroyAtomHandleTable()

VOID RtlpDestroyAtomHandleTable ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 404 of file libsupp.c.

405 {
406  RtlDestroyHandleTable(&AtomTable->RtlHandleTable);
407 }
NTSYSAPI VOID NTAPI RtlDestroyHandleTable(_Inout_ PRTL_HANDLE_TABLE HandleTable)

Referenced by RtlDestroyAtomTable().

◆ RtlpDestroyAtomTableLock()

VOID RtlpDestroyAtomTableLock ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 370 of file libsupp.c.

371 {
372  RtlDeleteCriticalSection(&AtomTable->CriticalSection);
373 }
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)

Referenced by RtlCreateAtomTable(), and RtlDestroyAtomTable().

◆ RtlpFreeAtomHandle()

VOID RtlpFreeAtomHandle ( PRTL_ATOM_TABLE  AtomTable,
PRTL_ATOM_TABLE_ENTRY  Entry 
)

Definition at line 442 of file libsupp.c.

443 {
444  PRTL_HANDLE_TABLE_ENTRY RtlHandleEntry;
445 
446  if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
447  (ULONG)Entry->HandleIndex,
448  &RtlHandleEntry))
449  {
450  RtlFreeHandle(&AtomTable->RtlHandleTable,
451  RtlHandleEntry);
452  }
453 }
NTSYSAPI BOOLEAN NTAPI RtlFreeHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI BOOLEAN WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE *, ULONG Index, RTL_HANDLE **)
Definition: rtltypes.h:1240
base of all file and directory entries
Definition: entries.h:82

Referenced by RtlDeleteAtomFromAtomTable(), and RtlEmptyAtomTable().

◆ RtlpFreeAtomTable()

VOID RtlpFreeAtomTable ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 418 of file libsupp.c.

419 {
420  RtlFreeHeap(RtlGetProcessHeap(),
421  0,
422  AtomTable);
423 }
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606

Referenced by RtlCreateAtomTable(), and RtlDestroyAtomTable().

◆ RtlpFreeAtomTableEntry()

VOID RtlpFreeAtomTableEntry ( PRTL_ATOM_TABLE_ENTRY  Entry)

Definition at line 434 of file libsupp.c.

435 {
436  RtlFreeHeap(RtlGetProcessHeap(),
437  0,
438  Entry);
439 }
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
base of all file and directory entries
Definition: entries.h:82

Referenced by RtlAddAtomToAtomTable(), RtlDeleteAtomFromAtomTable(), RtlDestroyAtomTable(), and RtlEmptyAtomTable().

◆ RtlpGetAtomEntry()

PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry ( PRTL_ATOM_TABLE  AtomTable,
ULONG  Index 
)

Definition at line 492 of file libsupp.c.

493 {
494  PRTL_HANDLE_TABLE_ENTRY RtlHandle;
495 
496  if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
497  Index,
498  &RtlHandle))
499  {
500  PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
501 
502  return AtomHandle->AtomEntry;
503  }
504 
505  return NULL;
506 }
struct _RTL_ATOM_HANDLE * PRTL_ATOM_HANDLE
smooth NULL
Definition: ftsmooth.c:416
PRTL_ATOM_TABLE_ENTRY AtomEntry
Definition: libsupp.c:358
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSYSAPI BOOLEAN WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE *, ULONG Index, RTL_HANDLE **)
Definition: rtltypes.h:1240

Referenced by RtlDeleteAtomFromAtomTable(), RtlPinAtomInAtomTable(), and RtlQueryAtomInAtomTable().

◆ RtlpHashAtomName()

static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName ( IN PRTL_ATOM_TABLE  AtomTable,
IN PWSTR  AtomName,
OUT PRTL_ATOM_TABLE_ENTRY **  HashLink 
)
static

Definition at line 39 of file atom.c.

43 {
45  ULONG Hash;
46 
47  RtlInitUnicodeString(&Name, AtomName);
48 
49  if (Name.Length != 0 &&
51  TRUE,
53  &Hash)))
54  {
55  PRTL_ATOM_TABLE_ENTRY Current;
57 
58  Link = &AtomTable->Buckets[Hash % AtomTable->NumberOfBuckets];
59 
60  /* search for an existing entry */
61  Current = *Link;
62  while (Current != NULL)
63  {
64  if (Current->NameLength == Name.Length / sizeof(WCHAR) &&
65  !_wcsicmp(Current->Name, Name.Buffer))
66  {
67  *HashLink = Link;
68  return Current;
69  }
70 
71  Link = &Current->HashLink;
72  Current = Current->HashLink;
73  }
74 
75  /* no matching atom found, return the hash link */
76  *HashLink = Link;
77  }
78  else
79  *HashLink = NULL;
80 
81  return NULL;
82 }
static int Hash(const char *)
Definition: reader.c:2257
Definition: rtltypes.h:1642
#define TRUE
Definition: types.h:120
UCHAR NameLength
Definition: rtltypes.h:1649
static int Link(const char **args)
Definition: vfdcmd.c:2414
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
WCHAR Name[1]
Definition: rtltypes.h:1650
struct _RTL_ATOM_TABLE_ENTRY * HashLink
Definition: rtltypes.h:1644
NTSYSAPI NTSTATUS NTAPI RtlHashUnicodeString(_In_ CONST UNICODE_STRING *String, _In_ BOOLEAN CaseInSensitive, _In_ ULONG HashAlgorithm, _Out_ PULONG HashValue)
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define HASH_STRING_ALGORITHM_X65599
Definition: rtlstr.c:33
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by RtlAddAtomToAtomTable(), RtlDeleteAtomFromAtomTable(), and RtlLookupAtomInAtomTable().

◆ RtlPinAtomInAtomTable()

NTSTATUS NTAPI RtlPinAtomInAtomTable ( IN PRTL_ATOM_TABLE  AtomTable,
IN RTL_ATOM  Atom 
)

Definition at line 546 of file atom.c.

548 {
550 
551  DPRINT("RtlPinAtomInAtomTable (AtomTable %p Atom %x)\n",
552  AtomTable, Atom);
553 
554  if (Atom >= 0xC000)
555  {
557 
558  RtlpLockAtomTable(AtomTable);
559 
560  Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
561 
562  if (Entry != NULL && Entry->Atom == (USHORT)Atom)
563  {
564  Entry->Flags |= RTL_ATOM_IS_PINNED;
565  }
566  else
567  {
569  }
570 
571  RtlpUnlockAtomTable(AtomTable);
572  }
573 
574  return Status;
575 }
Definition: rtltypes.h:1642
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
_Out_ RTL_ATOM * Atom
Definition: class.h:54
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define RTL_ATOM_IS_PINNED
Definition: rtltypes.h:377
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:492
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82

◆ RtlpInitAtomTableLock()

NTSTATUS RtlpInitAtomTableLock ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 362 of file libsupp.c.

363 {
364  RtlInitializeCriticalSection(&AtomTable->CriticalSection);
365  return STATUS_SUCCESS;
366 }
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by RtlCreateAtomTable().

◆ RtlpLockAtomTable()

BOOLEAN RtlpLockAtomTable ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 377 of file libsupp.c.

378 {
379  RtlEnterCriticalSection(&AtomTable->CriticalSection);
380  return TRUE;
381 }
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)

Referenced by RtlAddAtomToAtomTable(), RtlDeleteAtomFromAtomTable(), RtlDestroyAtomTable(), RtlEmptyAtomTable(), RtlLookupAtomInAtomTable(), RtlPinAtomInAtomTable(), RtlQueryAtomInAtomTable(), and RtlQueryAtomListInAtomTable().

◆ RtlpUnlockAtomTable()

VOID RtlpUnlockAtomTable ( PRTL_ATOM_TABLE  AtomTable)

Definition at line 385 of file libsupp.c.

386 {
387  RtlLeaveCriticalSection(&AtomTable->CriticalSection);
388 }
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)

Referenced by RtlAddAtomToAtomTable(), RtlDeleteAtomFromAtomTable(), RtlDestroyAtomTable(), RtlEmptyAtomTable(), RtlLookupAtomInAtomTable(), RtlPinAtomInAtomTable(), RtlQueryAtomInAtomTable(), and RtlQueryAtomListInAtomTable().

◆ RtlQueryAtomInAtomTable()

NTSTATUS NTAPI RtlQueryAtomInAtomTable ( PRTL_ATOM_TABLE  AtomTable,
RTL_ATOM  Atom,
PULONG  RefCount,
PULONG  PinCount,
PWSTR  AtomName,
PULONG  NameLength 
)

Definition at line 600 of file atom.c.

607 {
608  ULONG Length;
609  BOOL Unlock = FALSE;
610 
611  union
612  {
613  /* A RTL_ATOM_TABLE_ENTRY has a "WCHAR Name[1]" entry at the end.
614  * Make sure we reserve enough room to facilitate a 12 character name */
615  RTL_ATOM_TABLE_ENTRY AtomTableEntry;
616  WCHAR StringBuffer[sizeof(RTL_ATOM_TABLE_ENTRY) / sizeof(WCHAR) + 12];
617  } NumberEntry;
620 
621  if (Atom < 0xC000)
622  {
623  /* Synthesize an entry */
624  NumberEntry.AtomTableEntry.Atom = Atom;
625  NumberEntry.AtomTableEntry.NameLength = swprintf(NumberEntry.AtomTableEntry.Name,
626  L"#%lu",
627  (ULONG)Atom);
628  NumberEntry.AtomTableEntry.ReferenceCount = 1;
629  NumberEntry.AtomTableEntry.Flags = RTL_ATOM_IS_PINNED;
630  Entry = &NumberEntry.AtomTableEntry;
631  }
632  else
633  {
634  RtlpLockAtomTable(AtomTable);
635  Unlock = TRUE;
636 
637  Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
638  }
639 
640  if (Entry != NULL && Entry->Atom == (USHORT)Atom)
641  {
642  DPRINT("Atom name: %wZ\n", &Entry->Name);
643 
644  if (RefCount != NULL)
645  {
646  *RefCount = Entry->ReferenceCount;
647  }
648 
649  if (PinCount != NULL)
650  {
651  *PinCount = ((Entry->Flags & RTL_ATOM_IS_PINNED) != 0);
652  }
653 
654  if (NULL != NameLength)
655  {
656  Length = Entry->NameLength * sizeof(WCHAR);
657  if (NULL != AtomName)
658  {
659  if (*NameLength < Length + sizeof(WCHAR))
660  {
661  if (*NameLength < 4)
662  {
663  *NameLength = Length;
665  }
666  else
667  {
668  Length = *NameLength - sizeof(WCHAR);
669  }
670  }
671  if (NT_SUCCESS(Status))
672  {
673  RtlCopyMemory(AtomName, Entry->Name, Length);
674  AtomName[Length / sizeof(WCHAR)] = L'\0';
675  *NameLength = Length;
676  }
677  }
678  else
679  {
680  *NameLength = Length;
681  }
682  }
683  else if (NULL != AtomName)
684  {
686  }
687  }
688  else
689  {
691  }
692 
693  if (Unlock) RtlpUnlockAtomTable(AtomTable);
694 
695  return Status;
696 }
Definition: rtltypes.h:1642
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _Entry Entry
Definition: kefuncs.h:640
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_Out_ RTL_ATOM * Atom
Definition: class.h:54
_In_ const GUID _In_ ULONG PinCount
Definition: strmini.h:504
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define RTL_ATOM_IS_PINNED
Definition: rtltypes.h:377
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:492
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
struct _RTL_ATOM_TABLE_ENTRY RTL_ATOM_TABLE_ENTRY
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
base of all file and directory entries
Definition: entries.h:82

Referenced by InternalGetAtomName(), and NtQueryInformationAtom().

◆ RtlQueryAtomListInAtomTable()

NTSTATUS NTAPI RtlQueryAtomListInAtomTable ( IN PRTL_ATOM_TABLE  AtomTable,
IN ULONG  MaxAtomCount,
OUT ULONG AtomCount,
OUT RTL_ATOM AtomList 
)

Definition at line 704 of file atom.c.

709 {
710  PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
711  PRTL_ATOM_TABLE_ENTRY CurrentEntry;
712  ULONG Atoms = 0;
714 
715  RtlpLockAtomTable(AtomTable);
716 
717  LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
718  for (CurrentBucket = AtomTable->Buckets;
719  CurrentBucket != LastBucket;
720  CurrentBucket++)
721  {
722  CurrentEntry = *CurrentBucket;
723 
724  while (CurrentEntry != NULL)
725  {
726  if (MaxAtomCount > 0)
727  {
728  *(AtomList++) = (RTL_ATOM)CurrentEntry->Atom;
729  MaxAtomCount--;
730  }
731  else
732  {
733  /* buffer too small, but don't bail. we need to determine the
734  total number of atoms in the table! */
736  }
737 
738  Atoms++;
739  CurrentEntry = CurrentEntry->HashLink;
740  }
741  }
742 
743  *AtomCount = Atoms;
744 
745  RtlpUnlockAtomTable(AtomTable);
746 
747  return Status;
748 }
Definition: rtltypes.h:1642
unsigned short RTL_ATOM
Definition: atom.c:42
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
USHORT Atom
Definition: rtltypes.h:1646
smooth NULL
Definition: ftsmooth.c:416
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
Status
Definition: gdiplustypes.h:24
struct _RTL_ATOM_TABLE_ENTRY * HashLink
Definition: rtltypes.h:1644
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NtQueryInformationAtom().