Author: tfaber
Date: Fri Feb 3 11:21:15 2012
New Revision: 55391
URL: http://svn.reactos.org/svn/reactos?rev=55391&view=rev
Log:
[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
Modified:
trunk/reactos/base/system/smss2/sminit.c
Modified: trunk/reactos/base/system/smss2/sminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss2/sminit.c…
==============================================================================
--- trunk/reactos/base/system/smss2/sminit.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss2/sminit.c [iso-8859-1] Fri Feb 3 11:21:15 2012
@@ -72,7 +72,10 @@
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 @@
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;
@@ -102,11 +103,6 @@
NextEntry = NextEntry->Flink;
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 */
@@ -140,6 +136,7 @@
if (RegEntry->Value.Buffer)
{
/* Free it */
+ ASSERT(RegEntry->Value.Length != 0);
RtlFreeHeap(RtlGetProcessHeap(), 0, RegEntry->Value.Buffer);
}