diff --git a/sdk/lib/cmlib/hivebin.c b/sdk/lib/cmlib/hivebin.c index f3e33028c3a..23ca9cb18ba 100644 --- a/sdk/lib/cmlib/hivebin.c +++ b/sdk/lib/cmlib/hivebin.c @@ -31,7 +31,7 @@ HvpAddBin( return NULL; RtlZeroMemory(Bin, BinSize); - Bin->Signature = HV_BIN_SIGNATURE; + Bin->Signature = HV_HBIN_SIGNATURE; Bin->FileOffset = RegistryHive->Storage[Storage].Length * HBLOCK_SIZE; Bin->Size = (ULONG)BinSize; diff --git a/sdk/lib/cmlib/hivedata.h b/sdk/lib/cmlib/hivedata.h index 4ac381b4f8a..1c180a6da43 100644 --- a/sdk/lib/cmlib/hivedata.h +++ b/sdk/lib/cmlib/hivedata.h @@ -43,8 +43,12 @@ #define HSECTOR_COUNT 8 #define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2) -#define HV_SIGNATURE 0x66676572 // "regf" -#define HV_BIN_SIGNATURE 0x6e696268 // "hbin" + +// +// Hive structure identifiers +// +#define HV_HBLOCK_SIGNATURE 0x66676572 // "regf" +#define HV_HBIN_SIGNATURE 0x6e696268 // "hbin" // // Hive versions @@ -110,7 +114,7 @@ typedef enum typedef struct _HBASE_BLOCK { - /* Hive identifier "regf" (0x66676572) */ + /* Hive base block identifier "regf" (0x66676572) */ ULONG Signature; /* Update counters */ @@ -161,7 +165,7 @@ C_ASSERT(sizeof(HBASE_BLOCK) == HBLOCK_SIZE); typedef struct _HBIN { - /* Bin identifier "hbin" (0x6E696268) */ + /* Hive bin identifier "hbin" (0x6E696268) */ ULONG Signature; /* Block offset of this bin */ @@ -279,7 +283,10 @@ typedef struct _DUAL typedef struct _HHIVE { + /* Hive identifier (0xBEE0BEE0) */ ULONG Signature; + + /* Callbacks */ PGET_CELL_ROUTINE GetCellRoutine; PRELEASE_CELL_ROUTINE ReleaseCellRoutine; PALLOCATE_ROUTINE Allocate; @@ -288,6 +295,7 @@ typedef struct _HHIVE PFILE_WRITE_ROUTINE FileWrite; PFILE_READ_ROUTINE FileRead; PFILE_FLUSH_ROUTINE FileFlush; + #if (NTDDI_VERSION >= NTDDI_WIN7) PVOID HiveLoadFailure; // PHIVE_LOAD_FAILURE #endif diff --git a/sdk/lib/cmlib/hiveinit.c b/sdk/lib/cmlib/hiveinit.c index 1ad182cd38a..297ae360374 100644 --- a/sdk/lib/cmlib/hiveinit.c +++ b/sdk/lib/cmlib/hiveinit.c @@ -18,7 +18,7 @@ BOOLEAN CMAPI HvpVerifyHiveHeader( IN PHBASE_BLOCK BaseBlock) { - if (BaseBlock->Signature != HV_SIGNATURE || + if (BaseBlock->Signature != HV_HBLOCK_SIGNATURE || BaseBlock->Major != HSYS_MAJOR || BaseBlock->Minor < HSYS_MINOR || BaseBlock->Type != HFILE_TYPE_PRIMARY || @@ -29,7 +29,7 @@ HvpVerifyHiveHeader( { DPRINT1("Verify Hive Header failed:\n"); DPRINT1(" Signature: 0x%x, expected 0x%x; Major: 0x%x, expected 0x%x\n", - BaseBlock->Signature, HV_SIGNATURE, BaseBlock->Major, HSYS_MAJOR); + BaseBlock->Signature, HV_HBLOCK_SIGNATURE, BaseBlock->Major, HSYS_MAJOR); DPRINT1(" Minor: 0x%x expected to be >= 0x%x; Type: 0x%x, expected 0x%x\n", BaseBlock->Minor, HSYS_MINOR, BaseBlock->Type, HFILE_TYPE_PRIMARY); DPRINT1(" Format: 0x%x, expected 0x%x; Cluster: 0x%x, expected 1\n", @@ -172,7 +172,7 @@ HvpCreateHive( /* Clear it */ RtlZeroMemory(BaseBlock, RegistryHive->BaseBlockAlloc); - BaseBlock->Signature = HV_SIGNATURE; + BaseBlock->Signature = HV_HBLOCK_SIGNATURE; BaseBlock->Major = HSYS_MAJOR; BaseBlock->Minor = HSYS_MINOR; BaseBlock->Type = HFILE_TYPE_PRIMARY; @@ -270,7 +270,7 @@ HvpInitializeMemoryHive( for (BlockIndex = 0; BlockIndex < Hive->Storage[Stable].Length; ) { Bin = (PHBIN)((ULONG_PTR)ChunkBase + (BlockIndex + 1) * HBLOCK_SIZE); - if (Bin->Signature != HV_BIN_SIGNATURE || + if (Bin->Signature != HV_HBIN_SIGNATURE || (Bin->Size % HBLOCK_SIZE) != 0) { DPRINT1("Invalid bin at BlockIndex %lu, Signature 0x%x, Size 0x%x\n",