mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed wrong interpretation of value cell size in NtSetValueKey().
svn path=/trunk/; revision=3105
This commit is contained in:
parent
7c5d3bb9ef
commit
e6b5136b65
2 changed files with 93 additions and 93 deletions
|
@ -1218,9 +1218,8 @@ NtSetValueKey(
|
|||
UserMode,
|
||||
(PVOID *) &KeyObject,
|
||||
NULL);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
return(Status);
|
||||
|
||||
VERIFY_KEY_OBJECT(KeyObject);
|
||||
|
||||
|
@ -1232,13 +1231,12 @@ NtSetValueKey(
|
|||
ValueName2,
|
||||
&ValueCell,
|
||||
&VBOffset);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Value not found. Status 0x%X\n", Status);
|
||||
|
||||
ObDereferenceObject(KeyObject);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
// KeAcquireSpinLock(&RegistryHive->RegLock, &OldIrql);
|
||||
|
@ -1255,8 +1253,9 @@ NtSetValueKey(
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Cannot add value. Status 0x%X\n", Status);
|
||||
|
||||
ObDereferenceObject(KeyObject);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1265,8 +1264,9 @@ NtSetValueKey(
|
|||
/* If datasize <= 4 then write in valueblock directly */
|
||||
if (DataSize <= 4)
|
||||
{
|
||||
if ((ValueCell->DataSize < 0)
|
||||
&& (DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize);
|
||||
if ((ValueCell->DataSize >= 0) &&
|
||||
(DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
{
|
||||
CmiDestroyBlock(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
}
|
||||
|
@ -1295,13 +1295,13 @@ NtSetValueKey(
|
|||
BLOCK_OFFSET NewOffset;
|
||||
|
||||
/* Destroy current data block and allocate a new one */
|
||||
if ((ValueCell->DataSize < 0)
|
||||
&& (DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
if ((ValueCell->DataSize >= 0) &&
|
||||
(DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL)))
|
||||
{
|
||||
CmiDestroyBlock(RegistryHive, DataCell, ValueCell->DataOffset);
|
||||
}
|
||||
Status = CmiAllocateBlock(RegistryHive,
|
||||
(PVOID *) &NewDataCell,
|
||||
(PVOID *)&NewDataCell,
|
||||
DataSize,
|
||||
&NewOffset);
|
||||
RtlCopyMemory(&NewDataCell->Data[0], Data, DataSize);
|
||||
|
@ -1320,11 +1320,11 @@ NtSetValueKey(
|
|||
|
||||
// KeReleaseSpinLock(&RegistryHive->RegLock, OldIrql);
|
||||
|
||||
ObDereferenceObject (KeyObject);
|
||||
ObDereferenceObject(KeyObject);
|
||||
|
||||
DPRINT("Return Status 0x%X\n", Status);
|
||||
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -621,7 +621,7 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue