- KEY_CELL => CM_KEY_NODE
[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 #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 #define REG_KEY_CELL_ID 0x6b6e
17 #define REG_HASH_TABLE_CELL_ID 0x666c
18 #define REG_VALUE_CELL_ID 0x6b76
19 #define REG_SECURITY_CELL_ID 0x6b73
20
21 #include <pshpack1.h>
22
23 typedef struct _CM_VIEW_OF_FILE
24 {
25 LIST_ENTRY LRUViewList;
26 LIST_ENTRY PinViewList;
27 ULONG FileOffset;
28 ULONG Size;
29 PULONG ViewAddress;
30 PVOID Bcb;
31 ULONG UseCount;
32 } CM_VIEW_OF_FILE, *PCM_VIEW_OF_FILE;
33
34 typedef struct _CHILD_LIST
35 {
36 ULONG Count;
37 HCELL_INDEX List;
38 } CHILD_LIST, *PCHILD_LIST;
39
40 typedef struct _CM_KEY_NODE
41 {
42 /* Key cell identifier "kn" (0x6b6e) */
43 USHORT Id;
44
45 /* Flags */
46 USHORT Flags;
47
48 /* Time of last flush */
49 LARGE_INTEGER LastWriteTime;
50
51 ULONG Spare;
52
53 /* BlockAddress offset of parent key cell */
54 HCELL_INDEX Parent;
55
56 /* Count of sub keys for the key in this key cell (stable & volatile) */
57 ULONG SubKeyCounts[HvMaxStorageType];
58
59 /* BlockAddress offset of has table for FIXME: subkeys/values? (stable & volatile) */
60 HCELL_INDEX SubKeyLists[HvMaxStorageType];
61
62 CHILD_LIST ValueList;
63
64 /* BlockAddress offset of security cell */
65 HCELL_INDEX SecurityKeyOffset;
66
67 /* BlockAddress offset of registry key class */
68 HCELL_INDEX ClassNameOffset;
69
70 ULONG MaxNameLen;
71 ULONG MaxClassLen;
72 ULONG MaxValueNameLen;
73 ULONG MaxValueDataLen;
74 ULONG WorkVar;
75
76 /* Size in bytes of key name */
77 USHORT NameSize;
78
79 /* Size of class name in bytes */
80 USHORT ClassSize;
81
82 /* Name of key (not zero terminated) */
83 UCHAR Name[0];
84 } CM_KEY_NODE, *PCM_KEY_NODE;
85
86 /* CM_KEY_NODE.Flags constants */
87 #define REG_KEY_VOLATILE_CELL 0x01
88 #define REG_KEY_ROOT_CELL 0x0C
89 #define REG_KEY_LINK_CELL 0x10
90 #define REG_KEY_NAME_PACKED 0x20
91
92 /*
93 * Hash record
94 *
95 * HashValue:
96 * packed name: four letters of value's name
97 * otherwise: Zero!
98 */
99 typedef struct _HASH_RECORD
100 {
101 HCELL_INDEX KeyOffset;
102 ULONG HashValue;
103 } HASH_RECORD, *PHASH_RECORD;
104
105 typedef struct _HASH_TABLE_CELL
106 {
107 USHORT Id;
108 USHORT HashTableSize;
109 HASH_RECORD Table[0];
110 } HASH_TABLE_CELL, *PHASH_TABLE_CELL;
111
112 typedef struct _VALUE_LIST_CELL
113 {
114 HCELL_INDEX ValueOffset[0];
115 } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
116
117 typedef struct _VALUE_CELL
118 {
119 USHORT Id; // "kv"
120 USHORT NameSize; // length of Name
121 ULONG DataSize; // length of datas in the cell pointed by DataOffset
122 HCELL_INDEX DataOffset;// datas are here if high bit of DataSize is set
123 ULONG DataType;
124 USHORT Flags;
125 USHORT Unused1;
126 UCHAR Name[0]; /* warning : not zero terminated */
127 } VALUE_CELL, *PVALUE_CELL;
128
129 /* VALUE_CELL.Flags constants */
130 #define REG_VALUE_NAME_PACKED 0x0001
131
132 /* VALUE_CELL.DataSize mask constants */
133 #define REG_DATA_SIZE_MASK 0x7FFFFFFF
134 #define REG_DATA_IN_OFFSET 0x80000000
135
136 typedef struct _SECURITY_CELL
137 {
138 USHORT Id; // "sk"
139 USHORT Reserved;
140 HCELL_INDEX PrevSecurityCell;
141 HCELL_INDEX NextSecurityCell;
142 ULONG RefCount;
143 ULONG SdSize;
144 UCHAR Data[0];
145 } SECURITY_CELL, *PSECURITY_CELL;
146
147 #include <poppack.h>
148
149 #endif /* CMLIB_CMDATA_H */