https://git.reactos.org/?p=reactos.git;a=commitdiff;h=35b9e2d380c4c93dd361f…
commit 35b9e2d380c4c93dd361f74c57e0e45d2c77f537
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Jan 17 18:47:38 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 when exporting registry data.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id fcf79426147adf0d9f1d80b0cf24d0b6abd8bf59 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/export.c | 26 ++++++++++++++++++++------
modules/rostests/winetests/reg/export.c | 10 +++++-----
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/base/applications/cmdutils/reg/export.c
b/base/applications/cmdutils/reg/export.c
index dd8071e80c2..0c1bfd33320 100644
--- a/base/applications/cmdutils/reg/export.c
+++ b/base/applications/cmdutils/reg/export.c
@@ -225,7 +225,7 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
free(buf);
}
-static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path)
+static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path, REGSAM sam)
{
LONG rc;
DWORD max_value_len = 256, value_len;
@@ -284,9 +284,9 @@ static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path)
if (rc == ERROR_SUCCESS)
{
subkey_path = build_subkey_path(path, path_len, subkey_name, subkey_len);
- if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ, &subkey))
+ if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ|sam, &subkey))
{
- export_registry_data(hFile, subkey, subkey_path);
+ export_registry_data(hFile, subkey, subkey_path, sam);
RegCloseKey(subkey);
}
free(subkey_path);
@@ -349,6 +349,7 @@ int reg_export(int argc, WCHAR *argvW[])
HKEY root, hkey;
WCHAR *path, *key_name;
BOOL overwrite_file = FALSE;
+ REGSAM sam = 0;
HANDLE hFile;
int i, ret;
@@ -368,13 +369,26 @@ int reg_export(int argc, WCHAR *argvW[])
if (is_char(*str, 'y') && !str[1])
overwrite_file = TRUE;
- else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str,
L"reg:64"))
+ else 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
goto invalid;
}
- if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey))
+ if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY))
+ goto invalid;
+
+ if (RegOpenKeyExW(root, path, 0, KEY_READ|sam, &hkey))
{
output_message(STRING_KEY_NONEXIST);
return 1;
@@ -384,7 +398,7 @@ int reg_export(int argc, WCHAR *argvW[])
hFile = get_file_handle(argvW[3], overwrite_file);
export_file_header(hFile);
- ret = export_registry_data(hFile, hkey, key_name);
+ ret = export_registry_data(hFile, hkey, key_name, sam);
export_newline(hFile);
CloseHandle(hFile);
diff --git a/modules/rostests/winetests/reg/export.c
b/modules/rostests/winetests/reg/export.c
index 0a460e08bcb..7d352519690 100644
--- a/modules/rostests/winetests/reg/export.c
+++ b/modules/rostests/winetests/reg/export.c
@@ -528,8 +528,8 @@ static void test_registry_view_win64(void)
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
run_reg_exe("reg export HKEY_LOCAL_MACHINE\\" 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,
TODO_REG_COMPARE), "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 export HKEY_LOCAL_MACHINE\\" KEY_BASE " file.reg /y
/reg:64", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@@ -546,7 +546,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 export HKEY_LOCAL_MACHINE\\" KEY_BASE " file.reg /y
/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, KEY_BASE, KEY_WOW64_64KEY);
}
@@ -571,7 +571,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 export HKEY_LOCAL_MACHINE\\" KEY_BASE " file.reg /y
/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, KEY_BASE, KEY_WOW64_32KEY);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
@@ -581,7 +581,7 @@ static void test_registry_view_wow64(void)
verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
run_reg_exe("reg export HKEY_LOCAL_MACHINE\\" KEY_BASE " file.reg /y
/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);
ok(compare_export("file.reg", registry_view_test, 0),
"compare_export() failed\n");
run_reg_exe("reg export HKEY_LOCAL_MACHINE\\" KEY_BASE " file.reg /y
/reg:32", &r);
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index ab2f0c1d1b3..0369f3afbff 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: 0b5ba1d0be04f7c6bc0e53e9a28984cf2941b4bc
+ wine: fcf79426147adf0d9f1d80b0cf24d0b6abd8bf59