https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4e6fc201a0b8cd12def21…
commit 4e6fc201a0b8cd12def213363fdc8d7d7a4fa13d
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue Oct 9 01:23:52 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Oct 9 01:33:10 2018 +0200
[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!
---
sdk/cmake/CMakeMacros.cmake | 10 +++++-----
sdk/tools/mkhive/mkhive.c | 18 ++++++++++--------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake
index 95fbf2b5fd..257fece149 100644
--- a/sdk/cmake/CMakeMacros.cmake
+++ b/sdk/cmake/CMakeMacros.cmake
@@ -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
diff --git a/sdk/tools/mkhive/mkhive.c b/sdk/tools/mkhive/mkhive.c
index d09d97f290..7458a5a71f 100644
--- a/sdk/tools/mkhive/mkhive.c
+++ b/sdk/tools/mkhive/mkhive.c
@@ -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))