mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Added hive synchronization to value-related registry functions.
svn path=/trunk/; revision=4143
This commit is contained in:
parent
bd0f683f94
commit
493e797fa0
3 changed files with 44 additions and 8 deletions
|
@ -464,8 +464,9 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
||||||
IN PKEY_CELL KeyCell,
|
IN PKEY_CELL KeyCell,
|
||||||
IN PUNICODE_STRING ValueName);
|
IN BLOCK_OFFSET KeyCellOffset,
|
||||||
|
IN PUNICODE_STRING ValueName);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CmiAllocateHashTableBlock(IN PREGISTRY_HIVE RegistryHive,
|
CmiAllocateHashTableBlock(IN PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
|
@ -162,7 +162,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
{
|
{
|
||||||
KeyObject->KeyCell->ParentKeyOffset = -1;
|
KeyObject->KeyCell->ParentKeyOffset = -1;
|
||||||
KeyObject->KeyCell->SecurityKeyOffset = -1;
|
KeyObject->KeyCell->SecurityKeyOffset = -1;
|
||||||
/* This key must rest in memory unless it is deleted
|
/* This key must remain in memory unless it is deleted
|
||||||
or file is unloaded */
|
or file is unloaded */
|
||||||
ObReferenceObjectByPointer(KeyObject,
|
ObReferenceObjectByPointer(KeyObject,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
|
@ -1394,7 +1394,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
||||||
/* Acquire hive lock */
|
/* Acquire hive lock exclucively */
|
||||||
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
|
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
|
||||||
|
|
||||||
VERIFY_KEY_OBJECT(KeyObject);
|
VERIFY_KEY_OBJECT(KeyObject);
|
||||||
|
@ -1424,6 +1424,10 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
ValueName,
|
ValueName,
|
||||||
&ValueCell,
|
&ValueCell,
|
||||||
&VBOffset);
|
&VBOffset);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
CmiMarkBlockDirty(RegistryHive, VBOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -1453,6 +1457,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
ValueCell->DataSize = DataSize | 0x80000000;
|
ValueCell->DataSize = DataSize | 0x80000000;
|
||||||
ValueCell->DataType = Type;
|
ValueCell->DataType = Type;
|
||||||
RtlMoveMemory(&ValueCell->DataOffset, Data, DataSize);
|
RtlMoveMemory(&ValueCell->DataOffset, Data, DataSize);
|
||||||
|
CmiMarkBlockDirty(RegistryHive, VBOffset);
|
||||||
}
|
}
|
||||||
else if (DataSize <= (ULONG) (ValueCell->DataSize & 0x7fffffff))
|
else if (DataSize <= (ULONG) (ValueCell->DataSize & 0x7fffffff))
|
||||||
{
|
{
|
||||||
|
@ -1469,6 +1474,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
{
|
{
|
||||||
ZwQuerySystemTime((PTIME) &pBin->DateModified);
|
ZwQuerySystemTime((PTIME) &pBin->DateModified);
|
||||||
}
|
}
|
||||||
|
CmiMarkBlockDirty(RegistryHive, ValueCell->DataOffset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1508,6 +1514,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
ValueCell->DataType = Type;
|
ValueCell->DataType = Type;
|
||||||
CmiReleaseBlock(RegistryHive, NewDataCell);
|
CmiReleaseBlock(RegistryHive, NewDataCell);
|
||||||
ValueCell->DataOffset = NewOffset;
|
ValueCell->DataOffset = NewOffset;
|
||||||
|
CmiMarkBlockDirty(RegistryHive, ValueCell->DataOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark link key */
|
/* Mark link key */
|
||||||
|
@ -1515,6 +1522,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
(Type == REG_LINK))
|
(Type == REG_LINK))
|
||||||
{
|
{
|
||||||
KeyCell->Type = REG_LINK_KEY_CELL_TYPE;
|
KeyCell->Type = REG_LINK_KEY_CELL_TYPE;
|
||||||
|
CmiMarkBlockDirty(RegistryHive, KeyObject->BlockOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update time of heap */
|
/* Update time of heap */
|
||||||
|
@ -1560,6 +1568,7 @@ NtDeleteValueKey(IN HANDLE KeyHandle,
|
||||||
|
|
||||||
Status = CmiDeleteValueFromKey(KeyObject->RegistryHive,
|
Status = CmiDeleteValueFromKey(KeyObject->RegistryHive,
|
||||||
KeyObject->KeyCell,
|
KeyObject->KeyCell,
|
||||||
|
KeyObject->BlockOffset,
|
||||||
ValueName);
|
ValueName);
|
||||||
|
|
||||||
/* Release hive lock */
|
/* Release hive lock */
|
||||||
|
|
|
@ -1432,6 +1432,13 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
||||||
NtQuerySystemTime((PTIME)&ParentKey->KeyCell->LastWriteTime);
|
NtQuerySystemTime((PTIME)&ParentKey->KeyCell->LastWriteTime);
|
||||||
CmiMarkBlockDirty(RegistryHive,
|
CmiMarkBlockDirty(RegistryHive,
|
||||||
ParentKey->BlockOffset);
|
ParentKey->BlockOffset);
|
||||||
|
|
||||||
|
/* Remove the parent key's hash table */
|
||||||
|
if (ParentKey->KeyCell->NumberOfSubKeys == 0)
|
||||||
|
{
|
||||||
|
DPRINT1("FIXME: Remove parent key hash table\n")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy key cell */
|
/* Destroy key cell */
|
||||||
|
@ -1441,6 +1448,8 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
||||||
SubKey->BlockOffset = -1;
|
SubKey->BlockOffset = -1;
|
||||||
SubKey->KeyCell = NULL;
|
SubKey->KeyCell = NULL;
|
||||||
|
|
||||||
|
/* FIXME: Merge free blocks within the Bin */
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1617,6 +1626,7 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
||||||
IN PKEY_CELL KeyCell,
|
IN PKEY_CELL KeyCell,
|
||||||
|
IN BLOCK_OFFSET KeyCellOffset,
|
||||||
IN PUNICODE_STRING ValueName)
|
IN PUNICODE_STRING ValueName)
|
||||||
{
|
{
|
||||||
PVALUE_LIST_CELL ValueListCell;
|
PVALUE_LIST_CELL ValueListCell;
|
||||||
|
@ -1662,6 +1672,21 @@ CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
CmiReleaseBlock(RegistryHive, ValueListCell);
|
CmiReleaseBlock(RegistryHive, ValueListCell);
|
||||||
|
|
||||||
|
if (KeyCell->NumberOfValues == 0)
|
||||||
|
{
|
||||||
|
CmiDestroyBlock(RegistryHive,
|
||||||
|
ValueListCell,
|
||||||
|
KeyCell->ValuesOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CmiMarkBlockDirty(RegistryHive,
|
||||||
|
KeyCell->ValuesOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
CmiMarkBlockDirty(RegistryHive,
|
||||||
|
KeyCellOffset);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1808,7 +1833,7 @@ CmiAllocateValueCell(PREGISTRY_HIVE RegistryHive,
|
||||||
NewValueCell->Flags |= REG_VALUE_NAME_PACKED;
|
NewValueCell->Flags |= REG_VALUE_NAME_PACKED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Copy the value name */
|
/* Copy the value name */
|
||||||
RtlCopyMemory(NewValueCell->Name,
|
RtlCopyMemory(NewValueCell->Name,
|
||||||
ValueName->Buffer,
|
ValueName->Buffer,
|
||||||
|
@ -1836,8 +1861,8 @@ CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
VERIFY_VALUE_CELL(ValueCell);
|
VERIFY_VALUE_CELL(ValueCell);
|
||||||
|
|
||||||
/* First, release datas: */
|
/* First, release data: */
|
||||||
if (ValueCell->DataSize > 0)
|
if (ValueCell->DataSize > 4)
|
||||||
{
|
{
|
||||||
pBlock = CmiGetBlock(RegistryHive, ValueCell->DataOffset, &pBin);
|
pBlock = CmiGetBlock(RegistryHive, ValueCell->DataOffset, &pBin);
|
||||||
Status = CmiDestroyBlock(RegistryHive, pBlock, ValueCell->DataOffset);
|
Status = CmiDestroyBlock(RegistryHive, pBlock, ValueCell->DataOffset);
|
||||||
|
@ -2261,7 +2286,8 @@ CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
Index = (ULONG)BlockOffset / 4096;
|
Index = (ULONG)BlockOffset / 4096;
|
||||||
|
|
||||||
DPRINT1("CmiMarkBlockDirty(Offset 0x%lx) Index %lu\n", (ULONG)BlockOffset, Index);
|
DPRINT1("CmiMarkBlockDirty(Offset 0x%lx) Index %lu\n",
|
||||||
|
(ULONG)BlockOffset, Index);
|
||||||
|
|
||||||
RegistryHive->HiveDirty = TRUE;
|
RegistryHive->HiveDirty = TRUE;
|
||||||
RtlSetBits(&RegistryHive->DirtyBitMap,
|
RtlSetBits(&RegistryHive->DirtyBitMap,
|
||||||
|
|
Loading…
Reference in a new issue