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