[MKHIVE] Fixes for the previous fixes.

- Fix parsing of the options.
- Only uppercase the file name part and NOT the full path!
  And do it in a way GCC-Linux correctly understands, aka.:
      *ptr = toupper(*ptr); ++ptr;
  but NOT!:
      *ptr++ = toupper(*ptr);
  (that last one worked on GCC-Win and MSVC).

[CMAKE] Let's keep SETUPREG.HIV and BCD hive file names in uppercase
(use the '-u' switch) while keeping the other ones in lowercase.

Should definitively fix GCCLin builder!
This commit is contained in:
Hermès Bélusca-Maïto 2018-10-09 01:23:52 +02:00
parent f37dd1e10a
commit 4e6fc201a0
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 15 additions and 13 deletions

View file

@ -810,15 +810,15 @@ function(create_registry_hives)
# BootCD setup system hive
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/setupreg.hiv
COMMAND native-mkhive -h:SETUPREG -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivesys_utf16.inf
OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV
COMMAND native-mkhive -h:SETUPREG -u -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivesys_utf16.inf
DEPENDS native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/hivesys_utf16.inf)
add_custom_target(bootcd_hives
DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/setupreg.hiv)
DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV)
add_cd_file(
FILE ${CMAKE_BINARY_DIR}/boot/bootdata/setupreg.hiv
FILE ${CMAKE_BINARY_DIR}/boot/bootdata/SETUPREG.HIV
TARGET bootcd_hives
DESTINATION reactos
NO_CAB
@ -859,7 +859,7 @@ function(create_registry_hives)
# BCD Hive
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/BCD
COMMAND native-mkhive -h:BCD -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf
COMMAND native-mkhive -h:BCD -u -d:${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf
DEPENDS native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf)
add_custom_target(bcd_hive

View file

@ -92,6 +92,7 @@ int main(int argc, char *argv[])
{
INT ret;
UINT i;
PSTR ptr;
BOOL UpperCaseFileName = FALSE;
PCSTR HiveList = NULL;
CHAR DestPath[PATH_MAX] = "";
@ -108,13 +109,13 @@ int main(int argc, char *argv[])
/* Read the options */
for (i = 1; i < argc && *argv[i] == '-'; i++)
{
if (argv[i][1] == '?' && argv[i][1] == 0)
if (argv[i][1] == '?' && argv[i][2] == 0)
{
usage();
return 0;
}
if (argv[i][1] == 'u' && argv[i][1] == 0)
if (argv[i][1] == 'u' && argv[i][2] == 0)
{
UpperCaseFileName = TRUE;
}
@ -173,6 +174,9 @@ int main(int argc, char *argv[])
strcpy(FileName, DestPath);
strcat(FileName, DIR_SEPARATOR_STRING);
ptr = FileName + strlen(FileName);
strcat(FileName, RegistryHives[i].HiveName);
/* Exception for the special setup registry hive */
@ -183,15 +187,13 @@ int main(int argc, char *argv[])
/* Adjust file name case if needed */
if (UpperCaseFileName)
{
PSTR ptr = FileName;
while (*ptr)
*ptr++ = toupper(*ptr);
for (; *ptr; ++ptr)
*ptr = toupper(*ptr);
}
else
{
PSTR ptr = FileName;
while (*ptr)
*ptr++ = tolower(*ptr);
for (; *ptr; ++ptr)
*ptr = tolower(*ptr);
}
if (!ExportBinaryHive(FileName, RegistryHives[i].CmHive))