Author: hbelusca
Date: Sat Jan 9 23:15:05 2016
New Revision: 70561
URL:
http://svn.reactos.org/svn/reactos?rev=70561&view=rev
Log:
[CMLIB]
- HV_BLOCK_SIZE and HBLOCK_SIZE are the same thing; prefer the newly introduced
HBLOCK_SIZE define.
- Improve the HvGetCell* macros.
- Add next to the defined hive signatures what their corresponding strings are (for
documentation purpose).
- Some whitespace fixes in the headers.
Modified:
trunk/reactos/lib/cmlib/cmdata.h
trunk/reactos/lib/cmlib/hivebin.c
trunk/reactos/lib/cmlib/hivecell.c
trunk/reactos/lib/cmlib/hivedata.h
trunk/reactos/lib/cmlib/hiveinit.c
trunk/reactos/lib/cmlib/hivewrt.c
Modified: trunk/reactos/lib/cmlib/cmdata.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmdata.h?rev=705…
==============================================================================
--- trunk/reactos/lib/cmlib/cmdata.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/cmdata.h [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -7,53 +7,53 @@
#pragma once
-#define REG_INIT_BLOCK_LIST_SIZE 32
-#define REG_INIT_HASH_TABLE_SIZE 3
-#define REG_EXTEND_HASH_TABLE_SIZE 4
-#define REG_VALUE_LIST_CELL_MULTIPLE 4
-#define REG_DATA_SIZE_MASK 0x7FFFFFFF
-#define REG_DATA_IN_OFFSET 0x80000000
+#define REG_INIT_BLOCK_LIST_SIZE 32
+#define REG_INIT_HASH_TABLE_SIZE 3
+#define REG_EXTEND_HASH_TABLE_SIZE 4
+#define REG_VALUE_LIST_CELL_MULTIPLE 4
+#define REG_DATA_SIZE_MASK 0x7FFFFFFF
+#define REG_DATA_IN_OFFSET 0x80000000
//
// Key Types
//
-#define CM_KEY_INDEX_ROOT 0x6972
-#define CM_KEY_INDEX_LEAF 0x696c
-#define CM_KEY_FAST_LEAF 0x666c
-#define CM_KEY_HASH_LEAF 0x686c
+#define CM_KEY_INDEX_ROOT 0x6972 // "ri"
+#define CM_KEY_INDEX_LEAF 0x696c // "li"
+#define CM_KEY_FAST_LEAF 0x666c // "lf"
+#define CM_KEY_HASH_LEAF 0x686c // "lh"
//
// Key Signatures
//
-#define CM_KEY_NODE_SIGNATURE 0x6B6E
-#define CM_LINK_NODE_SIGNATURE 0x6B6C
-#define CM_KEY_VALUE_SIGNATURE 0x6B76
+#define CM_KEY_NODE_SIGNATURE 0x6B6E // "nk"
+#define CM_LINK_NODE_SIGNATURE 0x6B6C // "lk"
+#define CM_KEY_VALUE_SIGNATURE 0x6B76 // "vk"
//
// CM_KEY_NODE Flags
//
-#define KEY_IS_VOLATILE 0x01
-#define KEY_HIVE_EXIT 0x02
-#define KEY_HIVE_ENTRY 0x04
-#define KEY_NO_DELETE 0x08
-#define KEY_SYM_LINK 0x10
-#define KEY_COMP_NAME 0x20
-#define KEY_PREFEF_HANDLE 0x40
-#define KEY_VIRT_MIRRORED 0x80
-#define KEY_VIRT_TARGET 0x100
-#define KEY_VIRTUAL_STORE 0x200
+#define KEY_IS_VOLATILE 0x01
+#define KEY_HIVE_EXIT 0x02
+#define KEY_HIVE_ENTRY 0x04
+#define KEY_NO_DELETE 0x08
+#define KEY_SYM_LINK 0x10
+#define KEY_COMP_NAME 0x20
+#define KEY_PREFEF_HANDLE 0x40
+#define KEY_VIRT_MIRRORED 0x80
+#define KEY_VIRT_TARGET 0x100
+#define KEY_VIRTUAL_STORE 0x200
//
// CM_KEY_VALUE Flags
//
-#define VALUE_COMP_NAME 0x0001
+#define VALUE_COMP_NAME 0x0001
//
// CM_KEY_VALUE Types
//
-#define CM_KEY_VALUE_SMALL 0x4
-#define CM_KEY_VALUE_BIG 0x3FD8
-#define CM_KEY_VALUE_SPECIAL_SIZE 0x80000000
+#define CM_KEY_VALUE_SMALL 0x4
+#define CM_KEY_VALUE_BIG 0x3FD8
+#define CM_KEY_VALUE_SPECIAL_SIZE 0x80000000
#include <pshpack1.h>
Modified: trunk/reactos/lib/cmlib/hivebin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivebin.c?rev=70…
==============================================================================
--- trunk/reactos/lib/cmlib/hivebin.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivebin.c [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -23,8 +23,8 @@
ULONG OldBlockListSize;
PHCELL Block;
- BinSize = ROUND_UP(Size + sizeof(HBIN), HV_BLOCK_SIZE);
- BlockCount = (ULONG)(BinSize / HV_BLOCK_SIZE);
+ BinSize = ROUND_UP(Size + sizeof(HBIN), HBLOCK_SIZE);
+ BlockCount = (ULONG)(BinSize / HBLOCK_SIZE);
Bin = RegistryHive->Allocate(BinSize, TRUE, TAG_CM);
if (Bin == NULL)
@@ -33,7 +33,7 @@
Bin->Signature = HV_BIN_SIGNATURE;
Bin->FileOffset = RegistryHive->Storage[Storage].Length *
- HV_BLOCK_SIZE;
+ HBLOCK_SIZE;
Bin->Size = (ULONG)BinSize;
/* Allocate new block list */
@@ -61,7 +61,7 @@
for (i = 0; i < BlockCount; i++)
{
RegistryHive->Storage[Storage].BlockList[OldBlockListSize + i].BlockAddress =
- ((ULONG_PTR)Bin + (i * HV_BLOCK_SIZE));
+ ((ULONG_PTR)Bin + (i * HBLOCK_SIZE));
RegistryHive->Storage[Storage].BlockList[OldBlockListSize + i].BinAddress =
(ULONG_PTR)Bin;
}
@@ -96,7 +96,7 @@
/* Mark new bin dirty. */
RtlSetBits(&RegistryHive->DirtyVector,
- Bin->FileOffset / HV_BLOCK_SIZE,
+ Bin->FileOffset / HBLOCK_SIZE,
BlockCount);
/* Update size in the base block */
Modified: trunk/reactos/lib/cmlib/hivecell.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivecell.c?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hivecell.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivecell.c [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -37,7 +37,7 @@
else
{
ASSERT((CellIndex & HCELL_TYPE_MASK) == Stable);
- return (PVOID)((ULONG_PTR)RegistryHive->BaseBlock + HV_BLOCK_SIZE +
+ return (PVOID)((ULONG_PTR)RegistryHive->BaseBlock + HBLOCK_SIZE +
CellIndex);
}
}
@@ -117,7 +117,7 @@
return TRUE;
CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
- CellLastBlock = ((CellIndex + HV_BLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >>
HCELL_BLOCK_SHIFT;
+ CellLastBlock = ((CellIndex + HBLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >>
HCELL_BLOCK_SHIFT;
RtlSetBits(&RegistryHive->DirtyVector,
CellBlock, CellLastBlock - CellBlock);
@@ -139,7 +139,7 @@
return TRUE;
/* Check if the dirty bit is set */
- if (RtlCheckBit(&Hive->DirtyVector, Cell / HV_BLOCK_SIZE))
+ if (RtlCheckBit(&Hive->DirtyVector, Cell / HBLOCK_SIZE))
IsDirty = TRUE;
/* Return result as boolean*/
@@ -322,7 +322,7 @@
}
}
- BlockIndex += Bin->Size / HV_BLOCK_SIZE;
+ BlockIndex += Bin->Size / HBLOCK_SIZE;
BlockOffset += Bin->Size;
}
Modified: trunk/reactos/lib/cmlib/hivedata.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -10,61 +10,60 @@
//
// Hive operations
//
-#define HINIT_CREATE 0
-#define HINIT_MEMORY 1
-#define HINIT_FILE 2
-#define HINIT_MEMORY_INPLACE 3
-#define HINIT_FLAT 4
-#define HINIT_MAPFILE 5
+#define HINIT_CREATE 0
+#define HINIT_MEMORY 1
+#define HINIT_FILE 2
+#define HINIT_MEMORY_INPLACE 3
+#define HINIT_FLAT 4
+#define HINIT_MAPFILE 5
//
// Hive flags
//
-#define HIVE_VOLATILE 1
-#define HIVE_NOLAZYFLUSH 2
-#define HIVE_HAS_BEEN_REPLACED 4
-#define HIVE_HAS_BEEN_FREED 8
-#define HIVE_UNKNOWN 0x10
-#define HIVE_IS_UNLOADING 0x20
+#define HIVE_VOLATILE 1
+#define HIVE_NOLAZYFLUSH 2
+#define HIVE_HAS_BEEN_REPLACED 4
+#define HIVE_HAS_BEEN_FREED 8
+#define HIVE_UNKNOWN 0x10
+#define HIVE_IS_UNLOADING 0x20
//
// Hive types
//
-#define HFILE_TYPE_PRIMARY 0
-#define HFILE_TYPE_LOG 1
-#define HFILE_TYPE_EXTERNAL 2
-#define HFILE_TYPE_MAX 3
+#define HFILE_TYPE_PRIMARY 0
+#define HFILE_TYPE_LOG 1
+#define HFILE_TYPE_EXTERNAL 2
+#define HFILE_TYPE_MAX 3
//
// Hive sizes
//
-#define HBLOCK_SIZE 0x1000
-#define HSECTOR_SIZE 0x200
-#define HSECTOR_COUNT 8
-
-#define HV_BLOCK_SIZE 4096
-#define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2)
-#define HV_SIGNATURE 0x66676572
-#define HV_BIN_SIGNATURE 0x6e696268
+#define HBLOCK_SIZE 0x1000
+#define HSECTOR_SIZE 0x200
+#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 versions
//
-#define HSYS_MAJOR 1
-#define HSYS_MINOR 3
-#define HSYS_WHISTLER_BETA1 4
-#define HSYS_WHISTLER 5
-#define HSYS_MINOR_SUPPORTED HSYS_WHISTLER
+#define HSYS_MAJOR 1
+#define HSYS_MINOR 3
+#define HSYS_WHISTLER_BETA1 4
+#define HSYS_WHISTLER 5
+#define HSYS_MINOR_SUPPORTED HSYS_WHISTLER
//
// Hive formats
//
-#define HBASE_FORMAT_MEMORY 1
+#define HBASE_FORMAT_MEMORY 1
//
// Hive storage
//
-#define HTYPE_COUNT 2
+#define HTYPE_COUNT 2
/**
* @name HCELL_INDEX
@@ -78,24 +77,24 @@
//
// Cell Magic Values
//
-#define HCELL_NIL MAXULONG
-#define HCELL_CACHED 1
-
-#define HCELL_TYPE_MASK 0x80000000
-#define HCELL_BLOCK_MASK 0x7ffff000
-#define HCELL_OFFSET_MASK 0x00000fff
-#define HCELL_TYPE_SHIFT 31
-#define HCELL_BLOCK_SHIFT 12
-#define HCELL_OFFSET_SHIFT 0
+#define HCELL_NIL MAXULONG
+#define HCELL_CACHED 1
+
+#define HCELL_TYPE_MASK 0x80000000
+#define HCELL_BLOCK_MASK 0x7ffff000
+#define HCELL_OFFSET_MASK 0x00000fff
+#define HCELL_TYPE_SHIFT 31
+#define HCELL_BLOCK_SHIFT 12
+#define HCELL_OFFSET_SHIFT 0
#define HvGetCellType(Cell) \
- ((ULONG)((Cell & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
+ ((ULONG)(((Cell) & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
#define HvGetCellBlock(Cell) \
- ((ULONG)((Cell & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT))
+ ((ULONG)(((Cell) & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT))
typedef enum
{
- Stable = 0,
+ Stable = 0,
Volatile = 1
} HSTORAGE_TYPE;
@@ -107,127 +106,142 @@
* On-disk header for registry hive file.
*/
-#define HIVE_FILENAME_MAXLEN 31
+#define HIVE_FILENAME_MAXLEN 31
typedef struct _HBASE_BLOCK
{
- /* Hive identifier "regf" (0x66676572) */
- ULONG Signature;
-
- /* Update counter */
- ULONG Sequence1;
-
- /* Update counter */
- ULONG Sequence2;
-
- /* When this hive file was last modified */
- LARGE_INTEGER TimeStamp;
-
- /* Registry format major version (1) */
- ULONG Major;
-
- /* Registry format minor version (3)
- Version 3 added fast indexes, version 5 has large value optimizations */
- ULONG Minor;
-
- /* Registry file type (0 - Primary, 1 - Log) */
- ULONG Type;
-
- /* Registry format (1 is the only defined value so far) */
- ULONG Format;
-
- /* Offset into file from the byte after the end of the base block.
- If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
- HCELL_INDEX RootCell;
-
- /* Size of each hive block ? */
- ULONG Length;
-
- /* (1?) */
- ULONG Cluster;
-
- /* Last 31 UNICODE characters, plus terminating NULL character,
- of the full name of the hive file */
- WCHAR FileName[HIVE_FILENAME_MAXLEN + 1];
-
- ULONG Reserved1[99];
-
- /* Checksum of first 0x200 bytes */
- ULONG CheckSum;
-
- ULONG Reserved2[0x37E];
- ULONG BootType;
- ULONG BootRecover;
+ /* Hive identifier "regf" (0x66676572) */
+ ULONG Signature;
+
+ /* Update counter */
+ ULONG Sequence1;
+
+ /* Update counter */
+ ULONG Sequence2;
+
+ /* When this hive file was last modified */
+ LARGE_INTEGER TimeStamp;
+
+ /* Registry format major version (1) */
+ ULONG Major;
+
+ /* Registry format minor version (3)
+ Version 3 added fast indexes, version 5 has large value optimizations */
+ ULONG Minor;
+
+ /* Registry file type (0 - Primary, 1 - Log) */
+ ULONG Type;
+
+ /* Registry format (1 is the only defined value so far) */
+ ULONG Format;
+
+ /* Offset into file from the byte after the end of the base block.
+ If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
+ HCELL_INDEX RootCell;
+
+ /* Size of each hive block ? */
+ ULONG Length;
+
+ /* (1?) */
+ ULONG Cluster;
+
+ /* Last 31 UNICODE characters, plus terminating NULL character,
+ of the full name of the hive file */
+ WCHAR FileName[HIVE_FILENAME_MAXLEN + 1];
+
+ ULONG Reserved1[99];
+
+ /* Checksum of first 0x200 bytes */
+ ULONG CheckSum;
+
+ ULONG Reserved2[0x37E];
+ ULONG BootType;
+ ULONG BootRecover;
} HBASE_BLOCK, *PHBASE_BLOCK;
typedef struct _HBIN
{
- /* Bin identifier "hbin" (0x6E696268) */
- ULONG Signature;
-
- /* Block offset of this bin */
- HCELL_INDEX FileOffset;
-
- /* Size in bytes, multiple of the block size (4KB) */
- ULONG Size;
-
- ULONG Reserved1[2];
-
- /* When this bin was last modified */
- LARGE_INTEGER TimeStamp;
-
- /* ? (In-memory only) */
- ULONG Spare;
+ /* Bin identifier "hbin" (0x6E696268) */
+ ULONG Signature;
+
+ /* Block offset of this bin */
+ HCELL_INDEX FileOffset;
+
+ /* Size in bytes, multiple of the block size (4KB) */
+ ULONG Size;
+
+ ULONG Reserved1[2];
+
+ /* When this bin was last modified */
+ LARGE_INTEGER TimeStamp;
+
+ /* Unused (In-memory only) */
+ ULONG Spare;
} HBIN, *PHBIN;
typedef struct _HCELL
{
- /* <0 if used, >0 if free */
- LONG Size;
+ /* <0 if used, >0 if free */
+ LONG Size;
} HCELL, *PHCELL;
#include <poppack.h>
struct _HHIVE;
-typedef struct _CELL_DATA* (CMAPI *PGET_CELL_ROUTINE)(
- struct _HHIVE *Hive,
- HCELL_INDEX Cell);
-
-typedef VOID (CMAPI *PRELEASE_CELL_ROUTINE)(
- struct _HHIVE *Hive,
- HCELL_INDEX Cell);
-
-typedef PVOID (CMAPI *PALLOCATE_ROUTINE)(
- SIZE_T Size,
- BOOLEAN Paged,
- ULONG Tag);
-
-typedef VOID (CMAPI *PFREE_ROUTINE)(
- PVOID Ptr,
- ULONG Quota);
-
-typedef BOOLEAN (CMAPI *PFILE_READ_ROUTINE)(
- struct _HHIVE *RegistryHive,
- ULONG FileType,
- PULONG FileOffset,
- PVOID Buffer,
- SIZE_T BufferLength);
-
-typedef BOOLEAN (CMAPI *PFILE_WRITE_ROUTINE)(
- struct _HHIVE *RegistryHive,
- ULONG FileType,
- PULONG FileOffset,
- PVOID Buffer,
- SIZE_T BufferLength);
-
-typedef BOOLEAN (CMAPI *PFILE_SET_SIZE_ROUTINE)(
- struct _HHIVE *RegistryHive,
- ULONG FileType,
- ULONG FileSize,
- ULONG OldfileSize);
-
-typedef BOOLEAN (CMAPI *PFILE_FLUSH_ROUTINE)(
+typedef struct _CELL_DATA*
+(CMAPI *PGET_CELL_ROUTINE)(
+ struct _HHIVE *Hive,
+ HCELL_INDEX Cell
+);
+
+typedef VOID
+(CMAPI *PRELEASE_CELL_ROUTINE)(
+ struct _HHIVE *Hive,
+ HCELL_INDEX Cell
+);
+
+typedef PVOID
+(CMAPI *PALLOCATE_ROUTINE)(
+ SIZE_T Size,
+ BOOLEAN Paged,
+ ULONG Tag
+);
+
+typedef VOID
+(CMAPI *PFREE_ROUTINE)(
+ PVOID Ptr,
+ ULONG Quota
+);
+
+typedef BOOLEAN
+(CMAPI *PFILE_READ_ROUTINE)(
+ struct _HHIVE *RegistryHive,
+ ULONG FileType,
+ PULONG FileOffset,
+ PVOID Buffer,
+ SIZE_T BufferLength
+);
+
+typedef BOOLEAN
+(CMAPI *PFILE_WRITE_ROUTINE)(
+ struct _HHIVE *RegistryHive,
+ ULONG FileType,
+ PULONG FileOffset,
+ PVOID Buffer,
+ SIZE_T BufferLength
+);
+
+typedef BOOLEAN
+(CMAPI *PFILE_SET_SIZE_ROUTINE)(
+ struct _HHIVE *RegistryHive,
+ ULONG FileType,
+ ULONG FileSize,
+ ULONG OldfileSize
+);
+
+typedef BOOLEAN
+(CMAPI *PFILE_FLUSH_ROUTINE)(
struct _HHIVE *RegistryHive,
ULONG FileType,
PLARGE_INTEGER FileOffset,
@@ -258,7 +272,7 @@
PHMAP_DIRECTORY Map;
PHMAP_ENTRY BlockList; // PHMAP_TABLE SmallDir;
ULONG Guard;
- HCELL_INDEX FreeDisplay[24]; //FREE_DISPLAY FreeDisplay[24];
+ HCELL_INDEX FreeDisplay[24]; // FREE_DISPLAY FreeDisplay[24];
ULONG FreeSummary;
LIST_ENTRY FreeBins;
} DUAL, *PDUAL;
@@ -296,5 +310,5 @@
DUAL Storage[HTYPE_COUNT];
} HHIVE, *PHHIVE;
-#define IsFreeCell(Cell)(Cell->Size >= 0)
-#define IsUsedCell(Cell)(Cell->Size < 0)
+#define IsFreeCell(Cell) ((Cell)->Size >= 0)
+#define IsUsedCell(Cell) ((Cell)->Size < 0)
Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -193,7 +193,7 @@
* we go.
*/
- Hive->Storage[Stable].Length = (ULONG)(ChunkSize / HV_BLOCK_SIZE);
+ Hive->Storage[Stable].Length = (ULONG)(ChunkSize / HBLOCK_SIZE);
Hive->Storage[Stable].BlockList =
Hive->Allocate(Hive->Storage[Stable].Length *
sizeof(HMAP_ENTRY), FALSE, TAG_CM);
@@ -206,9 +206,9 @@
for (BlockIndex = 0; BlockIndex < Hive->Storage[Stable].Length; )
{
- Bin = (PHBIN)((ULONG_PTR)ChunkBase + (BlockIndex + 1) * HV_BLOCK_SIZE);
+ Bin = (PHBIN)((ULONG_PTR)ChunkBase + (BlockIndex + 1) * HBLOCK_SIZE);
if (Bin->Signature != HV_BIN_SIGNATURE ||
- (Bin->Size % HV_BLOCK_SIZE) != 0)
+ (Bin->Size % HBLOCK_SIZE) != 0)
{
DPRINT1("Invalid bin at BlockIndex %lu, Signature 0x%x, Size 0x%x\n",
(unsigned long)BlockIndex, (unsigned)Bin->Signature,
(unsigned)Bin->Size);
@@ -230,17 +230,17 @@
RtlCopyMemory(NewBin, Bin, Bin->Size);
- if (Bin->Size > HV_BLOCK_SIZE)
- {
- for (i = 1; i < Bin->Size / HV_BLOCK_SIZE; i++)
+ if (Bin->Size > HBLOCK_SIZE)
+ {
+ for (i = 1; i < Bin->Size / HBLOCK_SIZE; i++)
{
Hive->Storage[Stable].BlockList[BlockIndex + i].BinAddress =
(ULONG_PTR)NewBin;
Hive->Storage[Stable].BlockList[BlockIndex + i].BlockAddress =
- ((ULONG_PTR)NewBin + (i * HV_BLOCK_SIZE));
+ ((ULONG_PTR)NewBin + (i * HBLOCK_SIZE));
}
}
- BlockIndex += Bin->Size / HV_BLOCK_SIZE;
+ BlockIndex += Bin->Size / HBLOCK_SIZE;
}
if (HvpCreateHiveFreeCellList(Hive))
@@ -313,7 +313,7 @@
ULONG Alignment;
ULONG Result;
ULONG Offset = 0;
- ASSERT(sizeof(HBASE_BLOCK) >= (HV_BLOCK_SIZE * Hive->Cluster));
+ ASSERT(sizeof(HBASE_BLOCK) >= (HBLOCK_SIZE * Hive->Cluster));
/* Assume failure and allocate the buffer */
*HiveBaseBlock = 0;
@@ -321,7 +321,7 @@
if (!BaseBlock) return NoMemory;
/* Check for, and enforce, alignment */
- Alignment = Hive->Cluster * HV_BLOCK_SIZE -1;
+ Alignment = Hive->Cluster * HBLOCK_SIZE -1;
if ((ULONG_PTR)BaseBlock & Alignment)
{
/* Free the old header */
@@ -338,7 +338,7 @@
HFILE_TYPE_PRIMARY,
&Offset,
BaseBlock,
- Hive->Cluster * HV_BLOCK_SIZE);
+ Hive->Cluster * HBLOCK_SIZE);
/* Couldn't read: assume it's not a hive */
if (!Result) return NotHive;
Modified: trunk/reactos/lib/cmlib/hivewrt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivewrt.c?rev=70…
==============================================================================
--- trunk/reactos/lib/cmlib/hivewrt.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivewrt.c [iso-8859-1] Sat Jan 9 23:15:05 2016
@@ -32,7 +32,7 @@
ASSERT(RegistryHive->ReadOnly == FALSE);
ASSERT(RegistryHive->BaseBlock->Length ==
- RegistryHive->Storage[Stable].Length * HV_BLOCK_SIZE);
+ RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
DPRINT("HvpWriteLog called\n");
@@ -44,7 +44,7 @@
BitmapSize = RegistryHive->DirtyVector.SizeOfBitMap;
BufferSize = HV_LOG_HEADER_SIZE + sizeof(ULONG) + BitmapSize;
- BufferSize = ROUND_UP(BufferSize, HV_BLOCK_SIZE);
+ BufferSize = ROUND_UP(BufferSize, HBLOCK_SIZE);
DPRINT("Bitmap size %u buffer size: %u\n", BitmapSize, BufferSize);
@@ -95,14 +95,14 @@
/* Write hive block */
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_LOG,
&FileOffset, BlockPtr,
- HV_BLOCK_SIZE);
+ HBLOCK_SIZE);
if (!Success)
{
return FALSE;
}
BlockIndex++;
- FileOffset += HV_BLOCK_SIZE;
+ FileOffset += HBLOCK_SIZE;
}
Success = RegistryHive->FileSetSize(RegistryHive, HFILE_TYPE_LOG, FileOffset,
FileOffset);
@@ -157,7 +157,7 @@
ASSERT(RegistryHive->ReadOnly == FALSE);
ASSERT(RegistryHive->BaseBlock->Length ==
- RegistryHive->Storage[Stable].Length * HV_BLOCK_SIZE);
+ RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
DPRINT("HvpWriteHive called\n");
@@ -197,12 +197,12 @@
}
BlockPtr =
(PVOID)RegistryHive->Storage[Stable].BlockList[BlockIndex].BlockAddress;
- FileOffset = (BlockIndex + 1) * HV_BLOCK_SIZE;
+ FileOffset = (BlockIndex + 1) * HBLOCK_SIZE;
/* Write hive block */
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_PRIMARY,
&FileOffset, BlockPtr,
- HV_BLOCK_SIZE);
+ HBLOCK_SIZE);
if (!Success)
{
return FALSE;