[PSEH3]
[reactos.git] / reactos / lib / cmlib / cmdata.h
1 /*
2 * PROJECT: registry manipulation library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
5 * Copyright 2001 - 2005 Eric Kohl
6 */
7
8 #pragma once
9
10 #define REG_INIT_BLOCK_LIST_SIZE 32
11 #define REG_INIT_HASH_TABLE_SIZE 3
12 #define REG_EXTEND_HASH_TABLE_SIZE 4
13 #define REG_VALUE_LIST_CELL_MULTIPLE 4
14 #define REG_DATA_SIZE_MASK 0x7FFFFFFF
15 #define REG_DATA_IN_OFFSET 0x80000000
16
17 //
18 // Key Types
19 //
20 #define CM_KEY_INDEX_ROOT 0x6972
21 #define CM_KEY_INDEX_LEAF 0x696c
22 #define CM_KEY_FAST_LEAF 0x666c
23 #define CM_KEY_HASH_LEAF 0x686c
24
25 //
26 // Key Signatures
27 //
28 #define CM_KEY_NODE_SIGNATURE 0x6B6E
29 #define CM_LINK_NODE_SIGNATURE 0x6B6C
30 #define CM_KEY_VALUE_SIGNATURE 0x6B76
31
32 //
33 // CM_KEY_NODE Flags
34 //
35 #define KEY_IS_VOLATILE 0x01
36 #define KEY_HIVE_EXIT 0x02
37 #define KEY_HIVE_ENTRY 0x04
38 #define KEY_NO_DELETE 0x08
39 #define KEY_SYM_LINK 0x10
40 #define KEY_COMP_NAME 0x20
41 #define KEY_PREFEF_HANDLE 0x40
42 #define KEY_VIRT_MIRRORED 0x80
43 #define KEY_VIRT_TARGET 0x100
44 #define KEY_VIRTUAL_STORE 0x200
45
46 //
47 // CM_KEY_VALUE Flags
48 //
49 #define VALUE_COMP_NAME 0x0001
50
51 #include <pshpack1.h>
52
53 //
54 // For memory-mapped Hives
55 //
56 typedef struct _CM_VIEW_OF_FILE
57 {
58 LIST_ENTRY LRUViewList;
59 LIST_ENTRY PinViewList;
60 ULONG FileOffset;
61 ULONG Size;
62 PULONG_PTR ViewAddress;
63 PVOID Bcb;
64 ULONG UseCount;
65 } CM_VIEW_OF_FILE, *PCM_VIEW_OF_FILE;
66
67 //
68 // Children of Key Notes
69 //
70 typedef struct _CHILD_LIST
71 {
72 ULONG Count;
73 HCELL_INDEX List;
74 } CHILD_LIST, *PCHILD_LIST;
75
76 //
77 // Node Key Reference to Parents
78 //
79 typedef struct _CM_KEY_REFERENCE
80 {
81 HCELL_INDEX KeyCell;
82 PHHIVE KeyHive;
83 } CM_KEY_REFERENCE, *PCM_KEY_REFERENCE;
84
85 //
86 // Node Key
87 //
88 typedef struct _CM_KEY_NODE
89 {
90 USHORT Signature;
91 USHORT Flags;
92 LARGE_INTEGER LastWriteTime;
93 ULONG Spare;
94 HCELL_INDEX Parent;
95 ULONG SubKeyCounts[HTYPE_COUNT];
96 union
97 {
98 struct
99 {
100 HCELL_INDEX SubKeyLists[HTYPE_COUNT];
101 CHILD_LIST ValueList;
102 };
103 CM_KEY_REFERENCE ChildHiveReference;
104 };
105 HCELL_INDEX Security;
106 HCELL_INDEX Class;
107 ULONG MaxNameLen;
108 ULONG MaxClassLen;
109 ULONG MaxValueNameLen;
110 ULONG MaxValueDataLen;
111 ULONG WorkVar;
112 USHORT NameLength;
113 USHORT ClassLength;
114 WCHAR Name[ANYSIZE_ARRAY];
115 } CM_KEY_NODE, *PCM_KEY_NODE;
116
117 //
118 // Value List
119 //
120 typedef struct _VALUE_LIST_CELL
121 {
122 HCELL_INDEX ValueOffset[ANYSIZE_ARRAY];
123 } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
124
125 //
126 // Value Key
127 //
128 typedef struct _CM_KEY_VALUE
129 {
130 USHORT Signature;
131 USHORT NameLength;
132 ULONG DataLength;
133 HCELL_INDEX Data;
134 ULONG Type;
135 USHORT Flags;
136 USHORT Unused1;
137 WCHAR Name[ANYSIZE_ARRAY];
138 } CM_KEY_VALUE, *PCM_KEY_VALUE;
139
140 //
141 // Security Key
142 //
143 typedef struct _CM_KEY_SECURITY
144 {
145 USHORT Signature;
146 USHORT Reserved;
147 HCELL_INDEX Flink;
148 HCELL_INDEX Blink;
149 ULONG ReferenceCount;
150 ULONG DescriptorLength;
151 //SECURITY_DESCRIPTOR_RELATIVE Descriptor;
152 UCHAR Data[ANYSIZE_ARRAY];
153 } CM_KEY_SECURITY, *PCM_KEY_SECURITY;
154
155 #include <poppack.h>
156
157 //
158 // Generic Index Entry
159 //
160 typedef struct _CM_INDEX
161 {
162 HCELL_INDEX Cell;
163 union
164 {
165 UCHAR NameHint[4];
166 ULONG HashKey;
167 };
168 } CM_INDEX, *PCM_INDEX;
169
170 //
171 // Key Index
172 //
173 typedef struct _CM_KEY_INDEX
174 {
175 USHORT Signature;
176 USHORT Count;
177 HCELL_INDEX List[ANYSIZE_ARRAY];
178 } CM_KEY_INDEX, *PCM_KEY_INDEX;
179
180 //
181 // Fast/Hash Key Index
182 //
183 typedef struct _CM_KEY_FAST_INDEX
184 {
185 USHORT Signature;
186 USHORT Count;
187 CM_INDEX List[ANYSIZE_ARRAY];
188 } CM_KEY_FAST_INDEX, *PCM_KEY_FAST_INDEX;
189
190 //
191 // Cell Data
192 //
193 typedef struct _CELL_DATA
194 {
195 union
196 {
197 CM_KEY_NODE KeyNode;
198 CM_KEY_VALUE KeyValue;
199 CM_KEY_SECURITY KeySecurity;
200 CM_KEY_INDEX KeyIndex;
201 HCELL_INDEX KeyList[ANYSIZE_ARRAY];
202 WCHAR KeyString[ANYSIZE_ARRAY];
203 } u;
204 } CELL_DATA, *PCELL_DATA;