reg: Move 'import' syntax checks to reg_import().

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2021-03-18 22:36:51 +11:00 committed by Alexandre Julliard
parent 8801118e38
commit 4cbf47054f
3 changed files with 13 additions and 11 deletions

View File

@ -983,13 +983,22 @@ cleanup:
return NULL;
}
int reg_import(const WCHAR *filename)
int reg_import(int argc, WCHAR *argvW[])
{
WCHAR *filename, *pos;
FILE *fp;
static const WCHAR rb_mode[] = {'r','b',0};
BYTE s[2];
struct parser parser;
WCHAR *pos;
if (argc > 3)
{
output_message(STRING_INVALID_SYNTAX);
output_message(STRING_FUNC_HELP, wcsupr(argvW[1]));
return 1;
}
filename = argvW[2];
fp = _wfopen(filename, rb_mode);
if (!fp)

View File

@ -389,15 +389,8 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
return 0;
}
if (op == REG_IMPORT && argc > 3)
{
output_message(STRING_INVALID_SYNTAX);
output_message(STRING_FUNC_HELP, wcsupr(argvW[1]));
return 1;
}
if (op == REG_IMPORT)
return reg_import(argvW[2]);
return reg_import(argc, argvW);
if (op == REG_EXPORT)
return reg_export(argc, argvW);

View File

@ -56,7 +56,7 @@ int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
int reg_export(int argc, WCHAR *argv[]);
/* import.c */
int reg_import(const WCHAR *filename);
int reg_import(int argc, WCHAR *argvW[]);
/* query.c */
int reg_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,