mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-01 19:26:16 +00:00
[SMSS2]
- Properly handle an empty list in SmpSaveRegistryValue - Compare the value string for equality, as the comment says, not inequality - This fixes a crash, although another solution may perhaps be better svn path=/trunk/; revision=55391
This commit is contained in:
@@ -72,7 +72,10 @@ SmpSaveRegistryValue(IN PLIST_ENTRY ListAddress,
|
||||
RtlInitUnicodeString(&NameString, Name);
|
||||
RtlInitUnicodeString(&ValueString, Value);
|
||||
|
||||
/* Check if we should do a duplicat echeck */
|
||||
/* In case this is the first value, initialize a new list/structure */
|
||||
RegEntry = NULL;
|
||||
|
||||
/* Check if we should do a duplicate check */
|
||||
if (Flags)
|
||||
{
|
||||
/* Loop the current list */
|
||||
@@ -86,9 +89,7 @@ SmpSaveRegistryValue(IN PLIST_ENTRY ListAddress,
|
||||
if (!RtlCompareUnicodeString(&RegEntry->Name, &NameString, TRUE))
|
||||
{
|
||||
/* Check if the value is the exact same thing */
|
||||
if (((Value) &&
|
||||
(RtlCompareUnicodeString(&RegEntry->Value, &ValueString, TRUE))) ||
|
||||
(!(Value) && !(RegEntry->Value.Buffer)))
|
||||
if (!RtlCompareUnicodeString(&RegEntry->Value, &ValueString, TRUE))
|
||||
{
|
||||
/* Fail -- the same setting is being set twice */
|
||||
return STATUS_OBJECT_NAME_EXISTS;
|
||||
@@ -103,11 +104,6 @@ SmpSaveRegistryValue(IN PLIST_ENTRY ListAddress,
|
||||
RegEntry = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This should be the first value, so initialize a new list/structure */
|
||||
RegEntry = NULL;
|
||||
}
|
||||
|
||||
/* Are we adding on, or creating a new entry */
|
||||
if (!RegEntry)
|
||||
@@ -140,6 +136,7 @@ SmpSaveRegistryValue(IN PLIST_ENTRY ListAddress,
|
||||
if (RegEntry->Value.Buffer)
|
||||
{
|
||||
/* Free it */
|
||||
ASSERT(RegEntry->Value.Length != 0);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, RegEntry->Value.Buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user