17#define INVALID_INDEX 0x80000000
19#define CmpMaxFastIndexPerHblock \
20 ((HBLOCK_SIZE - (sizeof(HBIN) + sizeof(HCELL) + \
21 FIELD_OFFSET(CM_KEY_FAST_INDEX, List))) / sizeof(CM_INDEX))
23#define CmpMaxIndexPerHblock \
24 ((HBLOCK_SIZE - (sizeof(HBIN) + sizeof(HCELL) + \
25 FIELD_OFFSET(CM_KEY_INDEX, List))) / sizeof(HCELL_INDEX) - 1)
77 ULONG ActualNameLength = 4, CompareLength, NameLength;
95 for (
i = 0;
i < 4;
i++)
101 ActualNameLength =
i;
107 NameLength = SearchName->Length /
sizeof(
WCHAR);
108 CompareLength =
min(NameLength, ActualNameLength);
111 for (
i = 0;
i < CompareLength;
i++)
114 p = SearchName->Buffer[
i];
165 LeafCell =
Index->List[
i];
181 if (
Result == 2)
goto Big;
204 if (
Result == 2)
goto Big;
260 if (
Result == 2)
goto Big;
279 if (
Result == 2)
goto Big;
315 if (
Result == 2)
goto Big;
540 LeafCell =
Index->List[
i];
545 if (Number < Leaf->
Count)
608 if (Number < Node->SubKeyCounts[
Stable])
621 else if (Hive->StorageTypeCount >
Volatile)
625 if (Number < Node->SubKeyCounts[
Volatile])
660 for (
i = 0;
i < FastIndex->Count;
i++)
663 FastEntry = &FastIndex->List[
i];
666 if (FastEntry->
HashKey == HashKey)
672 return FastEntry->
Cell;
693 for (
i = 0;
i < Hive->StorageTypeCount;
i++)
703 CellToRelease =
Parent->SubKeyLists[
i];
723 CellToRelease = SubKey;
813 IsCompressed =
FALSE;
824 if (!
Node)
goto Quickie;
827 for (
i = 0;
i < Hive->StorageTypeCount;
i++)
830 if (
Node->SubKeyCounts[
i])
834 IndexCell =
Node->SubKeyLists[
i];
846 if (!
Index)
goto Quickie;
849 CellToRelease = IndexCell;
873 if (!
Index)
goto Quickie;
876 CellToRelease =
Child;
890 if (IsCompressed) Hive->Free(SearchName.
Buffer, 0);
915 if (IsCompressed) Hive->Free(SearchName.
Buffer, 0);
979 Size = OldSize + OldSize / 2;
1094 Leaf->
List[
i] = NewKey;
1112 USHORT FirstHalf, LastHalf;
1122 LeafCell = IndexKey->
List[RootSelect];
1129 FirstHalf = (LeafKey->
Count / 2);
1130 LastHalf = LeafKey->
Count - FirstHalf;
1135 if (Hive->Version >= 5)
1159 if (NewCell ==
HCELL_NIL)
return NewCell;
1175 if (Hive->Version >= 5)
1219 if (Hive->Version >= 5)
1224 &FastLeaf->
List[FirstHalf],
1231 &LeafKey->
List[FirstHalf],
1236 if ((RootSelect + 1) < IndexKey->
Count)
1239 &IndexKey->
List[RootSelect + 1],
1249 LeafKey->
Count = FirstHalf;
1250 NewKey->
Count = LastHalf;
1256 IndexKey->
List[RootSelect + 1] = NewCell;
1314 *RootCell = &IndexKey->
List[SubKeyIndex];
1323 LeafCell = IndexKey->
List[SubKeyIndex];
1334 CurrentCell = FastLeaf->
List[0].
Cell;
1340 CurrentCell = LeafKey->
List[0];
1356 LeafCell = IndexKey->
List[SubKeyIndex];
1366 *RootCell = &IndexKey->
List[SubKeyIndex];
1371 if ((SubKeyIndex + 1) < IndexKey->
Count)
1374 LeafCell = IndexKey->
List[SubKeyIndex + 1];
1384 *RootCell = &IndexKey->
List[SubKeyIndex + 1];
1394 if (SubKeyIndex > 0)
1397 LeafCell = IndexKey->
List[SubKeyIndex - 1];
1407 *RootCell = &IndexKey->
List[SubKeyIndex - 1];
1414 LeafCell = IndexKey->
List[0];
1424 *RootCell = &IndexKey->
List[0];
1435 KeyNode->SubKeyLists[
Type],
1440 if (CurrentCell ==
HCELL_NIL)
return CurrentCell;
1443 KeyNode->SubKeyLists[
Type] = CurrentCell;
1492 IsCompressed =
TRUE;
1515 IsCompressed =
FALSE;
1555 if (Hive->Version >= 5)
1560 else if (Hive->Version >= 3)
1592 DPRINT(
"Doing Fast->Slow Leaf conversion\n");
1600 for (
i = 0;
i < OldIndex->
Count;
i++)
1646 DPRINT(
"Leaf->Root Index Conversion\n");
1674 *RootPointer = LeafCell;
1683 if (IsCompressed) Hive->Free(
Name.Buffer, 0);
1721 IsCompressed =
TRUE;
1750 IsCompressed =
FALSE;
1772 if (!Leaf)
goto Exit;
1775 CellToRelease1 = LeafCell;
1787 RootCell = LeafCell;
1790 LeafCell = ChildCell;
1792 if (!Leaf)
goto Exit;
1795 CellToRelease2 = LeafCell;
1810 if (!(--Leaf->Count))
1819 if (!(--
Root->Count))
1825 else if (RootIndex < Root->
Count)
1829 &
Root->List[RootIndex + 1],
1839 else if (LeafIndex < Leaf->
Count)
1846 &Leaf->List[LeafIndex + 1],
1854 &
Child->List[LeafIndex+1],
1871 Hive->Free(SearchName.
Buffer, 0);
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
#define OBJ_NAME_PATH_SEPARATOR
struct _CM_KEY_NODE * PCM_KEY_NODE
struct _CM_INDEX CM_INDEX
#define CM_KEY_INDEX_LEAF
#define CM_KEY_INDEX_ROOT
struct _CM_KEY_FAST_INDEX * PCM_KEY_FAST_INDEX
struct _CM_KEY_INDEX * PCM_KEY_INDEX
BOOLEAN NTAPI CmpAddSubKey(IN PHHIVE Hive, IN HCELL_INDEX Parent, IN HCELL_INDEX Child)
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
LONG NTAPI CmpCompareInIndex(IN PHHIVE Hive, IN PCUNICODE_STRING SearchName, IN ULONG Count, IN PCM_KEY_INDEX Index, IN PHCELL_INDEX SubKey)
LONG NTAPI CmpDoCompareKeyName(IN PHHIVE Hive, IN PCUNICODE_STRING SearchName, IN HCELL_INDEX Cell)
ULONG NTAPI CmpFindSubKeyInRoot(IN PHHIVE Hive, IN PCM_KEY_INDEX Index, IN PCUNICODE_STRING SearchName, IN PHCELL_INDEX SubKey)
BOOLEAN NTAPI CmpRemoveSubKey(IN PHHIVE Hive, IN HCELL_INDEX ParentKey, IN HCELL_INDEX TargetKey)
HCELL_INDEX NTAPI CmpDoFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_INDEX Index, IN ULONG Number)
HCELL_INDEX NTAPI CmpSelectLeaf(IN PHHIVE Hive, IN PCM_KEY_NODE KeyNode, IN PCUNICODE_STRING Name, IN HSTORAGE_TYPE Type, IN PHCELL_INDEX *RootCell)
HCELL_INDEX NTAPI CmpSplitLeaf(IN PHHIVE Hive, IN HCELL_INDEX RootCell, IN ULONG RootSelect, IN HSTORAGE_TYPE Type)
static HCELL_INDEX NTAPI CmpFindSubKeyByHash(IN PHHIVE Hive, IN PCM_KEY_FAST_INDEX FastIndex, IN PCUNICODE_STRING SearchName)
#define CmpMaxFastIndexPerHblock
ULONG NTAPI CmpFindSubKeyInLeaf(IN PHHIVE Hive, IN PCM_KEY_INDEX Index, IN PCUNICODE_STRING SearchName, IN PHCELL_INDEX SubKey)
#define CmpMaxIndexPerHblock
HCELL_INDEX NTAPI CmpAddToLeaf(IN PHHIVE Hive, IN HCELL_INDEX LeafCell, IN HCELL_INDEX NewKey, IN PCUNICODE_STRING Name)
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
ULONG NTAPI CmpComputeHashKey(IN ULONG Hash, IN PCUNICODE_STRING Name, IN BOOLEAN AllowSeparators)
BOOLEAN NTAPI CmpMarkIndexDirty(IN PHHIVE Hive, IN HCELL_INDEX ParentKey, IN HCELL_INDEX TargetKey)
#define HvReleaseCell(Hive, Cell)
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
BOOLEAN CMAPI HvIsCellDirty(IN PHHIVE Hive, IN HCELL_INDEX Cell)
VOID CMAPI HvFreeCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset)
LONG CMAPI HvGetCellSize(PHHIVE RegistryHive, PVOID Cell)
LONG NTAPI CmpCompareCompressedName(IN PCUNICODE_STRING SearchName, IN PWCHAR CompressedName, IN ULONG NameLength)
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
BOOLEAN CMAPI HvMarkCellDirty(PHHIVE RegistryHive, HCELL_INDEX CellOffset, BOOLEAN HoldingLock)
HCELL_INDEX CMAPI HvReallocateCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset, ULONG Size)
#define HvGetCell(Hive, Cell)
HCELL_INDEX CMAPI HvAllocateCell(PHHIVE RegistryHive, ULONG Size, HSTORAGE_TYPE Storage, IN HCELL_INDEX Vicinity)
static int Hash(const char *)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define HvGetCellType(Cell)
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
root entry for file system trees
CM_INDEX List[ANYSIZE_ARRAY]
HCELL_INDEX List[ANYSIZE_ARRAY]
WCHAR Name[ANYSIZE_ARRAY]
HCELL_INDEX SubKeyLists[HTYPE_COUNT]
ULONG SubKeyCounts[HTYPE_COUNT]
#define FIELD_OFFSET(t, f)
#define RtlMoveMemory(Destination, Source, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFCMRESLIST List
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO