From: Hermès Bélusca-Maïto Date: Mon, 8 Oct 2018 22:09:27 +0000 (+0200) Subject: [MKHIVE] Minor additional functionality. X-Git-Tag: 0.4.12-dev~564 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=efbe071e02e10a29e173b7f4c44959aaea5cf857;ds=sidebyside [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. --- diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake index e86b6395299..95fbf2b5fdb 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 39a443b32a3..ad667fd43f5 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: \n\n" + printf("Usage: mkhive [-?] -h:hive1[,hiveN...] [-u] -d: \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;