- Add a check to the boot.ini-changing code, to prevent creation of a new ReactOS...
authorAleksey Bragin <aleksey@reactos.org>
Sun, 1 Oct 2006 21:48:05 +0000 (21:48 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Sun, 1 Oct 2006 21:48:05 +0000 (21:48 +0000)
svn path=/trunk/; revision=24356

reactos/base/setup/usetup/bootsup.c

index 3ee5573..4e5b0d7 100644 (file)
@@ -1665,6 +1665,7 @@ UpdateBootIni(PWSTR BootIniPath,
   PINICACHESECTION Section = NULL;
   NTSTATUS Status;
   ULONG FileAttribute;
+  PWCHAR OldValue = NULL;
 
   RtlInitUnicodeString(&Name,
                       BootIniPath);
@@ -1685,11 +1686,20 @@ UpdateBootIni(PWSTR BootIniPath,
     return(STATUS_UNSUCCESSFUL);
   }
 
-  IniCacheInsertKey(Section,
+  /* Check - maybe record already exists */
+  Status = IniCacheGetKey(Section,
+                    EntryName,
+                    &OldValue);
+
+  /* If either key was not found, or contains something else - add new one */
+  if (!NT_SUCCESS(Status) || wcscmp(OldValue, EntryValue))
+  {
+    IniCacheInsertKey(Section,
                    NULL,
                    INSERT_LAST,
                    EntryName,
                    EntryValue);
+  }
 
   Status = UnprotectBootIni(BootIniPath,
                            &FileAttribute);