/* LOCAL MACROS *************************************************************/
-#define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
-
#define ABS_VALUE(V) (((V) < 0) ? -(V) : (V))
BOOLEAN CmiDoVerify = FALSE;
ExFreePool(Buffer);
- ASSERTMSG(NT_SUCCESS(Status), ("Status: 0x%X\n", Status));
-
if (!NT_SUCCESS(Status))
{
return(Status);
return STATUS_REGISTRY_CORRUPT;
}
- ASSERTMSG((Bin->BinSize % REG_BLOCK_SIZE) == 0,
- ("Bin size (0x%.08x) must be multiple of 4K\n",
- Bin->BinSize));
+ ASSERTMSG("Bin size must be multiple of 4K\n",
+ (Bin->BinSize % REG_BLOCK_SIZE) == 0);
/* Allocate the hive block */
Hive->BlockList[BlockIndex].Bin = ExAllocatePool (PagedPool,
RegistryHive, Filename);
/* Duplicate Filename */
- Status = RtlpCreateUnicodeString(&RegistryHive->HiveFileName,
- Filename, NonPagedPool);
+ Status = RtlCreateUnicodeString(&RegistryHive->HiveFileName,
+ Filename);
if (!NT_SUCCESS(Status))
{
- DPRINT("RtlpCreateUnicodeString() failed (Status %lx)\n", Status);
+ DPRINT("RtlCreateUnicodeString() failed (Status %lx)\n", Status);
return(Status);
}
/* Create log file name */
RegistryHive->LogFileName.Length = (wcslen(Filename) + 4) * sizeof(WCHAR);
RegistryHive->LogFileName.MaximumLength = RegistryHive->LogFileName.Length + sizeof(WCHAR);
- RegistryHive->LogFileName.Buffer = ExAllocatePool(NonPagedPool,
- RegistryHive->LogFileName.MaximumLength);
+ RegistryHive->LogFileName.Buffer = ExAllocatePoolWithTag(PagedPool,
+ RegistryHive->LogFileName.MaximumLength,
+ TAG('U', 'S', 'T', 'R'));
if (RegistryHive->LogFileName.Buffer == NULL)
{
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
RtlZeroMemory (Hive,
sizeof(REGISTRY_HIVE));
- DPRINT("Hive %x\n", Hive);
+ DPRINT("Hive 0x%p\n", Hive);
Hive->HiveHeader = (PHIVE_HEADER)ExAllocatePool (NonPagedPool,
sizeof(HIVE_HEADER));
RtlZeroMemory (Hive,
sizeof(REGISTRY_HIVE));
- DPRINT ("Hive %x\n", Hive);
+ DPRINT ("Hive 0x%p\n", Hive);
Hive->HiveHeader = (PHIVE_HEADER)ExAllocatePool (NonPagedPool,
REG_BLOCK_SIZE);
RtlZeroMemory (Hive->HiveHeader,
REG_BLOCK_SIZE);
- DPRINT ("HiveHeader %x\n", Hive->HiveHeader);
+ DPRINT ("HiveHeader 0x%p\n", Hive->HiveHeader);
Hive->Flags = HIVE_NO_FILE;
RtlZeroMemory (Hive,
sizeof(REGISTRY_HIVE));
- DPRINT ("Hive %x\n", Hive);
+ DPRINT ("Hive 0x%p\n", Hive);
Hive->Flags = (Flags & REG_NO_LAZY_FLUSH) ? HIVE_NO_SYNCH : 0;
Hive->HiveHeader = (PHIVE_HEADER)ExAllocatePool(NonPagedPool,
PHBIN tmpBin;
ULONG BinSize;
ULONG i;
+ ULONG BitmapSize;
DPRINT ("CmiAddBin (BlockCount %lu)\n", BlockCount);
tmpBlock = (PCELL_HEADER)((ULONG_PTR) tmpBin + REG_HBIN_DATA_OFFSET);
tmpBlock->CellSize = (BinSize - REG_HBIN_DATA_OFFSET);
+ /* Calculate bitmap size in bytes (always a multiple of 32 bits) */
+ BitmapSize = ROUND_UP(RegistryHive->BlockListSize, sizeof(ULONG) * 8) / 8;
+
/* Grow bitmap if necessary */
- if (IsNoFileHive(RegistryHive) &&
- (RegistryHive->BlockListSize % (sizeof(ULONG) * 8) == 0))
+ if (!IsNoFileHive(RegistryHive) &&
+ BitmapSize > RegistryHive->DirtyBitMap.SizeOfBitMap)
{
PULONG BitmapBuffer;
- ULONG BitmapSize;
DPRINT("Grow hive bitmap\n");
- /* Calculate bitmap size in bytes (always a multiple of 32 bits) */
- BitmapSize = ROUND_UP(RegistryHive->BlockListSize, sizeof(ULONG) * 8) / 8;
DPRINT("RegistryHive->BlockListSize: %lu\n", RegistryHive->BlockListSize);
DPRINT("BitmapSize: %lu Bytes %lu Bits\n", BitmapSize, BitmapSize * 8);
BitmapBuffer = (PULONG)ExAllocatePool(PagedPool,
}
NewKeyCell->HashTableOffset = NewHashTableOffset;
}
+ else
+ {
+ NewHashTableCell = NULL;
+ }
/* Allocate and copy value list and values */
if (SrcKeyCell->NumberOfValues != 0)