https://git.reactos.org/?p=reactos.git;a=commitdiff;h=29992c17f13d2f8ad082d…
commit 29992c17f13d2f8ad082da2c784dee95be252805
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Jan 17 18:47:39 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:39 2022 +0200
[WINESYNC] reg: Support use of registry views in the 'copy' operation.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50962
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 04d52eb83fa5c37cfe1100f435e36c2f78918338 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/copy.c | 26 ++++++++++++++++++++------
modules/rostests/winetests/reg/copy.c | 16 ++++++++--------
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/base/applications/cmdutils/reg/copy.c
b/base/applications/cmdutils/reg/copy.c
index 3ede5440cb6..2970ab81cc1 100644
--- a/base/applications/cmdutils/reg/copy.c
+++ b/base/applications/cmdutils/reg/copy.c
@@ -77,7 +77,7 @@ static enum operation ask_overwrite_value(WCHAR *path, WCHAR *value)
}
}
-static int run_copy(struct key *src, struct key *dest, BOOL recurse, BOOL force)
+static int run_copy(struct key *src, struct key *dest, REGSAM sam, BOOL recurse, BOOL
force)
{
LONG rc;
DWORD max_subkey_len;
@@ -87,14 +87,14 @@ static int run_copy(struct key *src, struct key *dest, BOOL recurse,
BOOL force)
WCHAR *name = NULL;
BYTE *data = NULL;
- if ((rc = RegOpenKeyExW(src->root, src->subkey, 0, KEY_READ,
&src->hkey)))
+ if ((rc = RegOpenKeyExW(src->root, src->subkey, 0, KEY_READ|sam,
&src->hkey)))
{
output_error(rc);
return 1;
}
if ((rc = RegCreateKeyExW(dest->root, dest->subkey, 0, NULL,
REG_OPTION_NON_VOLATILE,
- KEY_READ|KEY_WRITE, NULL, &dest->hkey,
&dispos)))
+ KEY_READ|KEY_WRITE|sam, NULL, &dest->hkey,
&dispos)))
{
RegCloseKey(src->hkey);
output_error(rc);
@@ -173,7 +173,7 @@ static int run_copy(struct key *src, struct key *dest, BOOL recurse,
BOOL force)
swprintf(subkey_src.path, path_len, L"%s\\%s", src->path, name);
- rc = run_copy(&subkey_src, &subkey_dest, TRUE, force);
+ rc = run_copy(&subkey_src, &subkey_dest, sam, TRUE, force);
free(subkey_src.path);
@@ -194,6 +194,7 @@ int reg_copy(int argc, WCHAR *argvW[])
{
struct key src, dest;
BOOL recurse = FALSE, force = FALSE;
+ REGSAM sam = 0;
int i;
if (argc == 3)
@@ -214,8 +215,18 @@ int reg_copy(int argc, WCHAR *argvW[])
str = &argvW[i][1];
- if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str,
L"reg:64"))
+ if (!lstrcmpiW(str, L"reg:32"))
+ {
+ if (sam & KEY_WOW64_32KEY) goto invalid;
+ sam |= KEY_WOW64_32KEY;
+ continue;
+ }
+ else if (!lstrcmpiW(str, L"reg:64"))
+ {
+ if (sam & KEY_WOW64_64KEY) goto invalid;
+ sam |= KEY_WOW64_64KEY;
continue;
+ }
else if (!str[0] || str[1])
goto invalid;
@@ -234,6 +245,9 @@ int reg_copy(int argc, WCHAR *argvW[])
}
}
+ if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY))
+ goto invalid;
+
if (src.root == dest.root && !lstrcmpiW(src.subkey, dest.subkey))
{
output_message(STRING_COPY_SRC_DEST_SAME);
@@ -242,7 +256,7 @@ int reg_copy(int argc, WCHAR *argvW[])
src.path = src.subkey;
- return run_copy(&src, &dest, recurse, force);
+ return run_copy(&src, &dest, sam, recurse, force);
invalid:
output_message(STRING_INVALID_SYNTAX);
diff --git a/modules/rostests/winetests/reg/copy.c
b/modules/rostests/winetests/reg/copy.c
index 0f9e1221200..bc07c3cafb9 100644
--- a/modules/rostests/winetests/reg/copy.c
+++ b/modules/rostests/winetests/reg/copy.c
@@ -666,11 +666,11 @@ static void test_registry_view_win64(void)
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:32", &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 HKLM\\" KEY_BASE " file.reg /y /reg:32",
&r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- todo_wine ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:64", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@@ -691,7 +691,7 @@ static void test_registry_view_win64(void)
ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:32", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
delete_tree(HKEY_LOCAL_MACHINE, COPY_SRC, KEY_WOW64_64KEY);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
@@ -724,7 +724,7 @@ static void test_registry_view_wow64(void)
ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:64", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
delete_tree(HKEY_LOCAL_MACHINE, COPY_SRC, KEY_WOW64_32KEY);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
@@ -735,11 +735,11 @@ static void test_registry_view_wow64(void)
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:64", &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 HKLM\\" KEY_BASE " file.reg /y /reg:64",
&r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- todo_wine ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
run_reg_exe("reg copy HKLM\\" COPY_SRC " HKLM\\" KEY_BASE "
/s /f /reg:32", &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 a3c5a089804..c833eff4f8d 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: d92f26ed1264ec80f97c0a45a59b986f0b9cae38
+ wine: 04d52eb83fa5c37cfe1100f435e36c2f78918338