- Put executive atom functions in the executive folder, not rtl.
- Move purecall to the executive error APIs.
Added: trunk/reactos/ntoskrnl/ex/atom.c
Modified: trunk/reactos/ntoskrnl/ex/error.c
Modified: trunk/reactos/ntoskrnl/include/internal/rtl.h
Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml
Deleted: trunk/reactos/ntoskrnl/rtl/atom.c
Deleted: trunk/reactos/ntoskrnl/rtl/purecall.c

Added: trunk/reactos/ntoskrnl/ex/atom.c
--- trunk/reactos/ntoskrnl/ex/atom.c	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/ex/atom.c	2005-09-26 05:41:35 UTC (rev 18081)
@@ -0,0 +1,225 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/ex/atom.c
+ * PURPOSE:         Executive Atom Functions
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)
+ *                  Gunnar Dalsnes
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+/* GLOBALS ****************************************************************/
+
+/* 
+ * FIXME: this is WRONG! The global atom table should live in the WinSta struct
+ * and accessed through a win32k callout (received in PsEstablishWin32Callouts)
+ * NOTE: There is a session/win32k global atom table also, but its private to
+ * win32k. Its used for RegisterWindowMessage() and for window classes.
+ * -Gunnar
+ */
+PRTL_ATOM_TABLE GlobalAtomTable;
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+PRTL_ATOM_TABLE
+NTAPI
+ExpGetGlobalAtomTable(VOID)
+{
+    NTSTATUS Status;
+
+    /* Return it if we have one */
+    if (GlobalAtomTable) return GlobalAtomTable;
+
+    /* Create it */
+    Status = RtlCreateAtomTable(37, &GlobalAtomTable);
+
+    /* If we couldn't create it, return NULL */
+    if (!NT_SUCCESS(Status)) return NULL;
+
+    /* Return the newly created one */
+    return GlobalAtomTable;
+}
+
+NTSTATUS
+NTAPI
+RtlpQueryAtomInformation(PRTL_ATOM_TABLE AtomTable,
+                         RTL_ATOM Atom,
+                         PATOM_BASIC_INFORMATION AtomInformation,
+                         ULONG AtomInformationLength,
+                         PULONG ReturnLength)
+{
+    NTSTATUS Status;
+    ULONG UsageCount;
+    ULONG Flags;
+    ULONG NameLength;
+
+    NameLength = AtomInformationLength - sizeof(ATOM_BASIC_INFORMATION) + sizeof(WCHAR);
+    Status = RtlQueryAtomInAtomTable(AtomTable,
+                                     Atom,
+                                     &UsageCount,
+                                     &Flags,
+                                     AtomInformation->Name,
+                                     &NameLength);
+
+    if (!NT_SUCCESS(Status)) return Status;
+    DPRINT("NameLength: %lu\n", NameLength);
+
+    if (ReturnLength != NULL)
+    {
+        *ReturnLength = NameLength + sizeof(ATOM_BASIC_INFORMATION);
+    }
+
+    if (NameLength + sizeof(ATOM_BASIC_INFORMATION) > AtomInformationLength)
+    {
+        return STATUS_INFO_LENGTH_MISMATCH;
+    }
+
+    AtomInformation->UsageCount = (USHORT)UsageCount;
+    AtomInformation->Flags = (USHORT)Flags;
+    AtomInformation->NameLength = (USHORT)NameLength;
+
+    return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+RtlpQueryAtomTableInformation(PRTL_ATOM_TABLE AtomTable,
+                              RTL_ATOM Atom,
+                              PATOM_TABLE_INFORMATION AtomInformation,
+                              ULONG AtomInformationLength,
+                              PULONG ReturnLength)
+{
+    ULONG Length;
+    NTSTATUS Status;
+
+    Length = sizeof(ATOM_TABLE_INFORMATION);
+    DPRINT("RequiredLength: %lu\n", Length);
+
+    if (ReturnLength) *ReturnLength = Length;
+
+    if (Length > AtomInformationLength) return STATUS_INFO_LENGTH_MISMATCH;
+
+    Status = RtlQueryAtomListInAtomTable(AtomTable,
+                                         (AtomInformationLength - Length) /
+                                         sizeof(RTL_ATOM),
+                                         &AtomInformation->NumberOfAtoms,
+                                         AtomInformation->Atoms);
+    if (NT_SUCCESS(Status))
+    {
+        ReturnLength += AtomInformation->NumberOfAtoms * sizeof(RTL_ATOM);
+        if (ReturnLength != NULL) *ReturnLength = Length;
+    }
+
+    return Status;
+}
+
+/* FUNCTIONS ****************************************************************/
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+NtAddAtom(IN PWSTR AtomName,
+          IN ULONG AtomNameLength,
+          OUT PRTL_ATOM Atom)
+{
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
+
+    /* Check for the table */
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;
+
+    /* FIXME: SEH! */
+
+    /* Call the worker function */
+    return RtlAddAtomToAtomTable(AtomTable, AtomName, Atom);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+NtDeleteAtom(IN RTL_ATOM Atom)
+{
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
+
+    /* Check for valid table */
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;
+
+    /* Call worker function */
+    return RtlDeleteAtomFromAtomTable(AtomTable, Atom);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+NtFindAtom(IN PWSTR AtomName,
+           IN ULONG AtomNameLength,
+           OUT PRTL_ATOM Atom)
+{
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
+
+    /* Check for valid table */
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;
+
+    /* FIXME: SEH!!! */
+
+    /* Call worker function */
+    return RtlLookupAtomInAtomTable(AtomTable, AtomName, Atom);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+NtQueryInformationAtom(RTL_ATOM Atom,
+                       ATOM_INFORMATION_CLASS AtomInformationClass,
+                       PVOID AtomInformation,
+                       ULONG AtomInformationLength,
+                       PULONG ReturnLength)
+{
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
+    NTSTATUS Status;
+
+    /* Check for valid table */
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;
+
+    /* FIXME: SEH! */
+
+    /* Choose class */
+    switch (AtomInformationClass)
+    {
+        case AtomBasicInformation:
+            Status = RtlpQueryAtomInformation(AtomTable,
+                                              Atom,
+                                              AtomInformation,
+                                              AtomInformationLength,
+                                              ReturnLength);
+            break;
+
+        case AtomTableInformation:
+            Status = RtlpQueryAtomTableInformation(AtomTable,
+                                                   Atom,
+                                                   AtomInformation,
+                                                   AtomInformationLength,
+                                                   ReturnLength);
+            break;
+
+        default:
+            Status = STATUS_INVALID_INFO_CLASS;
+    }
+
+    /* Return to caller */
+    return Status;
+}
+
+/* EOF */

Modified: trunk/reactos/ntoskrnl/ex/error.c
--- trunk/reactos/ntoskrnl/ex/error.c	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/ex/error.c	2005-09-26 05:41:35 UTC (rev 18081)
@@ -95,7 +95,6 @@
 STDCALL
 NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
 {
-
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_UNSUCCESSFUL;
 
@@ -128,4 +127,12 @@
     return Status;
 }
 
+VOID
+__cdecl
+_purecall(VOID)
+{
+    /* Not supported in Kernel Mode */
+    RtlRaiseStatus(STATUS_NOT_IMPLEMENTED);
+}
+
 /* EOF */

Modified: trunk/reactos/ntoskrnl/include/internal/rtl.h
--- trunk/reactos/ntoskrnl/include/internal/rtl.h	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/include/internal/rtl.h	2005-09-26 05:41:35 UTC (rev 18081)
@@ -43,6 +43,15 @@
 NTAPI
 RtlpCreateNlsSection(VOID);
 
+NTSTATUS
+NTAPI
+RtlQueryAtomListInAtomTable(
+    IN PRTL_ATOM_TABLE AtomTable,
+    IN ULONG MaxAtomCount,
+    OUT ULONG *AtomCount,
+    OUT RTL_ATOM *AtomList
+);
+
 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_NLS_H */
 
 /* EOF */

Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml
--- trunk/reactos/ntoskrnl/ntoskrnl.xml	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/ntoskrnl.xml	2005-09-26 05:41:35 UTC (rev 18081)
@@ -116,6 +116,7 @@
 		<file>debug.c</file>
 	</directory>
 	<directory name="ex">
+		<file>atom.c</file>
 		<if property="ARCH" value="i386">
 			<directory name="i386">
 				<file>interlck.S</file>
@@ -305,11 +306,9 @@
 				<file>seh.s</file>
 			</directory>
 		</if>
-		<file>atom.c</file>
 		<file>libsupp.c</file>
 		<file>misc.c</file>
 		<file>nls.c</file>
-		<file>purecall.c</file>
 		<file>regio.c</file>
 		<file>strtok.c</file>
 	</directory>

Deleted: trunk/reactos/ntoskrnl/rtl/atom.c
--- trunk/reactos/ntoskrnl/rtl/atom.c	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/rtl/atom.c	2005-09-26 05:41:35 UTC (rev 18081)
@@ -1,255 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/rtl/atom.c
- * PURPOSE:         Atom managment
- *
- * PROGRAMMERS:     No programmer listed.
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-
-/* PROTOTYPES ****************************************************************/
-
-static PRTL_ATOM_TABLE RtlpGetGlobalAtomTable(VOID);
-static NTSTATUS
-RtlpQueryAtomInformation(PRTL_ATOM_TABLE AtomTable,
-			 RTL_ATOM Atom,
-			 PATOM_BASIC_INFORMATION AtomInformation,
-			 ULONG AtomInformationLength,
-			 PULONG ReturnLength);
-static NTSTATUS
-RtlpQueryAtomTableInformation(PRTL_ATOM_TABLE AtomTable,
-			      RTL_ATOM Atom,
-			      PATOM_TABLE_INFORMATION AtomInformation,
-			      ULONG AtomInformationLength,
-			      PULONG ReturnLength);
-
-extern NTSTATUS STDCALL
-RtlQueryAtomListInAtomTable(IN PRTL_ATOM_TABLE AtomTable,
-                            IN ULONG MaxAtomCount,
-                            OUT ULONG *AtomCount,
-                            OUT RTL_ATOM *AtomList);
-
-/* GLOBALS *******************************************************************/
-
-/* FIXME: this is WRONG! The global atom table should live in the WinSta struct
- * and accessed thru win32k callouts.
- * NOTE: There is a session/win32k global atom table also, but its private to
- * win32k. Its used for RegisterWindowMessage() and for window classes.
- * -Gunnar
- */
-static PRTL_ATOM_TABLE GlobalAtomTable = NULL;
-
-/* FUNCTIONS *****************************************************************/
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-NtAddAtom(
-   IN PWSTR AtomName,
-   IN ULONG AtomNameLength,
-   OUT PRTL_ATOM Atom)
-{
-   PRTL_ATOM_TABLE AtomTable;
-
-   AtomTable = RtlpGetGlobalAtomTable();
-   if (AtomTable == NULL)
-      return STATUS_ACCESS_DENIED;
-
-   return RtlAddAtomToAtomTable(AtomTable, AtomName, Atom);
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-NtDeleteAtom(IN RTL_ATOM Atom)
-{
-   PRTL_ATOM_TABLE AtomTable;
-
-   AtomTable = RtlpGetGlobalAtomTable();
-   if (AtomTable == NULL)
-     return STATUS_ACCESS_DENIED;
-
-   return (RtlDeleteAtomFromAtomTable(AtomTable,
-				      Atom));
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-NtFindAtom(IN PWSTR AtomName,
-           IN ULONG AtomNameLength,
-	   OUT PRTL_ATOM Atom)
-{
-   PRTL_ATOM_TABLE AtomTable;
-
-   AtomTable = RtlpGetGlobalAtomTable();
-   if (AtomTable == NULL)
-     return STATUS_ACCESS_DENIED;
-
-   return (RtlLookupAtomInAtomTable(AtomTable,
-				    AtomName,
-				    Atom));
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-NtQueryInformationAtom(RTL_ATOM Atom,
-		       ATOM_INFORMATION_CLASS AtomInformationClass,
-		       PVOID AtomInformation,
-		       ULONG AtomInformationLength,
-		       PULONG ReturnLength)
-{
-   PRTL_ATOM_TABLE AtomTable;
-   NTSTATUS Status;
-
-   AtomTable = RtlpGetGlobalAtomTable();
-   if (AtomTable == NULL)
-     return STATUS_ACCESS_DENIED;
-
-   switch (AtomInformationClass)
-     {
-     case AtomBasicInformation:
-	Status = RtlpQueryAtomInformation(AtomTable,
-					  Atom,
-					  AtomInformation,
-					  AtomInformationLength,
-					  ReturnLength);
-	break;
-
-     case AtomTableInformation:
-	Status = RtlpQueryAtomTableInformation(AtomTable,
-					       Atom,
-					       AtomInformation,
-					       AtomInformationLength,
-					       ReturnLength);
-	break;
-
-     default:
-	Status = STATUS_INVALID_INFO_CLASS;
-     }
-
-   return Status;
-}
-
-
-/* INTERNAL FUNCTIONS ********************************************************/
-
-static PRTL_ATOM_TABLE
-RtlpGetGlobalAtomTable(VOID)
-{
-   NTSTATUS Status;
-
-   if (GlobalAtomTable != NULL)
-     return GlobalAtomTable;
-
-   Status = RtlCreateAtomTable(37, &GlobalAtomTable);
-   if (!NT_SUCCESS(Status))
-     return NULL;
-
-   return GlobalAtomTable;
-}
-
-static NTSTATUS
-RtlpQueryAtomInformation(PRTL_ATOM_TABLE AtomTable,
-			 RTL_ATOM Atom,
-			 PATOM_BASIC_INFORMATION AtomInformation,
-			 ULONG AtomInformationLength,
-			 PULONG ReturnLength)
-{
-   NTSTATUS Status;
-   ULONG UsageCount;
-   ULONG Flags;
-   ULONG NameLength;
-
-   NameLength = AtomInformationLength - sizeof(ATOM_BASIC_INFORMATION) + sizeof(WCHAR);
-   Status = RtlQueryAtomInAtomTable(AtomTable,
-				    Atom,
-				    &UsageCount,
-				    &Flags,
-				    AtomInformation->Name,
-				    &NameLength);
-
-   if (!NT_SUCCESS(Status))
-     {
-	return Status;
-     }
-
-   DPRINT("NameLength: %lu\n", NameLength);
-
-   if (ReturnLength != NULL)
-     {
-	*ReturnLength = NameLength + sizeof(ATOM_BASIC_INFORMATION);
-     }
-
-   if (NameLength + sizeof(ATOM_BASIC_INFORMATION) > AtomInformationLength)
-     {
-	return STATUS_INFO_LENGTH_MISMATCH;
-     }
-
-   AtomInformation->UsageCount = (USHORT)UsageCount;
-   AtomInformation->Flags = (USHORT)Flags;
-   AtomInformation->NameLength = (USHORT)NameLength;
-
-   return STATUS_SUCCESS;
-}
-
-
-static NTSTATUS
-RtlpQueryAtomTableInformation(PRTL_ATOM_TABLE AtomTable,
-			      RTL_ATOM Atom,
-			      PATOM_TABLE_INFORMATION AtomInformation,
-			      ULONG AtomInformationLength,
-			      PULONG ReturnLength)
-{
-   ULONG Length;
-   NTSTATUS Status;
-
-   Length = sizeof(ATOM_TABLE_INFORMATION);
-
-   DPRINT("RequiredLength: %lu\n", Length);
-
-   if (ReturnLength != NULL)
-     {
-	*ReturnLength = Length;
-     }
-
-   if (Length > AtomInformationLength)
-     {
-	return STATUS_INFO_LENGTH_MISMATCH;
-     }
-
-   Status = RtlQueryAtomListInAtomTable(AtomTable,
-				        (AtomInformationLength - Length) / sizeof(RTL_ATOM),
-				        &AtomInformation->NumberOfAtoms,
-				        AtomInformation->Atoms);
-   if (NT_SUCCESS(Status))
-     {
-        ReturnLength += AtomInformation->NumberOfAtoms * sizeof(RTL_ATOM);
-      
-        if (ReturnLength != NULL)
-          {
-	     *ReturnLength = Length;
-          }
-     }
-
-   return Status;
-}
-
-/* EOF */

Deleted: trunk/reactos/ntoskrnl/rtl/purecall.c
--- trunk/reactos/ntoskrnl/rtl/purecall.c	2005-09-26 05:03:28 UTC (rev 18080)
+++ trunk/reactos/ntoskrnl/rtl/purecall.c	2005-09-26 05:41:35 UTC (rev 18081)
@@ -1,22 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/rtl/purecall.c
- * PURPOSE:         No purpose listed.
- *
- * PROGRAMMERS:     Eric Kohl <ekohl@zr-online.de>
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-
-/* FUNCTIONS ****************************************************************/
-
-void _purecall(void)
-{
-  ExRaiseStatus(STATUS_NOT_IMPLEMENTED);
-}
-
-/* EOF */