- Implement !DeletePinned case in RtlEmptyAtomTable.
- Fix error checking in RtlAddAtomToAtomTable / RtlpCheckIntegerAtom.
Modified: trunk/reactos/lib/rtl/atom.c

Modified: trunk/reactos/lib/rtl/atom.c
--- trunk/reactos/lib/rtl/atom.c	2005-08-03 14:03:31 UTC (rev 16997)
+++ trunk/reactos/lib/rtl/atom.c	2005-08-03 14:26:56 UTC (rev 16998)
@@ -98,9 +98,6 @@
      {
         LoValue = (USHORT)((ULONG)AtomName & 0xFFFF);
 
-        if (LoValue >= 0xC000)
-          return FALSE;
-
         if (LoValue == 0)
           LoValue = 0xC000;
 
@@ -244,7 +241,7 @@
                   BOOLEAN DeletePinned)
 {
    PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
-   PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry;
+   PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry, *PtrEntry;
 
    DPRINT("RtlEmptyAtomTable (AtomTable %p DeletePinned %x)\n",
           AtomTable, DeletePinned);
@@ -261,17 +258,26 @@
         CurrentBucket++)
      {
         NextEntry = *CurrentBucket;
-        *CurrentBucket = NULL;
+        PtrEntry = CurrentBucket;
 
         while (NextEntry != NULL)
           {
              CurrentEntry = NextEntry;
              NextEntry = NextEntry->HashLink;
 
-             RtlpFreeAtomHandle(AtomTable,
-                                CurrentEntry);
+             if (DeletePinned || !(CurrentEntry->Flags & RTL_ATOM_IS_PINNED))
+               {
+                 *PtrEntry = NextEntry;
 
-             RtlpFreeAtomTableEntry(CurrentEntry);
+                 RtlpFreeAtomHandle(AtomTable,
+                                    CurrentEntry);
+
+                 RtlpFreeAtomTableEntry(CurrentEntry);
+               }
+             else
+               {
+                 PtrEntry = &CurrentEntry->HashLink;
+               }
           }
      }
 
@@ -385,7 +391,7 @@
         else
           {
              /* The caller supplied an empty atom name! */
-             Status = STATUS_INVALID_PARAMETER;
+             Status = STATUS_OBJECT_NAME_INVALID;
           }
      }