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