mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 01:32:20 +00:00
[RTL]
Formatting, no code change. svn path=/trunk/; revision=58433
This commit is contained in:
parent
09e3d1eace
commit
74f7fce21f
1 changed files with 435 additions and 433 deletions
|
@ -33,16 +33,17 @@ extern PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG I
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static PRTL_ATOM_TABLE_ENTRY
|
static
|
||||||
RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable,
|
PRTL_ATOM_TABLE_ENTRY
|
||||||
|
RtlpHashAtomName(
|
||||||
|
IN PRTL_ATOM_TABLE AtomTable,
|
||||||
IN PWSTR AtomName,
|
IN PWSTR AtomName,
|
||||||
OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
|
OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
|
||||||
{
|
{
|
||||||
UNICODE_STRING Name;
|
UNICODE_STRING Name;
|
||||||
ULONG Hash;
|
ULONG Hash;
|
||||||
|
|
||||||
RtlInitUnicodeString(&Name,
|
RtlInitUnicodeString(&Name, AtomName);
|
||||||
AtomName);
|
|
||||||
|
|
||||||
if (Name.Length != 0 &&
|
if (Name.Length != 0 &&
|
||||||
NT_SUCCESS(RtlHashUnicodeString(&Name,
|
NT_SUCCESS(RtlHashUnicodeString(&Name,
|
||||||
|
@ -65,6 +66,7 @@ RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
*HashLink = Link;
|
*HashLink = Link;
|
||||||
return Current;
|
return Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
Link = &Current->HashLink;
|
Link = &Current->HashLink;
|
||||||
Current = Current->HashLink;
|
Current = Current->HashLink;
|
||||||
}
|
}
|
||||||
|
@ -78,8 +80,10 @@ RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static
|
||||||
RtlpCheckIntegerAtom(PWSTR AtomName,
|
BOOLEAN
|
||||||
|
RtlpCheckIntegerAtom(
|
||||||
|
PWSTR AtomName,
|
||||||
PUSHORT AtomValue)
|
PUSHORT AtomValue)
|
||||||
{
|
{
|
||||||
UNICODE_STRING AtomString;
|
UNICODE_STRING AtomString;
|
||||||
|
@ -123,8 +127,7 @@ RtlpCheckIntegerAtom(PWSTR AtomName,
|
||||||
|
|
||||||
p = AtomName;
|
p = AtomName;
|
||||||
p++;
|
p++;
|
||||||
RtlInitUnicodeString(&AtomString,
|
RtlInitUnicodeString(&AtomString, p);
|
||||||
p);
|
|
||||||
|
|
||||||
DPRINT("AtomString: %wZ\n", &AtomString);
|
DPRINT("AtomString: %wZ\n", &AtomString);
|
||||||
|
|
||||||
|
@ -141,8 +144,10 @@ RtlpCheckIntegerAtom(PWSTR AtomName,
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlCreateAtomTable(IN ULONG TableSize,
|
NTAPI
|
||||||
|
RtlCreateAtomTable(
|
||||||
|
IN ULONG TableSize,
|
||||||
IN OUT PRTL_ATOM_TABLE *AtomTable)
|
IN OUT PRTL_ATOM_TABLE *AtomTable)
|
||||||
{
|
{
|
||||||
PRTL_ATOM_TABLE Table;
|
PRTL_ATOM_TABLE Table;
|
||||||
|
@ -192,8 +197,10 @@ RtlCreateAtomTable(IN ULONG TableSize,
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable)
|
NTAPI
|
||||||
|
RtlDestroyAtomTable(
|
||||||
|
IN PRTL_ATOM_TABLE AtomTable)
|
||||||
{
|
{
|
||||||
PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
|
PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
|
||||||
PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry;
|
PRTL_ATOM_TABLE_ENTRY CurrentEntry, NextEntry;
|
||||||
|
@ -241,8 +248,10 @@ RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable)
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlEmptyAtomTable(PRTL_ATOM_TABLE AtomTable,
|
NTAPI
|
||||||
|
RtlEmptyAtomTable(
|
||||||
|
PRTL_ATOM_TABLE AtomTable,
|
||||||
BOOLEAN DeletePinned)
|
BOOLEAN DeletePinned)
|
||||||
{
|
{
|
||||||
PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
|
PRTL_ATOM_TABLE_ENTRY *CurrentBucket, *LastBucket;
|
||||||
|
@ -274,8 +283,7 @@ RtlEmptyAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
{
|
{
|
||||||
*PtrEntry = NextEntry;
|
*PtrEntry = NextEntry;
|
||||||
|
|
||||||
RtlpFreeAtomHandle(AtomTable,
|
RtlpFreeAtomHandle(AtomTable, CurrentEntry);
|
||||||
CurrentEntry);
|
|
||||||
|
|
||||||
RtlpFreeAtomTableEntry(CurrentEntry);
|
RtlpFreeAtomTableEntry(CurrentEntry);
|
||||||
}
|
}
|
||||||
|
@ -326,9 +334,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
RtlpLockAtomTable(AtomTable);
|
RtlpLockAtomTable(AtomTable);
|
||||||
|
|
||||||
/* string atom, hash it and try to find an existing atom with the same name */
|
/* string atom, hash it and try to find an existing atom with the same name */
|
||||||
Entry = RtlpHashAtomName(AtomTable,
|
Entry = RtlpHashAtomName(AtomTable, AtomName, &HashLink);
|
||||||
AtomName,
|
|
||||||
&HashLink);
|
|
||||||
|
|
||||||
if (Entry != NULL)
|
if (Entry != NULL)
|
||||||
{
|
{
|
||||||
|
@ -377,8 +383,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
AtomName,
|
AtomName,
|
||||||
(AtomNameLen + 1) * sizeof(WCHAR));
|
(AtomNameLen + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
if (RtlpCreateAtomHandle(AtomTable,
|
if (RtlpCreateAtomHandle(AtomTable, Entry))
|
||||||
Entry))
|
|
||||||
{
|
{
|
||||||
/* append the atom to the list */
|
/* append the atom to the list */
|
||||||
*HashLink = Entry;
|
*HashLink = Entry;
|
||||||
|
@ -415,8 +420,10 @@ end:
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlDeleteAtomFromAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
NTAPI
|
||||||
|
RtlDeleteAtomFromAtomTable(
|
||||||
|
IN PRTL_ATOM_TABLE AtomTable,
|
||||||
IN RTL_ATOM Atom)
|
IN RTL_ATOM Atom)
|
||||||
{
|
{
|
||||||
PRTL_ATOM_TABLE_ENTRY Entry;
|
PRTL_ATOM_TABLE_ENTRY Entry;
|
||||||
|
@ -429,8 +436,7 @@ RtlDeleteAtomFromAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
{
|
{
|
||||||
RtlpLockAtomTable(AtomTable);
|
RtlpLockAtomTable(AtomTable);
|
||||||
|
|
||||||
Entry = RtlpGetAtomEntry(AtomTable,
|
Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
|
||||||
(ULONG)((USHORT)Atom - 0xC000));
|
|
||||||
|
|
||||||
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
||||||
{
|
{
|
||||||
|
@ -446,15 +452,12 @@ RtlDeleteAtomFromAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
the hash bucket or the previous atom that links to the
|
the hash bucket or the previous atom that links to the
|
||||||
one we want to delete. This way we can easily bypass
|
one we want to delete. This way we can easily bypass
|
||||||
this item. */
|
this item. */
|
||||||
if (RtlpHashAtomName(AtomTable,
|
if (RtlpHashAtomName(AtomTable, Entry->Name, &HashLink) != NULL)
|
||||||
Entry->Name,
|
|
||||||
&HashLink) != NULL)
|
|
||||||
{
|
{
|
||||||
/* bypass this atom */
|
/* bypass this atom */
|
||||||
*HashLink = Entry->HashLink;
|
*HashLink = Entry->HashLink;
|
||||||
|
|
||||||
RtlpFreeAtomHandle(AtomTable,
|
RtlpFreeAtomHandle(AtomTable, Entry);
|
||||||
Entry);
|
|
||||||
|
|
||||||
RtlpFreeAtomTableEntry(Entry);
|
RtlpFreeAtomTableEntry(Entry);
|
||||||
}
|
}
|
||||||
|
@ -519,14 +522,13 @@ RtlLookupAtomInAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
|
|
||||||
/* string atom */
|
/* string atom */
|
||||||
Entry = RtlpHashAtomName(AtomTable,
|
Entry = RtlpHashAtomName(AtomTable, AtomName, &HashLink);
|
||||||
AtomName,
|
|
||||||
&HashLink);
|
|
||||||
if (Entry != NULL)
|
if (Entry != NULL)
|
||||||
{
|
{
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
FoundAtom = (RTL_ATOM)Entry->Atom;
|
FoundAtom = (RTL_ATOM)Entry->Atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlpUnlockAtomTable(AtomTable);
|
RtlpUnlockAtomTable(AtomTable);
|
||||||
if (NT_SUCCESS(Status) && Atom != NULL)
|
if (NT_SUCCESS(Status) && Atom != NULL)
|
||||||
{
|
{
|
||||||
|
@ -554,8 +556,7 @@ RtlPinAtomInAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
|
|
||||||
RtlpLockAtomTable(AtomTable);
|
RtlpLockAtomTable(AtomTable);
|
||||||
|
|
||||||
Entry = RtlpGetAtomEntry(AtomTable,
|
Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
|
||||||
(ULONG)((USHORT)Atom - 0xC000));
|
|
||||||
|
|
||||||
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
||||||
{
|
{
|
||||||
|
@ -593,8 +594,10 @@ RtlPinAtomInAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
* (again EXCLUDING the null terminator) is returned in NameLength, at least
|
* (again EXCLUDING the null terminator) is returned in NameLength, at least
|
||||||
* on Win2k, XP and ReactOS. NT4 will return 0 in that case.
|
* on Win2k, XP and ReactOS. NT4 will return 0 in that case.
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
NTAPI
|
||||||
|
RtlQueryAtomInAtomTable(
|
||||||
|
PRTL_ATOM_TABLE AtomTable,
|
||||||
RTL_ATOM Atom,
|
RTL_ATOM Atom,
|
||||||
PULONG RefCount,
|
PULONG RefCount,
|
||||||
PULONG PinCount,
|
PULONG PinCount,
|
||||||
|
@ -630,8 +633,7 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
RtlpLockAtomTable(AtomTable);
|
RtlpLockAtomTable(AtomTable);
|
||||||
Unlock = TRUE;
|
Unlock = TRUE;
|
||||||
|
|
||||||
Entry = RtlpGetAtomEntry(AtomTable,
|
Entry = RtlpGetAtomEntry(AtomTable, (ULONG)((USHORT)Atom - 0xC000));
|
||||||
(ULONG)((USHORT)Atom - 0xC000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
if (Entry != NULL && Entry->Atom == (USHORT)Atom)
|
||||||
|
@ -667,9 +669,7 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
}
|
}
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RtlCopyMemory(AtomName,
|
RtlCopyMemory(AtomName, Entry->Name, Length);
|
||||||
Entry->Name,
|
|
||||||
Length);
|
|
||||||
AtomName[Length / sizeof(WCHAR)] = L'\0';
|
AtomName[Length / sizeof(WCHAR)] = L'\0';
|
||||||
*NameLength = Length;
|
*NameLength = Length;
|
||||||
}
|
}
|
||||||
|
@ -698,8 +698,10 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
/*
|
/*
|
||||||
* @private - only used by NtQueryInformationAtom
|
* @private - only used by NtQueryInformationAtom
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
RtlQueryAtomListInAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
NTAPI
|
||||||
|
RtlQueryAtomListInAtomTable(
|
||||||
|
IN PRTL_ATOM_TABLE AtomTable,
|
||||||
IN ULONG MaxAtomCount,
|
IN ULONG MaxAtomCount,
|
||||||
OUT ULONG *AtomCount,
|
OUT ULONG *AtomCount,
|
||||||
OUT RTL_ATOM *AtomList)
|
OUT RTL_ATOM *AtomList)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue