Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/Makefile.in | 1 + programs/reg/export.c | 29 +++++++++++++++++++++++++++++ programs/reg/reg.c | 6 ++++++ programs/reg/reg.h | 3 +++ programs/reg/reg.rc | 3 ++- programs/reg/resource.h | 1 + programs/reg/tests/reg.c | 2 +- 7 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 programs/reg/export.c
diff --git a/programs/reg/Makefile.in b/programs/reg/Makefile.in index 256bcde62b..7c6a899362 100644 --- a/programs/reg/Makefile.in +++ b/programs/reg/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = advapi32 DELAYIMPORTS = user32
C_SRCS = \ + export.c \ import.c \ reg.c
diff --git a/programs/reg/export.c b/programs/reg/export.c new file mode 100644 index 0000000000..f4318eff72 --- /dev/null +++ b/programs/reg/export.c @@ -0,0 +1,29 @@ +/* + * Copyright 2017 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windows.h> + +#include <wine/debug.h> + +WINE_DEFAULT_DEBUG_CHANNEL(reg); + +int reg_export(int argc, WCHAR *argv[]) +{ + FIXME(": operation not yet implemented\n"); + return 1; +} diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 42fd6e9daa..7affdd282b 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -908,6 +908,7 @@ enum operations { REG_ADD, REG_DELETE, REG_IMPORT, + REG_EXPORT, REG_QUERY, REG_INVALID }; @@ -919,6 +920,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help) static const WCHAR add[] = {'a','d','d',0}; static const WCHAR delete[] = {'d','e','l','e','t','e',0}; static const WCHAR import[] = {'i','m','p','o','r','t',0}; + static const WCHAR export[] = {'e','x','p','o','r','t',0}; static const WCHAR query[] = {'q','u','e','r','y',0};
static const struct op_info op_array[] = @@ -926,6 +928,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help) { add, REG_ADD, STRING_ADD_USAGE }, { delete, REG_DELETE, STRING_DELETE_USAGE }, { import, REG_IMPORT, STRING_IMPORT_USAGE }, + { export, REG_EXPORT, STRING_EXPORT_USAGE }, { query, REG_QUERY, STRING_QUERY_USAGE }, { NULL, -1, 0 } }; @@ -994,6 +997,9 @@ int wmain(int argc, WCHAR *argvW[]) if (op == REG_IMPORT) return reg_import(argvW[2]);
+ if (op == REG_EXPORT) + return reg_export(argc, argvW); + if (!parse_registry_key(argvW[2], &root, &path, &key_name)) return 1;
diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 07bbecf8d5..b4751e408c 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -33,4 +33,7 @@ HKEY path_get_rootkey(const WCHAR *path); /* import.c */ int reg_import(const WCHAR *filename);
+/* export.c */ +int reg_export(int argc, WCHAR *argv[]); + #endif /* __REG_H__ */ diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 9a00cc1c57..1647e222fa 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -29,7 +29,7 @@ STRINGTABLE STRING_USAGE, "Usage:\n\ \ REG [operation] [parameters]\n\n\ \Supported operations:\n\ -\ ADD | DELETE | IMPORT | QUERY\n\n\ +\ ADD | DELETE | IMPORT | EXPORT | QUERY\n\n\ \For help on a specific operation, type:\n\ \ REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD key_name [/v value_name | /ve] [/t type] [/s separator] [/d data] [/f]\n" @@ -66,4 +66,5 @@ STRINGTABLE STRING_FILE_NOT_FOUND, "reg: The file '%1' was not found.\n" STRING_OPEN_KEY_FAILED, "reg: Unable to open the registry key '%1'.\n" STRING_ESCAPE_SEQUENCE, "reg: Unrecognized escape sequence [\%1!c!]\n" + STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" } diff --git a/programs/reg/resource.h b/programs/reg/resource.h index 1f2c150d63..8441638657 100644 --- a/programs/reg/resource.h +++ b/programs/reg/resource.h @@ -56,3 +56,4 @@ #define STRING_FILE_NOT_FOUND 133 #define STRING_OPEN_KEY_FAILED 134 #define STRING_ESCAPE_SEQUENCE 135 +#define STRING_EXPORT_USAGE 136 diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 0bab8bc2af..9e4a8145a6 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -4389,7 +4389,7 @@ static void test_export(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg export /?", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg export \\remote-pc\HKLM\Wine file.reg", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);