[ros-diffs] [fireball] 24356: - Add a check to the boot.ini-changing code, to prevent creation of a new ReactOS entry after each installation.

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Oct 1 23:48:05 CEST 2006


Author: fireball
Date: Mon Oct  2 01:48:05 2006
New Revision: 24356

URL: http://svn.reactos.org/svn/reactos?rev=24356&view=rev
Log:
- Add a check to the boot.ini-changing code, to prevent creation of a new ReactOS entry after each installation.

Modified:
    trunk/reactos/base/setup/usetup/bootsup.c

Modified: trunk/reactos/base/setup/usetup/bootsup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/bootsup.c?rev=24356&r1=24355&r2=24356&view=diff
==============================================================================
--- trunk/reactos/base/setup/usetup/bootsup.c (original)
+++ trunk/reactos/base/setup/usetup/bootsup.c Mon Oct  2 01:48:05 2006
@@ -1665,6 +1665,7 @@
   PINICACHESECTION Section = NULL;
   NTSTATUS Status;
   ULONG FileAttribute;
+  PWCHAR OldValue = NULL;
 
   RtlInitUnicodeString(&Name,
 		       BootIniPath);
@@ -1685,11 +1686,20 @@
     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);




More information about the Ros-diffs mailing list