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
11 #define HV_BLOCK_SIZE 4096
12 #define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2)
13 #define HV_SIGNATURE 0x66676572
14 #define HV_BIN_SIGNATURE 0x6e696268
16 #define HV_MAJOR_VER 1
17 #define HV_MINOR_VER 3
18 #define HV_FORMAT_MEMORY 1
20 #define HV_TYPE_PRIMARY 0
21 #define HV_TYPE_ALTERNATE 1
23 #define HV_TYPE_EXTERNAL 3
29 * A handle to cell index. The highest bit specifies the cell storage and
30 * the other bits specify index into the hive file. The value HCELL_NULL
31 * (-1) is reserved for marking invalid cells.
33 typedef ULONG HCELL_INDEX
, *PHCELL_INDEX
;
35 #define HCELL_NULL ((HCELL_INDEX)-1)
36 #define HCELL_TYPE_MASK 0x80000000
37 #define HCELL_BLOCK_MASK 0x7ffff000
38 #define HCELL_OFFSET_MASK 0x00000fff
39 #define HCELL_TYPE_SHIFT 31
40 #define HCELL_BLOCK_SHIFT 12
41 #define HCELL_OFFSET_SHIFT 0
48 * On-disk header for registry hive file.
51 typedef struct _HBASE_BLOCK
53 /* Hive identifier "regf" (0x66676572) */
62 /* When this hive file was last modified */
63 LARGE_INTEGER TimeStamp
;
65 /* Registry format major version (1) */
68 /* Registry format minor version (3)
69 Version 3 added fast indexes, version 5 has large value optimizations */
72 /* Registry file type (0 - Primary, 1 - Log) */
75 /* Registry format (1 is the only defined value so far) */
78 /* Offset into file from the byte after the end of the base block.
79 If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
82 /* Size of each hive block ? */
88 /* Name of hive file */
93 /* Checksum of first 0x200 bytes */
96 ULONG Reserved2
[0x37E];
99 } HBASE_BLOCK
, *PHBASE_BLOCK
;
103 /* Bin identifier "hbin" (0x6E696268) */
106 /* Block offset of this bin */
107 HCELL_INDEX FileOffset
;
109 /* Size in bytes, multiple of the block size (4KB) */
114 /* When this bin was last modified */
115 LARGE_INTEGER TimeStamp
;
117 /* ? (In-memory only) */
121 typedef struct _HCELL
123 /* <0 if used, >0 if free */
129 #define IsFreeCell(Cell)(Cell->Size >= 0)
130 #define IsUsedCell(Cell)(Cell->Size < 0)
132 typedef enum _HV_STORAGE_TYPE
139 #endif /* CMLIB_HIVEDATA_H */