ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

hivedata.h
Go to the documentation of this file.
00001 /*
00002  * PROJECT:   registry manipulation library
00003  * LICENSE:   GPL - See COPYING in the top level directory
00004  * COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
00005  *            Copyright 2001 - 2005 Eric Kohl
00006  */
00007 
00008 #pragma once
00009 
00010 //
00011 // Hive operations
00012 //
00013 #define HINIT_CREATE                                    0
00014 #define HINIT_MEMORY                                    1
00015 #define HINIT_FILE                                      2
00016 #define HINIT_MEMORY_INPLACE                            3
00017 #define HINIT_FLAT                                      4
00018 #define HINIT_MAPFILE                                   5
00019 
00020 //
00021 // Hive flags
00022 //
00023 #define HIVE_VOLATILE                                   1
00024 #define HIVE_NOLAZYFLUSH                                2
00025 #define HIVE_HAS_BEEN_REPLACED                          4
00026 #define HIVE_HAS_BEEN_FREED                             8
00027 #define HIVE_UNKNOWN                                    0x10
00028 #define HIVE_IS_UNLOADING                               0x20
00029 
00030 //
00031 // Hive types
00032 //
00033 #define HFILE_TYPE_PRIMARY                              0
00034 #define HFILE_TYPE_ALTERNATE                            1
00035 #define HFILE_TYPE_LOG                                  2
00036 #define HFILE_TYPE_EXTERNAL                             3
00037 #define HFILE_TYPE_MAX                                  4
00038 
00039 //
00040 // Hive sizes
00041 //
00042 #define HBLOCK_SIZE                                     0x1000
00043 #define HSECTOR_SIZE                                    0x200
00044 #define HSECTOR_COUNT                                   8
00045 
00046 #define HV_BLOCK_SIZE                  4096
00047 #define HV_LOG_HEADER_SIZE             FIELD_OFFSET(HBASE_BLOCK, Reserved2)
00048 #define HV_SIGNATURE                   0x66676572
00049 #define HV_BIN_SIGNATURE               0x6e696268
00050 
00051 //
00052 // Hive versions
00053 //
00054 #define HSYS_MAJOR                                      1
00055 #define HSYS_MINOR                                      3
00056 #define HSYS_WHISTLER_BETA1                             4
00057 #define HSYS_WHISTLER                                   5
00058 #define HSYS_MINOR_SUPPORTED                            HSYS_WHISTLER
00059 
00060 //
00061 // Hive formats
00062 //
00063 #define HBASE_FORMAT_MEMORY                             1
00064 
00065 //
00066 // Hive storage
00067 //
00068 #define HTYPE_COUNT 2
00069 
00077 typedef ULONG HCELL_INDEX, *PHCELL_INDEX;
00078 
00079 //
00080 // Cell Magic Values
00081 //
00082 #define HCELL_NIL                                       MAXULONG
00083 #define HCELL_CACHED                                    1
00084 
00085 #define HCELL_TYPE_MASK                0x80000000
00086 #define HCELL_BLOCK_MASK               0x7ffff000
00087 #define HCELL_OFFSET_MASK              0x00000fff
00088 #define HCELL_TYPE_SHIFT               31
00089 #define HCELL_BLOCK_SHIFT              12
00090 #define HCELL_OFFSET_SHIFT             0
00091 
00092 #define HvGetCellType(Cell)             \
00093     ((ULONG)((Cell & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
00094 #define HvGetCellBlock(Cell)            \
00095     ((ULONG)((Cell & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT))
00096 
00097 typedef enum
00098 {
00099     Stable = 0,
00100     Volatile = 1
00101 } HSTORAGE_TYPE;
00102 
00103 #include <pshpack1.h>
00104 
00111 typedef struct _HBASE_BLOCK
00112 {
00113    /* Hive identifier "regf" (0x66676572) */
00114    ULONG Signature;
00115 
00116    /* Update counter */
00117    ULONG Sequence1;
00118 
00119    /* Update counter */
00120    ULONG Sequence2;
00121 
00122    /* When this hive file was last modified */
00123    LARGE_INTEGER TimeStamp;
00124 
00125    /* Registry format major version (1) */
00126    ULONG Major;
00127 
00128    /* Registry format minor version (3)
00129       Version 3 added fast indexes, version 5 has large value optimizations */
00130    ULONG Minor;
00131 
00132    /* Registry file type (0 - Primary, 1 - Log) */
00133    ULONG Type;
00134 
00135    /* Registry format (1 is the only defined value so far) */
00136    ULONG Format;
00137 
00138    /* Offset into file from the byte after the end of the base block.
00139       If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
00140    HCELL_INDEX RootCell;
00141 
00142    /* Size of each hive block ? */
00143    ULONG Length;
00144 
00145    /* (1?) */
00146    ULONG Cluster;
00147 
00148    /* Name of hive file */
00149    CHAR FileName[64];
00150 
00151    ULONG Reserved1[99];
00152 
00153    /* Checksum of first 0x200 bytes */
00154    ULONG CheckSum;
00155 
00156    ULONG Reserved2[0x37E];
00157    ULONG BootType;
00158    ULONG BootRecover;
00159 } HBASE_BLOCK, *PHBASE_BLOCK;
00160 
00161 typedef struct _HBIN
00162 {
00163    /* Bin identifier "hbin" (0x6E696268) */
00164    ULONG Signature;
00165 
00166    /* Block offset of this bin */
00167    HCELL_INDEX FileOffset;
00168 
00169    /* Size in bytes, multiple of the block size (4KB) */
00170    ULONG Size;
00171 
00172    ULONG Reserved1[2];
00173 
00174    /* When this bin was last modified */
00175    LARGE_INTEGER TimeStamp;
00176 
00177    /* ? (In-memory only) */
00178    ULONG Spare;
00179 } HBIN, *PHBIN;
00180 
00181 typedef struct _HCELL
00182 {
00183    /* <0 if used, >0 if free */
00184    LONG Size;
00185 } HCELL, *PHCELL;
00186 
00187 #include <poppack.h>
00188 
00189 struct _HHIVE;
00190 
00191 typedef struct _CELL_DATA* (CMAPI *PGET_CELL_ROUTINE)(
00192                                                       struct _HHIVE *Hive,
00193                                                       HCELL_INDEX Cell);
00194 
00195 typedef VOID (CMAPI *PRELEASE_CELL_ROUTINE)(
00196                                             struct _HHIVE *Hive,
00197                                             HCELL_INDEX Cell);
00198 
00199 typedef PVOID (CMAPI *PALLOCATE_ROUTINE)(
00200                                          SIZE_T Size,
00201                                          BOOLEAN Paged,
00202                                          ULONG Tag);
00203 
00204 typedef VOID (CMAPI *PFREE_ROUTINE)(
00205                                     PVOID Ptr,
00206                                     ULONG Quota);
00207 
00208 typedef BOOLEAN (CMAPI *PFILE_READ_ROUTINE)(
00209                                             struct _HHIVE *RegistryHive,
00210                                             ULONG FileType,
00211                                             PULONG FileOffset,
00212                                             PVOID Buffer,
00213                                             SIZE_T BufferLength);
00214 
00215 typedef BOOLEAN (CMAPI *PFILE_WRITE_ROUTINE)(
00216                                              struct _HHIVE *RegistryHive,
00217                                              ULONG FileType,
00218                                              PULONG FileOffset,
00219                                              PVOID Buffer,
00220                                              SIZE_T BufferLength);
00221 
00222 typedef BOOLEAN (CMAPI *PFILE_SET_SIZE_ROUTINE)(
00223                                                 struct _HHIVE *RegistryHive,
00224                                                 ULONG FileType,
00225                                                 ULONG FileSize,
00226                                                 ULONG OldfileSize);
00227 
00228 typedef BOOLEAN (CMAPI *PFILE_FLUSH_ROUTINE)(
00229     struct _HHIVE *RegistryHive,
00230     ULONG FileType,
00231     PLARGE_INTEGER FileOffset,
00232     ULONG Length
00233 );
00234 
00235 typedef struct _HMAP_ENTRY
00236 {
00237     ULONG_PTR BlockAddress;
00238     ULONG_PTR BinAddress;
00239     struct _CM_VIEW_OF_FILE *CmView;
00240     ULONG MemAlloc;
00241 } HMAP_ENTRY, *PHMAP_ENTRY;
00242 
00243 typedef struct _HMAP_TABLE
00244 {
00245     HMAP_ENTRY Table[512];
00246 } HMAP_TABLE, *PHMAP_TABLE;
00247 
00248 typedef struct _HMAP_DIRECTORY
00249 {
00250     PHMAP_TABLE Directory[2048];
00251 } HMAP_DIRECTORY, *PHMAP_DIRECTORY;
00252 
00253 typedef struct _DUAL
00254 {
00255     ULONG Length;
00256     PHMAP_DIRECTORY Map;
00257     PHMAP_ENTRY BlockList; // PHMAP_TABLE SmallDir;
00258     ULONG Guard;
00259     HCELL_INDEX FreeDisplay[24]; //FREE_DISPLAY FreeDisplay[24];
00260     ULONG FreeSummary;
00261     LIST_ENTRY FreeBins;
00262 } DUAL, *PDUAL;
00263 
00264 typedef struct _HHIVE
00265 {
00266     ULONG Signature;
00267     PGET_CELL_ROUTINE GetCellRoutine;
00268     PRELEASE_CELL_ROUTINE ReleaseCellRoutine;
00269     PALLOCATE_ROUTINE Allocate;
00270     PFREE_ROUTINE Free;
00271     PFILE_READ_ROUTINE FileRead;
00272     PFILE_WRITE_ROUTINE FileWrite;
00273     PFILE_SET_SIZE_ROUTINE FileSetSize;
00274     PFILE_FLUSH_ROUTINE FileFlush;
00275     PHBASE_BLOCK BaseBlock;
00276     RTL_BITMAP DirtyVector;
00277     ULONG DirtyCount;
00278     ULONG DirtyAlloc;
00279     ULONG BaseBlockAlloc;
00280     ULONG Cluster;
00281     BOOLEAN Flat;
00282     BOOLEAN ReadOnly;
00283     BOOLEAN Log;
00284     BOOLEAN DirtyFlag;
00285     ULONG HvBinHeadersUse;
00286     ULONG HvFreeCellsUse;
00287     ULONG HvUsedcellsUse;
00288     ULONG CmUsedCellsUse;
00289     ULONG HiveFlags;
00290     ULONG LogSize;
00291     ULONG RefreshCount;
00292     ULONG StorageTypeCount;
00293     ULONG Version;
00294     DUAL Storage[HTYPE_COUNT];
00295 } HHIVE, *PHHIVE;
00296 
00297 #define IsFreeCell(Cell)(Cell->Size >= 0)
00298 #define IsUsedCell(Cell)(Cell->Size < 0)

Generated on Sun May 27 2012 04:35:57 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.