https://git.reactos.org/?p=reactos.git;a=commitdiff;h=181292dc07b496aeaf4ba…
commit 181292dc07b496aeaf4ba9faa9be098b476f85bf
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:21:18 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:36 2022 +0200
[WINESYNC] reg: Add initial support for the 'copy' command.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id ac32dd8abcdd93f5428ba93c8aff7f0bb5a7c2f2 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
manual adjustment needed
---
base/applications/cmdutils/reg/copy.c | 24 ++++++++++++++++++++++++
base/applications/cmdutils/reg/lang/en-US.rc | 22 ++++++++++++++++++++++
base/applications/cmdutils/reg/reg.c | 6 ++++++
base/applications/cmdutils/reg/reg.h | 3 +++
base/applications/cmdutils/reg/resource.h | 1 +
modules/rostests/winetests/reg/copy.c | 14 +++++++-------
sdk/tools/winesync/reg.cfg | 2 +-
7 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/base/applications/cmdutils/reg/copy.c
b/base/applications/cmdutils/reg/copy.c
new file mode 100644
index 00000000000..ba0916e9956
--- /dev/null
+++ b/base/applications/cmdutils/reg/copy.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2021 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 "reg.h"
+
+int reg_copy(int argc, WCHAR *argvW[])
+{
+ return 1;
+}
diff --git a/base/applications/cmdutils/reg/lang/en-US.rc
b/base/applications/cmdutils/reg/lang/en-US.rc
index 2fb2c253aa6..612d4e15cf8 100644
--- a/base/applications/cmdutils/reg/lang/en-US.rc
+++ b/base/applications/cmdutils/reg/lang/en-US.rc
@@ -148,9 +148,31 @@ STRINGTABLE
STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to
overwrite it?"
STRING_KEY_NONEXIST, "reg: Unable to find the specified registry key\n"
STRING_KEY_IMPORT_FAILED, "reg: Unable to import the registry key
'%1'\n"
+
STRING_REG_VIEW_USAGE, " /reg:32\n\
\ Access the registry using the 32-bit view.\n\n\
\ /reg:64\n\
\ Access the registry using the 64-bit view.\n\n"
STRING_ACCESS_DENIED, "reg: Unable to access or create the specified registry
key\n"
+
+ STRING_COPY_USAGE, "REG COPY <key1> <key2> [/s] [/f]\n\n\
+\ Copies the contents of a specified registry key to another location.\n\
+\ By default, this operation only copies registry values. Use [/s] to\n\
+\ recursively copy all subkeys and values.\n\n\
+\ <key1>, <key2>\n\
+\ Registry keys specifying the source (<key1>) and destination
(<key2>)\n\
+\ of the data. If <key2> does not exist, it is created.\n\n\
+\ Format: ROOT\\Subkey\n\n\
+\ ROOT: A predefined registry key. This must be one of the following:\n\n\
+\ HKEY_LOCAL_MACHINE | HKLM\n\
+\ HKEY_CURRENT_USER | HKCU\n\
+\ HKEY_CLASSES_ROOT | HKCR\n\
+\ HKEY_USERS | HKU\n\
+\ HKEY_CURRENT_CONFIG | HKCC\n\n\
+\ Subkey: The full path to a registry key under a given ROOT key.\n\n\
+\ /s\n\
+\ Copy all subkeys and values from <key1> to <key2>.\n\n\
+\ /f\n\
+\ Overwrite all registry data in <key2> without prompting for confirmation.\n\
+\ This option does not modify subkeys and values that only exist in
<key2>.\n\n"
}
diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c
index 0938bffe53e..d4c915d5c6e 100644
--- a/base/applications/cmdutils/reg/reg.c
+++ b/base/applications/cmdutils/reg/reg.c
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Andrew Riedi
+ * Copyright 2016-2017, 2021 Hugh McMaster
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -285,6 +286,7 @@ static BOOL is_help_switch(const WCHAR *s)
enum operations {
REG_ADD,
+ REG_COPY,
REG_DELETE,
REG_EXPORT,
REG_IMPORT,
@@ -299,6 +301,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help)
static const struct op_info op_array[] =
{
{ L"add", REG_ADD, STRING_ADD_USAGE },
+ { L"copy", REG_COPY, STRING_COPY_USAGE },
{ L"delete", REG_DELETE, STRING_DELETE_USAGE },
{ L"export", REG_EXPORT, STRING_EXPORT_USAGE },
{ L"import", REG_IMPORT, STRING_IMPORT_USAGE },
@@ -362,6 +365,9 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
if (op == REG_ADD)
return reg_add(argc, argvW);
+ if (op == REG_COPY)
+ return reg_copy(argc, argvW);
+
if (op == REG_DELETE)
return reg_delete(argc, argvW);
diff --git a/base/applications/cmdutils/reg/reg.h b/base/applications/cmdutils/reg/reg.h
index b12d936d672..67b49b7797f 100644
--- a/base/applications/cmdutils/reg/reg.h
+++ b/base/applications/cmdutils/reg/reg.h
@@ -47,6 +47,9 @@ BOOL is_switch(const WCHAR *s, const WCHAR c);
/* add.c */
int reg_add(int argc, WCHAR *argvW[]);
+/* copy.c */
+int reg_copy(int argc, WCHAR *argvW[]);
+
/* delete.c */
int reg_delete(int argc, WCHAR *argvW[]);
diff --git a/base/applications/cmdutils/reg/resource.h
b/base/applications/cmdutils/reg/resource.h
index 3dc103b56b9..68b8ef86920 100644
--- a/base/applications/cmdutils/reg/resource.h
+++ b/base/applications/cmdutils/reg/resource.h
@@ -65,3 +65,4 @@
#define STRING_KEY_IMPORT_FAILED 140
#define STRING_REG_VIEW_USAGE 141
#define STRING_ACCESS_DENIED 142
+#define STRING_COPY_USAGE 143
diff --git a/modules/rostests/winetests/reg/copy.c
b/modules/rostests/winetests/reg/copy.c
index 53d990811ac..ecd3cc5b29d 100644
--- a/modules/rostests/winetests/reg/copy.c
+++ b/modules/rostests/winetests/reg/copy.c
@@ -28,25 +28,25 @@ static void test_command_syntax(void)
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg copy /?", &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 copy /h", &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 copy -H", &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 copy /? /f", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg copy /h /f", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg copy /? /s", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg copy /h /s", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg copy /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index 4379cb99a16..ce8560ddeb3 100644
--- a/sdk/tools/winesync/reg.cfg
+++ b/sdk/tools/winesync/reg.cfg
@@ -4,4 +4,4 @@ directories:
files:
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
tags:
- wine: 537cd26f7cf799bf51875d1bc4970ec79a1184a3
+ wine: ac32dd8abcdd93f5428ba93c8aff7f0bb5a7c2f2