mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
- Put executive atom functions in the executive folder, not rtl.
- Move purecall to the executive error APIs. svn path=/trunk/; revision=18081
This commit is contained in:
parent
6279a4838f
commit
4293263024
6 changed files with 243 additions and 280 deletions
225
reactos/ntoskrnl/ex/atom.c
Normal file
225
reactos/ntoskrnl/ex/atom.c
Normal file
|
@ -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 */
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 */
|
|
@ -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 */
|
Loading…
Reference in a new issue