[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.
This commit is contained in:
Hermès Bélusca-Maïto 2018-10-09 00:09:27 +02:00
parent c069ca1797
commit efbe071e02
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 34 additions and 6 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
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

View file

@ -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;