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