+ /* Skip this registry hive if it's not in the list */
+ if (!strstr(HiveList, RegistryHives[i].HiveName))
+ continue;
+
+ strcpy(FileName, DestPath);
+ strcat(FileName, DIR_SEPARATOR_STRING);
+
+ ptr = FileName + strlen(FileName);
+
+ strcat(FileName, RegistryHives[i].HiveName);
+
+ /* Exception for the special setup registry hive */
+ // if (strcmp(RegistryHives[i].HiveName, "SETUPREG") == 0)
+ if (i == 0)
+ strcat(FileName, ".HIV");
+
+ /* Adjust file name case if needed */
+ if (UpperCaseFileName)
+ {
+ for (; *ptr; ++ptr)
+ *ptr = toupper(*ptr);
+ }
+ else
+ {
+ for (; *ptr; ++ptr)
+ *ptr = tolower(*ptr);
+ }
+
+ if (!ExportBinaryHive(FileName, RegistryHives[i].CmHive))
+ goto Quit;
+
+ /* If we happen to deal with the special setup registry hive, stop there */
+ // if (strcmp(RegistryHives[i].HiveName, "SETUPREG") == 0)
+ if (i == 0)
+ break;