public string AllocateVirtualDeviceInstanceID(string deviceClassName)
        {
            // we will return the larger deviceInstanceID, we don't want to overwrite existing hivesys.inf device instances
            var deviceInstanceID1 = SetupRegistryHive.AllocateVirtualDeviceInstanceID(deviceClassName);
            var deviceInstanceID2 = HiveSystemInf.AllocateVirtualDeviceInstanceID(deviceClassName);

            // string comparison, note that both strings has fixed length with leading zeros
            return(string.CompareOrdinal(deviceInstanceID1, deviceInstanceID2) == 1
                                ? deviceInstanceID1
                                : deviceInstanceID2);
        }
 public void SaveRegistryChanges()
 {
     SetupRegistryHive.UnloadHive(true);
     if (IsTargetContainsTemporaryInstallation)
     {
         FileSystemUtils.ClearReadOnlyAttribute(BootDirectory + SetupRegistryHiveFile.FileName);
         try
         {
             ProgramUtils.CopyCriticalFile(SetupDirectory + SetupRegistryHiveFile.FileName,
                                           BootDirectory + SetupRegistryHiveFile.FileName);
         }
         catch
         {
             Console.WriteLine("Error: failed to copy '{0}' to '{1}' (setup boot folder)", SetupRegistryHiveFile.FileName,
                               BootDirectory);
             Program.Exit();
         }
     }
 }