mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Fixed inconsistent detection of in-offset data.
- Fixed class name cell allocation. - Renamed a lot of variables and functions. svn path=/trunk/; revision=6274
This commit is contained in:
parent
d27fed0f93
commit
3a2fbc9c8f
7 changed files with 425 additions and 408 deletions
|
@ -37,15 +37,16 @@
|
|||
|
||||
#define REG_BLOCK_SIZE 4096
|
||||
#define REG_HBIN_DATA_OFFSET 32
|
||||
#define REG_BIN_ID 0x6e696268
|
||||
#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_KEY_CELL_ID 0x6b6e
|
||||
#define REG_HASH_TABLE_BLOCK_ID 0x666c
|
||||
#define REG_VALUE_CELL_ID 0x6b76
|
||||
|
||||
#define REG_HIVE_ID 0x66676572
|
||||
#define REG_BIN_ID 0x6e696268
|
||||
#define REG_KEY_CELL_ID 0x6b6e
|
||||
#define REG_HASH_TABLE_CELL_ID 0x666c
|
||||
#define REG_VALUE_CELL_ID 0x6b76
|
||||
|
||||
|
||||
// BLOCK_OFFSET = offset in file after header block
|
||||
|
@ -80,7 +81,7 @@ typedef struct _HIVE_HEADER
|
|||
|
||||
/* 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 KEY_CELL */
|
||||
BLOCK_OFFSET RootKeyCell;
|
||||
BLOCK_OFFSET RootKeyOffset;
|
||||
|
||||
/* Size of each hive block ? */
|
||||
ULONG BlockSize;
|
||||
|
@ -161,7 +162,7 @@ typedef struct _KEY_CELL
|
|||
ULONG NumberOfValues;
|
||||
|
||||
/* Block offset of VALUE_LIST_CELL */
|
||||
BLOCK_OFFSET ValuesOffset;
|
||||
BLOCK_OFFSET ValueListOffset;
|
||||
|
||||
/* Block offset of security cell */
|
||||
BLOCK_OFFSET SecurityKeyOffset;
|
||||
|
@ -187,7 +188,6 @@ typedef struct _KEY_CELL
|
|||
#define REG_KEY_LINK_CELL 0x10
|
||||
#define REG_KEY_NAME_PACKED 0x20
|
||||
|
||||
|
||||
/*
|
||||
* Hash record
|
||||
*
|
||||
|
@ -213,7 +213,7 @@ typedef struct _HASH_TABLE_CELL
|
|||
typedef struct _VALUE_LIST_CELL
|
||||
{
|
||||
LONG CellSize;
|
||||
BLOCK_OFFSET Values[0];
|
||||
BLOCK_OFFSET ValueOffset[0];
|
||||
} __attribute__((packed)) VALUE_LIST_CELL, *PVALUE_LIST_CELL;
|
||||
|
||||
typedef struct _VALUE_CELL
|
||||
|
@ -221,7 +221,7 @@ typedef struct _VALUE_CELL
|
|||
LONG CellSize;
|
||||
USHORT Id; // "kv"
|
||||
USHORT NameSize; // length of Name
|
||||
LONG DataSize; // length of datas in the cell pointed by DataOffset
|
||||
ULONG DataSize; // length of datas in the cell pointed by DataOffset
|
||||
BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set
|
||||
ULONG DataType;
|
||||
USHORT Flags;
|
||||
|
@ -232,6 +232,10 @@ typedef struct _VALUE_CELL
|
|||
/* VALUE_CELL.Flags constants */
|
||||
#define REG_VALUE_NAME_PACKED 0x0001
|
||||
|
||||
/* VALUE_CELL.DataSize mask constants */
|
||||
#define REG_DATA_SIZE_MASK 0x7FFFFFFF
|
||||
#define REG_DATA_IN_OFFSET 0x80000000
|
||||
|
||||
|
||||
typedef struct _DATA_CELL
|
||||
{
|
||||
|
@ -306,7 +310,7 @@ typedef struct _KEY_OBJECT
|
|||
PREGISTRY_HIVE RegistryHive;
|
||||
|
||||
/* Block offset of the key cell this key belongs in */
|
||||
BLOCK_OFFSET BlockOffset;
|
||||
BLOCK_OFFSET KeyCellOffset;
|
||||
|
||||
/* KEY_CELL this key belong in */
|
||||
PKEY_CELL KeyCell;
|
||||
|
@ -506,7 +510,7 @@ CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
|||
IN PUNICODE_STRING ValueName);
|
||||
|
||||
NTSTATUS
|
||||
CmiAllocateHashTableBlock(IN PREGISTRY_HIVE RegistryHive,
|
||||
CmiAllocateHashTableCell(IN PREGISTRY_HIVE RegistryHive,
|
||||
OUT PHASH_TABLE_CELL *HashBlock,
|
||||
OUT BLOCK_OFFSET *HBOffset,
|
||||
IN ULONG HashTableSize);
|
||||
|
@ -539,19 +543,19 @@ CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
|
|||
BLOCK_OFFSET VBOffset);
|
||||
|
||||
NTSTATUS
|
||||
CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
|
||||
PVOID *Block,
|
||||
LONG BlockSize,
|
||||
BLOCK_OFFSET * pBlockOffset);
|
||||
CmiAllocateCell(PREGISTRY_HIVE RegistryHive,
|
||||
LONG CellSize,
|
||||
PVOID *Cell,
|
||||
BLOCK_OFFSET *CellOffset);
|
||||
|
||||
NTSTATUS
|
||||
CmiDestroyBlock(PREGISTRY_HIVE RegistryHive,
|
||||
PVOID Block,
|
||||
BLOCK_OFFSET Offset);
|
||||
CmiDestroyCell(PREGISTRY_HIVE RegistryHive,
|
||||
PVOID Cell,
|
||||
BLOCK_OFFSET CellOffset);
|
||||
|
||||
PVOID
|
||||
CmiGetBlock(PREGISTRY_HIVE RegistryHive,
|
||||
BLOCK_OFFSET BlockOffset,
|
||||
CmiGetCell (PREGISTRY_HIVE RegistryHive,
|
||||
BLOCK_OFFSET CellOffset,
|
||||
OUT PHBIN * ppBin);
|
||||
|
||||
VOID
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: import.c,v 1.21 2003/06/01 15:10:52 ekohl Exp $
|
||||
/* $Id: import.c,v 1.22 2003/10/10 21:55:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -9,13 +9,12 @@
|
|||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
|
||||
#define NTOS_MODE_KERNEL
|
||||
#include <ntos.h>
|
||||
#include <string.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/se.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
|
@ -167,7 +166,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
|
||||
if (KeyObject->RegistryHive == KeyObject->ParentKey->RegistryHive)
|
||||
{
|
||||
KeyObject->KeyCell->ParentKeyOffset = KeyObject->ParentKey->BlockOffset;
|
||||
KeyObject->KeyCell->ParentKeyOffset = KeyObject->ParentKey->KeyCellOffset;
|
||||
KeyObject->KeyCell->SecurityKeyOffset = KeyObject->ParentKey->KeyCell->SecurityKeyOffset;
|
||||
}
|
||||
else
|
||||
|
@ -276,7 +275,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
PKEY_BASIC_INFORMATION BasicInformation;
|
||||
PKEY_NODE_INFORMATION NodeInformation;
|
||||
PKEY_FULL_INFORMATION FullInformation;
|
||||
PDATA_CELL ClassData;
|
||||
PDATA_CELL ClassCell;
|
||||
ULONG NameSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -354,7 +353,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
return(STATUS_NO_MORE_ENTRIES);
|
||||
}
|
||||
|
||||
HashTableBlock = CmiGetBlock(RegistryHive, KeyCell->HashTableOffset, NULL);
|
||||
HashTableBlock = CmiGetCell (RegistryHive, KeyCell->HashTableOffset, NULL);
|
||||
if (HashTableBlock == NULL)
|
||||
{
|
||||
DPRINT("CmiGetBlock() failed\n");
|
||||
|
@ -458,12 +457,12 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
|
||||
if (SubKeyCell->ClassSize != 0)
|
||||
{
|
||||
ClassData=CmiGetBlock(KeyObject->RegistryHive,
|
||||
SubKeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
wcsncpy(NodeInformation->Name + SubKeyCell->NameSize,
|
||||
(PWCHAR)ClassData->Data,
|
||||
SubKeyCell->ClassSize);
|
||||
ClassCell = CmiGetCell (KeyObject->RegistryHive,
|
||||
SubKeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
RtlCopyMemory (NodeInformation->Name + SubKeyCell->NameSize,
|
||||
ClassCell->Data,
|
||||
SubKeyCell->ClassSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -497,12 +496,12 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
CmiGetMaxValueDataLength(RegistryHive, SubKeyCell);
|
||||
if (SubKeyCell->ClassSize != 0)
|
||||
{
|
||||
ClassData = CmiGetBlock(KeyObject->RegistryHive,
|
||||
ClassCell = CmiGetCell (KeyObject->RegistryHive,
|
||||
SubKeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
wcsncpy(FullInformation->Class,
|
||||
(PWCHAR)ClassData->Data,
|
||||
SubKeyCell->ClassSize);
|
||||
RtlCopyMemory (FullInformation->Class,
|
||||
ClassCell->Data,
|
||||
SubKeyCell->ClassSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -622,7 +621,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
|||
|
||||
case KeyValuePartialInformation:
|
||||
*ResultLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
|
||||
(ValueCell->DataSize & LONG_MAX);
|
||||
(ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
if (Length < *ResultLength)
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
|
@ -633,21 +632,20 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
|||
KeyValueInformation;
|
||||
ValuePartialInformation->TitleIndex = 0;
|
||||
ValuePartialInformation->Type = ValueCell->DataType;
|
||||
ValuePartialInformation->DataLength = ValueCell->DataSize & LONG_MAX;
|
||||
if(ValueCell->DataSize >0)
|
||||
ValuePartialInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
RtlCopyMemory(ValuePartialInformation->Data,
|
||||
DataCell->Data,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlCopyMemory(ValuePartialInformation->Data,
|
||||
&ValueCell->DataOffset,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -658,7 +656,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
|||
NameSize *= sizeof(WCHAR);
|
||||
}
|
||||
*ResultLength = sizeof(KEY_VALUE_FULL_INFORMATION) +
|
||||
NameSize + (ValueCell->DataSize & LONG_MAX);
|
||||
NameSize + (ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
if (Length < *ResultLength)
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
|
@ -687,21 +685,21 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
|||
ValueFullInformation->NameLength;
|
||||
ValueFullInformation->DataOffset =
|
||||
(ValueFullInformation->DataOffset + 3) & 0xfffffffc;
|
||||
ValueFullInformation->DataLength = ValueCell->DataSize & LONG_MAX;
|
||||
if (ValueCell->DataSize > 0)
|
||||
ValueFullInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
RtlCopyMemory((PCHAR) ValueFullInformation
|
||||
+ ValueFullInformation->DataOffset,
|
||||
DataCell->Data,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlCopyMemory((PCHAR) ValueFullInformation
|
||||
+ ValueFullInformation->DataOffset,
|
||||
&ValueCell->DataOffset,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -839,7 +837,7 @@ NtQueryKey(IN HANDLE KeyHandle,
|
|||
PKEY_NODE_INFORMATION NodeInformation;
|
||||
PKEY_FULL_INFORMATION FullInformation;
|
||||
PREGISTRY_HIVE RegistryHive;
|
||||
PDATA_CELL ClassData;
|
||||
PDATA_CELL ClassCell;
|
||||
PKEY_OBJECT KeyObject;
|
||||
PKEY_CELL KeyCell;
|
||||
NTSTATUS Status;
|
||||
|
@ -944,12 +942,12 @@ NtQueryKey(IN HANDLE KeyHandle,
|
|||
|
||||
if (KeyCell->ClassSize != 0)
|
||||
{
|
||||
ClassData = CmiGetBlock(KeyObject->RegistryHive,
|
||||
ClassCell = CmiGetCell (KeyObject->RegistryHive,
|
||||
KeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
wcsncpy(NodeInformation->Name + KeyObject->Name.Length,
|
||||
(PWCHAR)ClassData->Data,
|
||||
KeyCell->ClassSize);
|
||||
RtlCopyMemory (NodeInformation->Name + KeyObject->Name.Length,
|
||||
ClassCell->Data,
|
||||
KeyCell->ClassSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -982,12 +980,12 @@ NtQueryKey(IN HANDLE KeyHandle,
|
|||
CmiGetMaxValueDataLength(RegistryHive, KeyCell);
|
||||
if (KeyCell->ClassSize != 0)
|
||||
{
|
||||
ClassData=CmiGetBlock(KeyObject->RegistryHive,
|
||||
KeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
wcsncpy(FullInformation->Class,
|
||||
(PWCHAR)ClassData->Data,
|
||||
KeyCell->ClassSize);
|
||||
ClassCell = CmiGetCell (KeyObject->RegistryHive,
|
||||
KeyCell->ClassNameOffset,
|
||||
NULL);
|
||||
RtlCopyMemory (FullInformation->Class,
|
||||
ClassCell->Data,
|
||||
KeyCell->ClassSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1100,7 +1098,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
|
||||
case KeyValuePartialInformation:
|
||||
*ResultLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION)
|
||||
+ (ValueCell->DataSize & LONG_MAX);
|
||||
+ (ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
if (Length < *ResultLength)
|
||||
{
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
|
@ -1111,19 +1109,19 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
KeyValueInformation;
|
||||
ValuePartialInformation->TitleIndex = 0;
|
||||
ValuePartialInformation->Type = ValueCell->DataType;
|
||||
ValuePartialInformation->DataLength = ValueCell->DataSize & LONG_MAX;
|
||||
if (ValueCell->DataSize > 0)
|
||||
ValuePartialInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
RtlCopyMemory(ValuePartialInformation->Data,
|
||||
DataCell->Data,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlCopyMemory(ValuePartialInformation->Data,
|
||||
&ValueCell->DataOffset,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1135,7 +1133,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
NameSize *= sizeof(WCHAR);
|
||||
}
|
||||
*ResultLength = sizeof(KEY_VALUE_FULL_INFORMATION) +
|
||||
NameSize + (ValueCell->DataSize & LONG_MAX);
|
||||
NameSize + (ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
if (Length < *ResultLength)
|
||||
{
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
|
@ -1164,21 +1162,21 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
ValueFullInformation->NameLength;
|
||||
ValueFullInformation->DataOffset =
|
||||
(ValueFullInformation->DataOffset + 3) & 0xfffffffc;
|
||||
ValueFullInformation->DataLength = ValueCell->DataSize & LONG_MAX;
|
||||
if (ValueCell->DataSize > 0)
|
||||
ValueFullInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
RtlCopyMemory((PCHAR) ValueFullInformation
|
||||
+ ValueFullInformation->DataOffset,
|
||||
DataCell->Data,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlCopyMemory((PCHAR) ValueFullInformation
|
||||
+ ValueFullInformation->DataOffset,
|
||||
&ValueCell->DataOffset,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1212,7 +1210,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
PREGISTRY_HIVE RegistryHive;
|
||||
PKEY_CELL KeyCell;
|
||||
PVALUE_CELL ValueCell;
|
||||
BLOCK_OFFSET VBOffset;
|
||||
BLOCK_OFFSET ValueCellOffset;
|
||||
PDATA_CELL DataCell;
|
||||
PDATA_CELL NewDataCell;
|
||||
PHBIN pBin;
|
||||
|
@ -1247,7 +1245,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
KeyCell,
|
||||
ValueName,
|
||||
&ValueCell,
|
||||
&VBOffset);
|
||||
&ValueCellOffset);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Value not found. Status 0x%X\n", Status);
|
||||
|
@ -1264,10 +1262,10 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
KeyCell,
|
||||
ValueName,
|
||||
&ValueCell,
|
||||
&VBOffset);
|
||||
&ValueCellOffset);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
CmiMarkBlockDirty(RegistryHive, VBOffset);
|
||||
CmiMarkBlockDirty(RegistryHive, ValueCellOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1284,26 +1282,28 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
DPRINT("ValueCell %p\n", ValueCell);
|
||||
DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize);
|
||||
|
||||
if (DataSize <= 4)
|
||||
if (DataSize <= sizeof(BLOCK_OFFSET))
|
||||
{
|
||||
/* If datasize <= 4 then write in valueblock directly */
|
||||
/* If data size <= sizeof(BLOCK_OFFSET) then store data in the data offset */
|
||||
DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize);
|
||||
if ((ValueCell->DataSize >= 0) &&
|
||||
(DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET) &&
|
||||
(ValueCell->DataSize & REG_DATA_SIZE_MASK) != 0)
|
||||
{
|
||||
CmiDestroyBlock(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
CmiDestroyCell(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
}
|
||||
|
||||
RtlCopyMemory(&ValueCell->DataOffset, Data, DataSize);
|
||||
ValueCell->DataSize = DataSize | 0x80000000;
|
||||
ValueCell->DataSize = DataSize | REG_DATA_IN_OFFSET;
|
||||
ValueCell->DataType = Type;
|
||||
RtlMoveMemory(&ValueCell->DataOffset, Data, DataSize);
|
||||
CmiMarkBlockDirty(RegistryHive, VBOffset);
|
||||
CmiMarkBlockDirty(RegistryHive, ValueCellOffset);
|
||||
}
|
||||
else if (DataSize <= (ULONG) (ValueCell->DataSize & 0x7fffffff))
|
||||
else if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET) &&
|
||||
(DataSize <= (ValueCell->DataSize & REG_DATA_SIZE_MASK)))
|
||||
{
|
||||
/* If new data size is <= current then overwrite current data */
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset,&pBin);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset,&pBin);
|
||||
RtlZeroMemory(DataCell->Data, ValueCell->DataSize);
|
||||
RtlCopyMemory(DataCell->Data, Data, DataSize);
|
||||
ValueCell->DataSize = DataSize;
|
||||
|
@ -1326,18 +1326,19 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
|
||||
DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize);
|
||||
|
||||
if ((ValueCell->DataSize >= 0) &&
|
||||
(DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET) &&
|
||||
(ValueCell->DataSize & REG_DATA_SIZE_MASK) != 0)
|
||||
{
|
||||
CmiDestroyBlock(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
CmiDestroyCell(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
ValueCell->DataSize = 0;
|
||||
ValueCell->DataType = 0;
|
||||
ValueCell->DataOffset = 0xffffffff;
|
||||
ValueCell->DataOffset = (BLOCK_OFFSET)-1;
|
||||
}
|
||||
|
||||
Status = CmiAllocateBlock(RegistryHive,
|
||||
Status = CmiAllocateCell (RegistryHive,
|
||||
sizeof(CELL_HEADER) + DataSize,
|
||||
(PVOID *)&NewDataCell,
|
||||
DataSize,
|
||||
&NewOffset);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -1350,10 +1351,11 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
}
|
||||
|
||||
RtlCopyMemory(&NewDataCell->Data[0], Data, DataSize);
|
||||
ValueCell->DataSize = DataSize;
|
||||
ValueCell->DataSize = DataSize & REG_DATA_SIZE_MASK;
|
||||
ValueCell->DataType = Type;
|
||||
ValueCell->DataOffset = NewOffset;
|
||||
CmiMarkBlockDirty(RegistryHive, ValueCell->DataOffset);
|
||||
CmiMarkBlockDirty(RegistryHive, ValueCellOffset);
|
||||
}
|
||||
|
||||
/* Mark link key */
|
||||
|
@ -1361,11 +1363,11 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
(Type == REG_LINK))
|
||||
{
|
||||
KeyCell->Flags |= REG_KEY_LINK_CELL;
|
||||
CmiMarkBlockDirty(RegistryHive, KeyObject->BlockOffset);
|
||||
CmiMarkBlockDirty(RegistryHive, KeyObject->KeyCellOffset);
|
||||
}
|
||||
|
||||
/* Update time of heap */
|
||||
if (!IsNoFileHive(RegistryHive) && CmiGetBlock(RegistryHive, VBOffset, &pBin))
|
||||
if (!IsNoFileHive(RegistryHive) && CmiGetCell (RegistryHive, ValueCellOffset, &pBin))
|
||||
{
|
||||
NtQuerySystemTime(&pBin->DateModified);
|
||||
}
|
||||
|
@ -1407,7 +1409,7 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
|
|||
|
||||
Status = CmiDeleteValueFromKey(KeyObject->RegistryHive,
|
||||
KeyObject->KeyCell,
|
||||
KeyObject->BlockOffset,
|
||||
KeyObject->KeyCellOffset,
|
||||
ValueName);
|
||||
|
||||
/* Release hive lock */
|
||||
|
@ -1632,38 +1634,38 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
|
|||
|
||||
BufferLength = (BufferLength + 3) & 0xfffffffc;
|
||||
|
||||
if (BufferLength + (ValueCell->DataSize & LONG_MAX) <= *Length)
|
||||
if (BufferLength + (ValueCell->DataSize & REG_DATA_SIZE_MASK) <= *Length)
|
||||
{
|
||||
DataPtr = (PUCHAR)(((ULONG)DataPtr + 3) & 0xfffffffc);
|
||||
|
||||
ValueList[i].Type = ValueCell->DataType;
|
||||
ValueList[i].DataLength = ValueCell->DataSize & LONG_MAX;
|
||||
ValueList[i].DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
ValueList[i].DataOffset = (ULONG) DataPtr - (ULONG) Buffer;
|
||||
|
||||
if (ValueCell->DataSize > 0)
|
||||
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive,
|
||||
DataCell = CmiGetCell (RegistryHive,
|
||||
ValueCell->DataOffset,
|
||||
NULL);
|
||||
RtlCopyMemory(DataPtr,
|
||||
DataCell->Data,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlCopyMemory(DataPtr,
|
||||
&ValueCell->DataOffset,
|
||||
ValueCell->DataSize & LONG_MAX);
|
||||
ValueCell->DataSize & REG_DATA_SIZE_MASK);
|
||||
}
|
||||
|
||||
DataPtr += ValueCell->DataSize & LONG_MAX;
|
||||
DataPtr += ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
BufferLength += ValueCell->DataSize & LONG_MAX;
|
||||
BufferLength += ValueCell->DataSize & REG_DATA_SIZE_MASK;
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.109 2003/10/07 14:08:43 ekohl Exp $
|
||||
/* $Id: registry.c,v 1.110 2003/10/10 21:55:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,9 +13,9 @@
|
|||
|
||||
#define NTOS_MODE_KERNEL
|
||||
#include <ntos.h>
|
||||
#include <roscfg.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/registry.h>
|
||||
#include <reactos/bugcodes.h>
|
||||
|
@ -310,8 +310,8 @@ CmInitializeRegistry(VOID)
|
|||
&RootKeyHandle);
|
||||
assert(NT_SUCCESS(Status));
|
||||
RootKey->RegistryHive = CmiVolatileHive;
|
||||
RootKey->BlockOffset = CmiVolatileHive->HiveHeader->RootKeyCell;
|
||||
RootKey->KeyCell = CmiGetBlock(CmiVolatileHive, RootKey->BlockOffset, NULL);
|
||||
RootKey->KeyCellOffset = CmiVolatileHive->HiveHeader->RootKeyOffset;
|
||||
RootKey->KeyCell = CmiGetCell (CmiVolatileHive, RootKey->KeyCellOffset, NULL);
|
||||
RootKey->ParentKey = RootKey;
|
||||
RootKey->Flags = 0;
|
||||
RootKey->NumberOfSubKeys = 0;
|
||||
|
@ -567,8 +567,8 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
|||
}
|
||||
|
||||
NewKey->RegistryHive = RegistryHive;
|
||||
NewKey->BlockOffset = RegistryHive->HiveHeader->RootKeyCell;
|
||||
NewKey->KeyCell = CmiGetBlock(RegistryHive, NewKey->BlockOffset, NULL);
|
||||
NewKey->KeyCellOffset = RegistryHive->HiveHeader->RootKeyOffset;
|
||||
NewKey->KeyCell = CmiGetCell (RegistryHive, NewKey->KeyCellOffset, NULL);
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys = 0;
|
||||
NewKey->SubKeys = ExAllocatePool(PagedPool,
|
||||
|
|
|
@ -8,10 +8,9 @@
|
|||
|
||||
#define NTOS_MODE_KERNEL
|
||||
#include <ntos.h>
|
||||
#include <string.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/registry.h>
|
||||
#include <ntos/minmax.h>
|
||||
|
||||
|
@ -164,7 +163,7 @@ CmiObjectParse(PVOID ParsedObject,
|
|||
|
||||
FoundObject->Flags = 0;
|
||||
FoundObject->KeyCell = SubKeyCell;
|
||||
FoundObject->BlockOffset = BlockOffset;
|
||||
FoundObject->KeyCellOffset = BlockOffset;
|
||||
FoundObject->RegistryHive = ParsedKey->RegistryHive;
|
||||
RtlCreateUnicodeString(&FoundObject->Name,
|
||||
KeyName.Buffer);
|
||||
|
@ -552,7 +551,7 @@ CmiGetLinkTarget(PREGISTRY_HIVE RegistryHive,
|
|||
|
||||
if (ValueCell->DataSize > 0)
|
||||
{
|
||||
DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
|
||||
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
|
||||
RtlCopyMemory(TargetPath->Buffer,
|
||||
DataCell->Data,
|
||||
TargetPath->Length);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: binhive.c,v 1.5 2003/07/30 21:22:51 royce Exp $
|
||||
/* $Id: binhive.c,v 1.6 2003/10/10 21:53:47 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS hive maker
|
||||
* FILE: tools/mkhive/binhive.c
|
||||
|
@ -38,7 +38,7 @@
|
|||
#define REG_HIVE_ID 0x66676572
|
||||
#define REG_BIN_ID 0x6e696268
|
||||
#define REG_KEY_CELL_ID 0x6b6e
|
||||
#define REG_HASH_TABLE_BLOCK_ID 0x666c
|
||||
#define REG_HASH_TABLE_CELL_ID 0x666c
|
||||
#define REG_VALUE_CELL_ID 0x6b76
|
||||
|
||||
#define REG_BLOCK_SIZE 4096
|
||||
|
@ -88,7 +88,7 @@ typedef struct _HIVE_HEADER
|
|||
|
||||
/* 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 KEY_CELL */
|
||||
BLOCK_OFFSET RootKeyCell;
|
||||
BLOCK_OFFSET RootKeyOffset;
|
||||
|
||||
/* Size of each hive block ? */
|
||||
ULONG BlockSize;
|
||||
|
@ -169,7 +169,7 @@ typedef struct _KEY_CELL
|
|||
ULONG NumberOfValues;
|
||||
|
||||
/* Block offset of VALUE_LIST_CELL */
|
||||
BLOCK_OFFSET ValuesOffset;
|
||||
BLOCK_OFFSET ValueListOffset;
|
||||
|
||||
/* Block offset of security cell */
|
||||
BLOCK_OFFSET SecurityKeyOffset;
|
||||
|
@ -215,7 +215,7 @@ typedef struct _HASH_TABLE_CELL
|
|||
typedef struct _VALUE_LIST_CELL
|
||||
{
|
||||
LONG CellSize;
|
||||
BLOCK_OFFSET Values[0];
|
||||
BLOCK_OFFSET ValueOffset[0];
|
||||
} __attribute__((packed)) VALUE_LIST_CELL, *PVALUE_LIST_CELL;
|
||||
|
||||
typedef struct _VALUE_CELL
|
||||
|
@ -223,7 +223,7 @@ typedef struct _VALUE_CELL
|
|||
LONG CellSize;
|
||||
USHORT Id; // "kv"
|
||||
USHORT NameSize; // length of Name
|
||||
LONG DataSize; // length of datas in the cell pointed by DataOffset
|
||||
ULONG DataSize; // length of datas in the cell pointed by DataOffset
|
||||
BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set
|
||||
ULONG DataType;
|
||||
USHORT Flags;
|
||||
|
@ -234,6 +234,9 @@ typedef struct _VALUE_CELL
|
|||
/* VALUE_CELL.Flags constants */
|
||||
#define REG_VALUE_NAME_PACKED 0x0001
|
||||
|
||||
/* VALUE_CELL.DataSize mask constants */
|
||||
#define REG_DATA_SIZE_MASK 0x7FFFFFFF
|
||||
#define REG_DATA_IN_OFFSET 0x80000000
|
||||
|
||||
typedef struct _DATA_CELL
|
||||
{
|
||||
|
@ -269,7 +272,7 @@ CmiCreateDefaultHiveHeader(PHIVE_HEADER Header)
|
|||
Header->Unused5 = 0;
|
||||
Header->Unused6 = 1;
|
||||
Header->Unused7 = 1;
|
||||
Header->RootKeyCell = 0;
|
||||
Header->RootKeyOffset = -1;
|
||||
Header->BlockSize = REG_BLOCK_SIZE;
|
||||
Header->Unused6 = 1;
|
||||
Header->Checksum = 0;
|
||||
|
@ -300,7 +303,7 @@ CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell)
|
|||
RootKeyCell->NumberOfSubKeys = 0;
|
||||
RootKeyCell->HashTableOffset = -1;
|
||||
RootKeyCell->NumberOfValues = 0;
|
||||
RootKeyCell->ValuesOffset = -1;
|
||||
RootKeyCell->ValueListOffset = -1;
|
||||
RootKeyCell->SecurityKeyOffset = 0;
|
||||
RootKeyCell->ClassNameOffset = -1;
|
||||
RootKeyCell->NameSize = 0;
|
||||
|
@ -386,7 +389,7 @@ CmiCreateRegistryHive (VOID)
|
|||
/* Init root key cell */
|
||||
RootKeyCell = (PKEY_CELL)((ULONG_PTR)BinCell + REG_HBIN_DATA_OFFSET);
|
||||
CmiCreateDefaultRootKeyCell(RootKeyCell);
|
||||
Hive->HiveHeader->RootKeyCell = REG_HBIN_DATA_OFFSET;
|
||||
Hive->HiveHeader->RootKeyOffset = REG_HBIN_DATA_OFFSET;
|
||||
|
||||
/* Init free cell */
|
||||
FreeCell = (PCELL_HEADER)((ULONG_PTR)RootKeyCell + sizeof(KEY_CELL));
|
||||
|
@ -449,7 +452,7 @@ CmiDestroyRegistryHive (PREGISTRY_HIVE Hive)
|
|||
|
||||
|
||||
static PVOID
|
||||
CmiGetBlock(PREGISTRY_HIVE Hive,
|
||||
CmiGetCell (PREGISTRY_HIVE Hive,
|
||||
BLOCK_OFFSET BlockOffset,
|
||||
PHBIN * ppBin)
|
||||
{
|
||||
|
@ -489,7 +492,7 @@ CmiMergeFree(PREGISTRY_HIVE RegistryHive,
|
|||
DPRINT("CmiMergeFree(Block %lx Offset %lx Size %lx) called\n",
|
||||
FreeBlock, FreeOffset, FreeBlock->CellSize);
|
||||
|
||||
CmiGetBlock(RegistryHive,
|
||||
CmiGetCell (RegistryHive,
|
||||
FreeOffset,
|
||||
&Bin);
|
||||
DPRINT("Bin %p\n", Bin);
|
||||
|
@ -729,7 +732,7 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive,
|
|||
|
||||
|
||||
static BOOL
|
||||
CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
|
||||
CmiAllocateCell (PREGISTRY_HIVE RegistryHive,
|
||||
PVOID *Block,
|
||||
LONG BlockSize,
|
||||
PBLOCK_OFFSET pBlockOffset)
|
||||
|
@ -813,16 +816,16 @@ CmiAllocateHashTableCell (PREGISTRY_HIVE Hive,
|
|||
NewHashSize = ROUND_UP(sizeof(HASH_TABLE_CELL) +
|
||||
(SubKeyCount - 1) * sizeof(HASH_RECORD),
|
||||
0x10);
|
||||
Status = CmiAllocateBlock (Hive,
|
||||
(PVOID*) &HashCell,
|
||||
NewHashSize,
|
||||
HBOffset);
|
||||
Status = CmiAllocateCell (Hive,
|
||||
(PVOID*) &HashCell,
|
||||
NewHashSize,
|
||||
HBOffset);
|
||||
if ((HashCell == NULL) || (Status == FALSE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HashCell->Id = REG_HASH_TABLE_BLOCK_ID;
|
||||
HashCell->Id = REG_HASH_TABLE_CELL_ID;
|
||||
HashCell->HashTableSize = SubKeyCount;
|
||||
|
||||
return TRUE;
|
||||
|
@ -839,18 +842,18 @@ CmiAddKeyToParentHashTable (PREGISTRY_HIVE Hive,
|
|||
PKEY_CELL ParentKeyCell;
|
||||
ULONG i;
|
||||
|
||||
ParentKeyCell = CmiGetBlock (Hive,
|
||||
ParentKeyOffset,
|
||||
NULL);
|
||||
ParentKeyCell = CmiGetCell (Hive,
|
||||
ParentKeyOffset,
|
||||
NULL);
|
||||
if (ParentKeyCell == NULL)
|
||||
{
|
||||
DPRINT1 ("CmiGetBlock() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HashBlock =CmiGetBlock (Hive,
|
||||
ParentKeyCell->HashTableOffset,
|
||||
NULL);
|
||||
HashBlock =CmiGetCell (Hive,
|
||||
ParentKeyCell->HashTableOffset,
|
||||
NULL);
|
||||
if (HashBlock == NULL)
|
||||
{
|
||||
DPRINT1 ("CmiGetBlock() failed\n");
|
||||
|
@ -885,10 +888,10 @@ CmiAllocateValueListCell (PREGISTRY_HIVE Hive,
|
|||
|
||||
ValueListSize = ROUND_UP (ValueCount * sizeof(BLOCK_OFFSET),
|
||||
0x10);
|
||||
Status = CmiAllocateBlock (Hive,
|
||||
(PVOID)&ValueListCell,
|
||||
ValueListSize,
|
||||
ValueListOffset);
|
||||
Status = CmiAllocateCell (Hive,
|
||||
(PVOID)&ValueListCell,
|
||||
ValueListSize,
|
||||
ValueListOffset);
|
||||
if ((ValueListCell == NULL) || (Status == FALSE))
|
||||
{
|
||||
DPRINT1 ("CmiAllocateBlock() failed\n");
|
||||
|
@ -910,7 +913,7 @@ CmiAllocateValueCell(PREGISTRY_HIVE Hive,
|
|||
BOOL Status;
|
||||
|
||||
NameSize = (ValueName == NULL) ? 0 : strlen (ValueName);
|
||||
Status = CmiAllocateBlock(Hive,
|
||||
Status = CmiAllocateCell (Hive,
|
||||
(PVOID*)&NewValueCell,
|
||||
sizeof(VALUE_CELL) + NameSize,
|
||||
ValueCellOffset);
|
||||
|
@ -947,21 +950,21 @@ CmiAddValueToKeyValueList(PREGISTRY_HIVE Hive,
|
|||
PVALUE_LIST_CELL ValueListCell;
|
||||
PKEY_CELL KeyCell;
|
||||
|
||||
KeyCell = CmiGetBlock (Hive, KeyCellOffset, NULL);
|
||||
KeyCell = CmiGetCell (Hive, KeyCellOffset, NULL);
|
||||
if (KeyCell == NULL)
|
||||
{
|
||||
DPRINT1 ("CmiGetBlock() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ValueListCell = CmiGetBlock (Hive, KeyCell->ValuesOffset, NULL);
|
||||
ValueListCell = CmiGetCell (Hive, KeyCell->ValueListOffset, NULL);
|
||||
if (ValueListCell == NULL)
|
||||
{
|
||||
DPRINT1 ("CmiGetBlock() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ValueListCell->Values[KeyCell->NumberOfValues] = ValueCellOffset;
|
||||
ValueListCell->ValueOffset[KeyCell->NumberOfValues] = ValueCellOffset;
|
||||
KeyCell->NumberOfValues++;
|
||||
|
||||
return TRUE;
|
||||
|
@ -1032,9 +1035,9 @@ CmiExportValue (PREGISTRY_HIVE Hive,
|
|||
Expand = TRUE;
|
||||
}
|
||||
|
||||
if (DstDataSize <= sizeof(BLOCK_OFFSET))
|
||||
if ((DstDataSize & REG_DATA_SIZE_MASK) <= sizeof(BLOCK_OFFSET))
|
||||
{
|
||||
ValueCell->DataSize = DstDataSize | 0x80000000;
|
||||
ValueCell->DataSize = DstDataSize | REG_DATA_IN_OFFSET;
|
||||
ValueCell->DataType = DataType;
|
||||
if (Expand)
|
||||
{
|
||||
|
@ -1051,16 +1054,16 @@ CmiExportValue (PREGISTRY_HIVE Hive,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!CmiAllocateBlock (Hive,
|
||||
(PVOID *)&DataCell,
|
||||
DstDataSize,
|
||||
&DataCellOffset))
|
||||
if (!CmiAllocateCell (Hive,
|
||||
(PVOID *)&DataCell,
|
||||
DstDataSize,
|
||||
&DataCellOffset))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ValueCell->DataOffset = DataCellOffset;
|
||||
ValueCell->DataSize = DstDataSize;
|
||||
ValueCell->DataSize = DstDataSize & REG_DATA_SIZE_MASK;
|
||||
ValueCell->DataType = DataType;
|
||||
|
||||
if (Expand)
|
||||
|
@ -1113,7 +1116,7 @@ CmiExportSubKey (PREGISTRY_HIVE Hive,
|
|||
|
||||
/* Allocate key cell */
|
||||
KeyCellSize = sizeof(KEY_CELL) + Key->NameSize - 1;
|
||||
if (!CmiAllocateBlock (Hive, (PVOID)&NewKeyCell, KeyCellSize, &NKBOffset))
|
||||
if (!CmiAllocateCell (Hive, (PVOID)&NewKeyCell, KeyCellSize, &NKBOffset))
|
||||
{
|
||||
DPRINT1 ("CmiAllocateBlock() failed\n");
|
||||
return FALSE;
|
||||
|
@ -1127,7 +1130,7 @@ CmiExportSubKey (PREGISTRY_HIVE Hive,
|
|||
NewKeyCell->NumberOfSubKeys = 0;
|
||||
NewKeyCell->HashTableOffset = -1;
|
||||
NewKeyCell->NumberOfValues = 0;
|
||||
NewKeyCell->ValuesOffset = -1;
|
||||
NewKeyCell->ValueListOffset = -1;
|
||||
NewKeyCell->SecurityKeyOffset = -1;
|
||||
NewKeyCell->NameSize = Key->NameSize - 1;
|
||||
NewKeyCell->ClassNameOffset = -1;
|
||||
|
@ -1151,7 +1154,7 @@ CmiExportSubKey (PREGISTRY_HIVE Hive,
|
|||
{
|
||||
/* Allocate value list cell */
|
||||
CmiAllocateValueListCell (Hive,
|
||||
&NewKeyCell->ValuesOffset,
|
||||
&NewKeyCell->ValueListOffset,
|
||||
ValueCount);
|
||||
|
||||
if (Key->DataSize != 0)
|
||||
|
@ -1242,9 +1245,9 @@ CmiExportHive (PREGISTRY_HIVE Hive,
|
|||
|
||||
DPRINT ("Name: %s\n", KeyName);
|
||||
|
||||
KeyCell = CmiGetBlock (Hive,
|
||||
Hive->HiveHeader->RootKeyCell,
|
||||
NULL);
|
||||
KeyCell = CmiGetCell (Hive,
|
||||
Hive->HiveHeader->RootKeyOffset,
|
||||
NULL);
|
||||
if (KeyCell == NULL)
|
||||
{
|
||||
DPRINT1 ("CmiGetBlock() failed\n");
|
||||
|
@ -1257,12 +1260,12 @@ CmiExportHive (PREGISTRY_HIVE Hive,
|
|||
{
|
||||
/* Allocate value list cell */
|
||||
CmiAllocateValueListCell (Hive,
|
||||
&KeyCell->ValuesOffset,
|
||||
&KeyCell->ValueListOffset,
|
||||
ValueCount);
|
||||
|
||||
if (Key->DataSize != 0)
|
||||
{
|
||||
if (!CmiExportValue (Hive, Hive->HiveHeader->RootKeyCell, Key, NULL))
|
||||
if (!CmiExportValue (Hive, Hive->HiveHeader->RootKeyOffset, Key, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1277,7 @@ CmiExportHive (PREGISTRY_HIVE Hive,
|
|||
VALUE,
|
||||
ValueList);
|
||||
|
||||
if (!CmiExportValue (Hive, Hive->HiveHeader->RootKeyCell, Key, Value))
|
||||
if (!CmiExportValue (Hive, Hive->HiveHeader->RootKeyOffset, Key, Value))
|
||||
return FALSE;
|
||||
|
||||
Entry = Entry->Flink;
|
||||
|
@ -1298,7 +1301,7 @@ CmiExportHive (PREGISTRY_HIVE Hive,
|
|||
KEY,
|
||||
KeyList);
|
||||
|
||||
if (!CmiExportSubKey (Hive, Hive->HiveHeader->RootKeyCell, Key, SubKey))
|
||||
if (!CmiExportSubKey (Hive, Hive->HiveHeader->RootKeyOffset, Key, SubKey))
|
||||
return FALSE;
|
||||
|
||||
Entry = Entry->Flink;
|
||||
|
|
Loading…
Reference in a new issue