[CMLIB] Minor code style changes only: Use slightly more explicit signature #define names so that we know to which hive structure they correspond.

This commit is contained in:
Hermès Bélusca-Maïto 2019-02-17 01:07:56 +01:00
parent 83fdb9a6d9
commit 70180ee06a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 17 additions and 9 deletions

View file

@ -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;

View file

@ -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

View file

@ -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",