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
8 #ifndef CMLIB_HIVEDATA_H
9 #define CMLIB_HIVEDATA_H
14 #define HINIT_CREATE 0
15 #define HINIT_MEMORY 1
17 #define HINIT_MEMORY_INPLACE 3
19 #define HINIT_MAPFILE 5
24 #define HIVE_VOLATILE 1
25 #define HIVE_NOLAZYFLUSH 2
26 #define HIVE_HAS_BEEN_REPLACED 4
31 #define HFILE_TYPE_PRIMARY 0
32 #define HFILE_TYPE_ALTERNATE 1
33 #define HFILE_TYPE_LOG 2
34 #define HFILE_TYPE_EXTERNAL 3
35 #define HFILE_TYPE_MAX 4
40 #define HBLOCK_SIZE 0x1000
41 #define HSECTOR_SIZE 0x200
42 #define HSECTOR_COUNT 8
44 #define HV_BLOCK_SIZE 4096
45 #define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2)
46 #define HV_SIGNATURE 0x66676572
47 #define HV_BIN_SIGNATURE 0x6e696268
54 #define HSYS_WHISTLER_BETA1 4
55 #define HSYS_WHISTLER 5
56 #define HSYS_MINOR_SUPPORTED HSYS_WHISTLER
61 #define HBASE_FORMAT_MEMORY 1
71 * A handle to cell index. The highest bit specifies the cell storage and
72 * the other bits specify index into the hive file. The value HCELL_NULL
73 * (-1) is reserved for marking invalid cells.
75 typedef ULONG HCELL_INDEX
, *PHCELL_INDEX
;
81 #define HCELL_CACHED 1
83 #define HCELL_TYPE_MASK 0x80000000
84 #define HCELL_BLOCK_MASK 0x7ffff000
85 #define HCELL_OFFSET_MASK 0x00000fff
86 #define HCELL_TYPE_SHIFT 31
87 #define HCELL_BLOCK_SHIFT 12
88 #define HCELL_OFFSET_SHIFT 0
90 #define HvGetCellType(Cell) \
91 ((ULONG)((Cell & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
100 #include <host/pshpack1.h>
102 #include <pshpack1.h>
108 * On-disk header for registry hive file.
111 typedef struct _HBASE_BLOCK
113 /* Hive identifier "regf" (0x66676572) */
122 /* When this hive file was last modified */
123 LARGE_INTEGER TimeStamp
;
125 /* Registry format major version (1) */
128 /* Registry format minor version (3)
129 Version 3 added fast indexes, version 5 has large value optimizations */
132 /* Registry file type (0 - Primary, 1 - Log) */
135 /* Registry format (1 is the only defined value so far) */
138 /* Offset into file from the byte after the end of the base block.
139 If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
140 HCELL_INDEX RootCell
;
142 /* Size of each hive block ? */
148 /* Name of hive file */
153 /* Checksum of first 0x200 bytes */
156 ULONG Reserved2
[0x37E];
159 } HBASE_BLOCK
, *PHBASE_BLOCK
;
163 /* Bin identifier "hbin" (0x6E696268) */
166 /* Block offset of this bin */
167 HCELL_INDEX FileOffset
;
169 /* Size in bytes, multiple of the block size (4KB) */
174 /* When this bin was last modified */
175 LARGE_INTEGER TimeStamp
;
177 /* ? (In-memory only) */
181 typedef struct _HCELL
183 /* <0 if used, >0 if free */
188 #include <host/poppack.h>
193 #define IsFreeCell(Cell)(Cell->Size >= 0)
194 #define IsUsedCell(Cell)(Cell->Size < 0)
196 #endif /* CMLIB_HIVEDATA_H */