https://git.reactos.org/?p=reactos.git;a=commitdiff;h=efbe071e02e10a29e173b…
commit efbe071e02e10a29e173b7f4c44959aaea5cf857
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue Oct 9 00:09:27 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Oct 9 00:15:14 2018 +0200
[MKHIVE] Minor additional functionality.
- Add support for '/' switch characters.
- Add '-?' switch.
TEMPORARY:
- Add a '-u' switch to generate hive file names in uppercase (by default
we keep these in lowercase). Should help in fixing GCCLin builder.
[CMAKE] Fix expected file name case. Should help in fixing GCCLin builder.
---
sdk/cmake/CMakeMacros.cmake | 6 +++---
sdk/tools/mkhive/mkhive.c | 34 +++++++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake
index e86b639529..95fbf2b5fd 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
+ 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
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
diff --git a/sdk/tools/mkhive/mkhive.c b/sdk/tools/mkhive/mkhive.c
index 39a443b32a..ad667fd43f 100644
--- a/sdk/tools/mkhive/mkhive.c
+++ b/sdk/tools/mkhive/mkhive.c
@@ -51,11 +51,13 @@
void usage(void)
{
- printf("Usage: mkhive -h:hive1[,hiveN...] -d:<dstdir>
<inffiles>\n\n"
+ printf("Usage: mkhive [-?] -h:hive1[,hiveN...] [-u] -d:<dstdir>
<inffiles>\n\n"
" -h:hiveN - Comma-separated list of hives to create. Possible values
are:\n"
" SETUPREG, SYSTEM, SOFTWARE, DEFAULT, SAM, SECURITY,
BCD.\n"
+ " -u - Generate file names in uppercase (default: lowercase)
(TEMPORARY FLAG!).\n"
" -d:dstdir - The binary hive files are created in this
directory.\n"
- " inffiles - List of INF files with full path.\n");
+ " inffiles - List of INF files with full path.\n"
+ " -? - Displays this help screen.\n");
}
void convert_path(char *dst, char *src)
@@ -90,6 +92,7 @@ int main(int argc, char *argv[])
{
INT ret;
UINT i;
+ BOOL UpperCaseFileName = FALSE;
PCSTR HiveList = NULL;
CHAR DestPath[PATH_MAX] = "";
CHAR FileName[PATH_MAX];
@@ -103,8 +106,19 @@ int main(int argc, char *argv[])
printf("Binary hive maker\n");
/* Read the options */
- for (i = 1; i < argc && *argv[i] == '-'; i++)
+ for (i = 1; i < argc && (*argv[i] == '-' || *argv[i] ==
'/'); i++)
{
+ if (argv[i][1] == '?' && argv[i][1] == 0)
+ {
+ usage();
+ return 0;
+ }
+
+ if (argv[i][1] == 'u' && argv[i][1] == 0)
+ {
+ UpperCaseFileName = TRUE;
+ }
+ else
if (argv[i][1] == 'h' && (argv[i][2] == ':' || argv[i][2]
== '='))
{
HiveList = argv[i] + 3;
@@ -166,6 +180,20 @@ int main(int argc, char *argv[])
if (i == 0)
strcat(FileName, ".HIV");
+ /* Adjust file name case if needed */
+ if (UpperCaseFileName)
+ {
+ PSTR ptr = FileName;
+ while (*ptr)
+ *ptr++ = toupper(*ptr);
+ }
+ else
+ {
+ PSTR ptr = FileName;
+ while (*ptr)
+ *ptr++ = tolower(*ptr);
+ }
+
if (!ExportBinaryHive(FileName, RegistryHives[i].CmHive))
goto Quit;