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.
34 typedef ULONG HCELL_INDEX
, *PHCELL_INDEX
;
36 #define HCELL_NULL ((HCELL_INDEX)-1)
37 #define HCELL_TYPE_MASK 0x80000000
38 #define HCELL_BLOCK_MASK 0x7ffff000
39 #define HCELL_OFFSET_MASK 0x00000fff
40 #define HCELL_TYPE_SHIFT 31
41 #define HCELL_BLOCK_SHIFT 12
42 #define HCELL_OFFSET_SHIFT 0
49 * On-disk header for registry hive file.
52 typedef struct _HBASE_BLOCK
54 /* Hive identifier "regf" (0x66676572) */
63 /* When this hive file was last modified */
64 LARGE_INTEGER TimeStamp
;
66 /* Registry format major version (1) */
69 /* Registry format minor version (3)
70 Version 3 added fast indexes, version 5 has large value optimizations */
73 /* Registry file type (0 - Primary, 1 - Log) */
76 /* Registry format (1 is the only defined value so far) */
79 /* Offset into file from the byte after the end of the base block.
80 If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
83 /* Size of each hive block ? */
89 /* Name of hive file */
94 /* Checksum of first 0x200 bytes */
97 ULONG Reserved2
[0x37E];
100 } HBASE_BLOCK
, *PHBASE_BLOCK
;
104 /* Bin identifier "hbin" (0x6E696268) */
107 /* Block offset of this bin */
108 HCELL_INDEX FileOffset
;
110 /* Size in bytes, multiple of the block size (4KB) */
115 /* When this bin was last modified */
116 LARGE_INTEGER TimeStamp
;
118 /* ? (In-memory only) */
122 typedef struct _HCELL
124 /* <0 if used, >0 if free */
150 #define IsFreeCell(Cell)(Cell->Size >= 0)
151 #define IsUsedCell(Cell)(Cell->Size < 0)
153 typedef enum _HV_STORAGE_TYPE
160 #endif /* CMLIB_HIVEDATA_H */