- Put executive atom functions in the executive folder, not rtl.
authorAlex Ionescu <aionescu@gmail.com>
Mon, 26 Sep 2005 05:41:35 +0000 (05:41 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Mon, 26 Sep 2005 05:41:35 +0000 (05:41 +0000)
- Move purecall to the executive error APIs.

svn path=/trunk/; revision=18081

reactos/ntoskrnl/ex/atom.c [new file with mode: 0644]
reactos/ntoskrnl/ex/error.c
reactos/ntoskrnl/include/internal/rtl.h
reactos/ntoskrnl/ntoskrnl.xml
reactos/ntoskrnl/rtl/atom.c [deleted file]
reactos/ntoskrnl/rtl/purecall.c [deleted file]

diff --git a/reactos/ntoskrnl/ex/atom.c b/reactos/ntoskrnl/ex/atom.c
new file mode 100644 (file)
index 0000000..be573da
--- /dev/null
@@ -0,0 +1,225 @@
+/*\r
+ * COPYRIGHT:       See COPYING in the top level directory\r
+ * PROJECT:         ReactOS kernel\r
+ * FILE:            ntoskrnl/ex/atom.c\r
+ * PURPOSE:         Executive Atom Functions\r
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)\r
+ *                  Gunnar Dalsnes\r
+ */\r
+\r
+/* INCLUDES *****************************************************************/\r
+\r
+#include <ntoskrnl.h>\r
+#define NDEBUG\r
+#include <internal/debug.h>\r
+\r
+/* GLOBALS ****************************************************************/\r
+\r
+/* \r
+ * FIXME: this is WRONG! The global atom table should live in the WinSta struct\r
+ * and accessed through a win32k callout (received in PsEstablishWin32Callouts)\r
+ * NOTE: There is a session/win32k global atom table also, but its private to\r
+ * win32k. Its used for RegisterWindowMessage() and for window classes.\r
+ * -Gunnar\r
+ */\r
+PRTL_ATOM_TABLE GlobalAtomTable;\r
+\r
+/* PRIVATE FUNCTIONS *********************************************************/\r
+\r
+PRTL_ATOM_TABLE\r
+NTAPI\r
+ExpGetGlobalAtomTable(VOID)\r
+{\r
+    NTSTATUS Status;\r
+\r
+    /* Return it if we have one */\r
+    if (GlobalAtomTable) return GlobalAtomTable;\r
+\r
+    /* Create it */\r
+    Status = RtlCreateAtomTable(37, &GlobalAtomTable);\r
+\r
+    /* If we couldn't create it, return NULL */\r
+    if (!NT_SUCCESS(Status)) return NULL;\r
+\r
+    /* Return the newly created one */\r
+    return GlobalAtomTable;\r
+}\r
+\r
+NTSTATUS\r
+NTAPI\r
+RtlpQueryAtomInformation(PRTL_ATOM_TABLE AtomTable,\r
+                         RTL_ATOM Atom,\r
+                         PATOM_BASIC_INFORMATION AtomInformation,\r
+                         ULONG AtomInformationLength,\r
+                         PULONG ReturnLength)\r
+{\r
+    NTSTATUS Status;\r
+    ULONG UsageCount;\r
+    ULONG Flags;\r
+    ULONG NameLength;\r
+\r
+    NameLength = AtomInformationLength - sizeof(ATOM_BASIC_INFORMATION) + sizeof(WCHAR);\r
+    Status = RtlQueryAtomInAtomTable(AtomTable,\r
+                                     Atom,\r
+                                     &UsageCount,\r
+                                     &Flags,\r
+                                     AtomInformation->Name,\r
+                                     &NameLength);\r
+\r
+    if (!NT_SUCCESS(Status)) return Status;\r
+    DPRINT("NameLength: %lu\n", NameLength);\r
+\r
+    if (ReturnLength != NULL)\r
+    {\r
+        *ReturnLength = NameLength + sizeof(ATOM_BASIC_INFORMATION);\r
+    }\r
+\r
+    if (NameLength + sizeof(ATOM_BASIC_INFORMATION) > AtomInformationLength)\r
+    {\r
+        return STATUS_INFO_LENGTH_MISMATCH;\r
+    }\r
+\r
+    AtomInformation->UsageCount = (USHORT)UsageCount;\r
+    AtomInformation->Flags = (USHORT)Flags;\r
+    AtomInformation->NameLength = (USHORT)NameLength;\r
+\r
+    return STATUS_SUCCESS;\r
+}\r
+\r
+NTSTATUS\r
+NTAPI\r
+RtlpQueryAtomTableInformation(PRTL_ATOM_TABLE AtomTable,\r
+                              RTL_ATOM Atom,\r
+                              PATOM_TABLE_INFORMATION AtomInformation,\r
+                              ULONG AtomInformationLength,\r
+                              PULONG ReturnLength)\r
+{\r
+    ULONG Length;\r
+    NTSTATUS Status;\r
+\r
+    Length = sizeof(ATOM_TABLE_INFORMATION);\r
+    DPRINT("RequiredLength: %lu\n", Length);\r
+\r
+    if (ReturnLength) *ReturnLength = Length;\r
+\r
+    if (Length > AtomInformationLength) return STATUS_INFO_LENGTH_MISMATCH;\r
+\r
+    Status = RtlQueryAtomListInAtomTable(AtomTable,\r
+                                         (AtomInformationLength - Length) /\r
+                                         sizeof(RTL_ATOM),\r
+                                         &AtomInformation->NumberOfAtoms,\r
+                                         AtomInformation->Atoms);\r
+    if (NT_SUCCESS(Status))\r
+    {\r
+        ReturnLength += AtomInformation->NumberOfAtoms * sizeof(RTL_ATOM);\r
+        if (ReturnLength != NULL) *ReturnLength = Length;\r
+    }\r
+\r
+    return Status;\r
+}\r
+\r
+/* FUNCTIONS ****************************************************************/\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+NtAddAtom(IN PWSTR AtomName,\r
+          IN ULONG AtomNameLength,\r
+          OUT PRTL_ATOM Atom)\r
+{\r
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();\r
+\r
+    /* Check for the table */\r
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;\r
+\r
+    /* FIXME: SEH! */\r
+\r
+    /* Call the worker function */\r
+    return RtlAddAtomToAtomTable(AtomTable, AtomName, Atom);\r
+}\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+NtDeleteAtom(IN RTL_ATOM Atom)\r
+{\r
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();\r
+\r
+    /* Check for valid table */\r
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;\r
+\r
+    /* Call worker function */\r
+    return RtlDeleteAtomFromAtomTable(AtomTable, Atom);\r
+}\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+NtFindAtom(IN PWSTR AtomName,\r
+           IN ULONG AtomNameLength,\r
+           OUT PRTL_ATOM Atom)\r
+{\r
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();\r
+\r
+    /* Check for valid table */\r
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;\r
+\r
+    /* FIXME: SEH!!! */\r
+\r
+    /* Call worker function */\r
+    return RtlLookupAtomInAtomTable(AtomTable, AtomName, Atom);\r
+}\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+NtQueryInformationAtom(RTL_ATOM Atom,\r
+                       ATOM_INFORMATION_CLASS AtomInformationClass,\r
+                       PVOID AtomInformation,\r
+                       ULONG AtomInformationLength,\r
+                       PULONG ReturnLength)\r
+{\r
+    PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();\r
+    NTSTATUS Status;\r
+\r
+    /* Check for valid table */\r
+    if (AtomTable == NULL) return STATUS_ACCESS_DENIED;\r
+\r
+    /* FIXME: SEH! */\r
+\r
+    /* Choose class */\r
+    switch (AtomInformationClass)\r
+    {\r
+        case AtomBasicInformation:\r
+            Status = RtlpQueryAtomInformation(AtomTable,\r
+                                              Atom,\r
+                                              AtomInformation,\r
+                                              AtomInformationLength,\r
+                                              ReturnLength);\r
+            break;\r
+\r
+        case AtomTableInformation:\r
+            Status = RtlpQueryAtomTableInformation(AtomTable,\r
+                                                   Atom,\r
+                                                   AtomInformation,\r
+                                                   AtomInformationLength,\r
+                                                   ReturnLength);\r
+            break;\r
+\r
+        default:\r
+            Status = STATUS_INVALID_INFO_CLASS;\r
+    }\r
+\r
+    /* Return to caller */\r
+    return Status;\r
+}\r
+\r
+/* EOF */\r
index c428499..83a6fd1 100644 (file)
@@ -95,7 +95,6 @@ NTSTATUS
 STDCALL
 NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
 {
-
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     NTSTATUS Status = STATUS_UNSUCCESSFUL;
 
@@ -128,4 +127,12 @@ NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
     return Status;
 }
 
+VOID
+__cdecl
+_purecall(VOID)
+{
+    /* Not supported in Kernel Mode */
+    RtlRaiseStatus(STATUS_NOT_IMPLEMENTED);
+}
+
 /* EOF */
index 5cc346f..1c76474 100644 (file)
@@ -43,6 +43,15 @@ VOID
 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 */
index 0b450cf..03b02d4 100644 (file)
                <file>debug.c</file>
        </directory>
        <directory name="ex">
+               <file>atom.c</file>
                <if property="ARCH" value="i386">
                        <directory name="i386">
                                <file>interlck.S</file>
                                <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>
diff --git a/reactos/ntoskrnl/rtl/atom.c b/reactos/ntoskrnl/rtl/atom.c
deleted file mode 100644 (file)
index cfd6a2f..0000000
+++ /dev/null
@@ -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 */
diff --git a/reactos/ntoskrnl/rtl/purecall.c b/reactos/ntoskrnl/rtl/purecall.c
deleted file mode 100644 (file)
index e905dd0..0000000
+++ /dev/null
@@ -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 */