49 if (
Name.Length != 0 &&
58 Link = &AtomTable->Buckets[
Hash % AtomTable->NumberOfBuckets];
62 while (Current !=
NULL)
95 DPRINT(
"RtlpCheckIntegerAtom(AtomName '%S' AtomValue %p)\n",
105 if (AtomValue !=
NULL)
106 *AtomValue = LoValue;
117 if (*AtomName !=
L'#')
124 if ((*
p <
L'0') || (*
p >
L'9'))
133 DPRINT(
"AtomString: %wZ\n", &AtomString);
137 DPRINT(
"LongValue: %lu\n", LongValue);
139 *AtomValue = (
USHORT)(LongValue & 0x0000FFFF);
157 DPRINT(
"RtlCreateAtomTable(TableSize %lu AtomTable %p)\n",
160 if (*AtomTable !=
NULL)
209 DPRINT(
"RtlDestroyAtomTable (AtomTable %p)\n", AtomTable);
217 LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
218 for (CurrentBucket = AtomTable->Buckets;
219 CurrentBucket != LastBucket;
222 NextEntry = *CurrentBucket;
223 *CurrentBucket =
NULL;
225 while (NextEntry !=
NULL)
227 CurrentEntry = NextEntry;
261 DPRINT(
"RtlEmptyAtomTable (AtomTable %p DeletePinned %x)\n",
262 AtomTable, DeletePinned);
270 LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
271 for (CurrentBucket = AtomTable->Buckets;
272 CurrentBucket != LastBucket;
275 NextEntry = *CurrentBucket;
276 PtrEntry = CurrentBucket;
278 while (NextEntry !=
NULL)
280 CurrentEntry = NextEntry;
285 *PtrEntry = NextEntry;
317 DPRINT(
"RtlAddAtomToAtomTable (AtomTable %p AtomName %S Atom %p)\n",
318 AtomTable, AtomName,
Atom);
323 if (AtomValue >= 0xC000)
346 if (++
Entry->ReferenceCount == 0)
363 if (HashLink !=
NULL)
374 sizeof(
Entry->Name) +
375 (AtomNameLen + 1) *
sizeof(
WCHAR));
379 Entry->ReferenceCount = 1;
385 (AtomNameLen + 1) *
sizeof(
WCHAR));
433 DPRINT(
"RtlDeleteAtomFromAtomTable (AtomTable %p Atom %x)\n",
446 if (--
Entry->ReferenceCount == 0)
459 *HashLink =
Entry->HashLink;
504 DPRINT(
"RtlLookupAtomInAtomTable (AtomTable %p AtomName %S Atom %p)\n",
505 AtomTable, AtomName,
Atom);
510 if (AtomValue >= 0xC000)
551 DPRINT(
"RtlPinAtomInAtomTable (AtomTable %p Atom %x)\n",
624 NumberEntry.AtomTableEntry.Atom =
Atom;
625 NumberEntry.AtomTableEntry.NameLength =
swprintf(NumberEntry.AtomTableEntry.Name,
628 NumberEntry.AtomTableEntry.ReferenceCount = 1;
630 Entry = &NumberEntry.AtomTableEntry;
644 if (RefCount !=
NULL)
646 *RefCount =
Entry->ReferenceCount;
654 if (
NULL != NameLength)
657 if (
NULL != AtomName)
683 else if (
NULL != AtomName)
717 LastBucket = AtomTable->Buckets + AtomTable->NumberOfBuckets;
718 for (CurrentBucket = AtomTable->Buckets;
719 CurrentBucket != LastBucket;
722 CurrentEntry = *CurrentBucket;
724 while (CurrentEntry !=
NULL)
726 if (MaxAtomCount > 0)
739 CurrentEntry = CurrentEntry->
HashLink;
#define STATUS_INVALID_HANDLE
#define NT_SUCCESS(StatCode)
static int Hash(const char *)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct atom_table * RTL_ATOM_TABLE
unsigned short * PRTL_ATOM
struct atom_table ** PRTL_ATOM_TABLE
#define HASH_STRING_ALGORITHM_X65599
NTSYSAPI NTSTATUS NTAPI RtlHashUnicodeString(_In_ CONST UNICODE_STRING *String, _In_ BOOLEAN CaseInSensitive, _In_ ULONG HashAlgorithm, _Out_ PULONG HashValue)
NTSYSAPI NTSTATUS NTAPI RtlAddAtomToAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ PWSTR AtomName, _Out_ PRTL_ATOM Atom)
NTSYSAPI NTSTATUS NTAPI RtlLookupAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ PWSTR AtomName, _Out_ PRTL_ATOM Atom)
NTSYSAPI NTSTATUS NTAPI RtlCreateAtomTable(_In_ ULONG TableSize, _Inout_ PRTL_ATOM_TABLE *AtomTable)
NTSYSAPI NTSTATUS NTAPI RtlDeleteAtomFromAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom)
NTSYSAPI NTSTATUS NTAPI RtlQueryAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom, _Out_opt_ PULONG RefCount, _Out_opt_ PULONG PinCount, _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName, _Inout_opt_ PULONG NameLength)
struct _RTL_ATOM_TABLE_ENTRY RTL_ATOM_TABLE_ENTRY
#define RTL_MAXIMUM_ATOM_LENGTH
#define RTL_ATOM_IS_PINNED
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI RtlQueryAtomListInAtomTable(IN PRTL_ATOM_TABLE AtomTable, IN ULONG MaxAtomCount, OUT ULONG *AtomCount, OUT RTL_ATOM *AtomList)
#define STATUS_WAS_LOCKED
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
NTSTATUS NTAPI RtlEmptyAtomTable(PRTL_ATOM_TABLE AtomTable, BOOLEAN DeletePinned)
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
static PRTL_ATOM_TABLE_ENTRY RtlpHashAtomName(IN PRTL_ATOM_TABLE AtomTable, IN PWSTR AtomName, OUT PRTL_ATOM_TABLE_ENTRY **HashLink)
static BOOLEAN RtlpCheckIntegerAtom(PWSTR AtomName, PUSHORT AtomValue)
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
BOOLEAN RtlpCreateAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
NTSTATUS NTAPI RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable)
NTSTATUS RtlpInitAtomTableLock(PRTL_ATOM_TABLE AtomTable)
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size)
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
BOOLEAN RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
NTSTATUS NTAPI RtlPinAtomInAtomTable(IN PRTL_ATOM_TABLE AtomTable, IN RTL_ATOM Atom)
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
#define STATUS_BUFFER_TOO_SMALL
_In_ const GUID _In_ ULONG PinCount
base of all file and directory entries
struct _RTL_ATOM_TABLE_ENTRY * HashLink
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_INFO_LENGTH_MISMATCH
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_OBJECT_NAME_NOT_FOUND
static int Link(const char **args)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ typedef _Out_ PULONG TableSize