https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c69933739b91e89c564d0…
commit c69933739b91e89c564d02783490420e1891efdf
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Jan 17 18:47:37 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:38 2022 +0200
[WINESYNC] reg: Support use of registry views in the 'query' operation.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 8eef4a873513cca9ffea61fb225fa8a9c8ac784d by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/query.c | 24 +++++++++++++++++++-----
modules/rostests/winetests/reg/query.c | 24 ++++++++++++------------
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/base/applications/cmdutils/reg/query.c
b/base/applications/cmdutils/reg/query.c
index 4886fb84bc1..c1d08541c68 100644
--- a/base/applications/cmdutils/reg/query.c
+++ b/base/applications/cmdutils/reg/query.c
@@ -140,6 +140,7 @@ static void output_value(const WCHAR *value_name, DWORD type, BYTE
*data, DWORD
}
static unsigned int num_values_found = 0;
+static REGSAM sam = 0;
static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path, BOOL recurse)
{
@@ -203,7 +204,7 @@ static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path, BOOL
recurse)
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))
{
query_value(subkey, value_name, subkey_path, recurse);
RegCloseKey(subkey);
@@ -290,7 +291,7 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL
recursing)
if (recurse)
{
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))
{
query_all(subkey, subkey_path, recurse, TRUE);
RegCloseKey(subkey);
@@ -308,12 +309,12 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL
recursing)
}
static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
- BOOL value_empty, BOOL recurse)
+ BOOL value_empty, BOOL recurse)
{
HKEY hkey;
int ret;
- if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey) != ERROR_SUCCESS)
+ if (RegOpenKeyExW(root, path, 0, KEY_READ|sam, &hkey))
{
output_message(STRING_KEY_NONEXIST);
return 1;
@@ -360,8 +361,18 @@ int reg_query(int argc, WCHAR *argvW[])
value_empty = TRUE;
continue;
}
- 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 if (!str[0] || str[1])
goto invalid;
@@ -383,6 +394,9 @@ int reg_query(int argc, WCHAR *argvW[])
if (value_name && value_empty)
goto invalid;
+ if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY))
+ goto invalid;
+
key_name = get_long_key(root, path);
return run_query(root, path, key_name, value_name, value_empty, recurse);
diff --git a/modules/rostests/winetests/reg/query.c
b/modules/rostests/winetests/reg/query.c
index dcc98a9a0c4..a63b341546f 100644
--- a/modules/rostests/winetests/reg/query.c
+++ b/modules/rostests/winetests/reg/query.c
@@ -414,16 +414,16 @@ static void test_registry_view_win64(void)
create_test_key(KEY_WOW64_32KEY);
read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf,
sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9a, FALSE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9a, FALSE, 0);
read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf,
sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9b, FALSE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9b, FALSE, 0);
read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s
/reg:32", buf, sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9c, TRUE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9c, TRUE, 0);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
@@ -480,16 +480,16 @@ static void test_registry_view_wow64(void)
create_test_key(KEY_WOW64_64KEY);
read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf,
sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9a, FALSE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9a, FALSE, 0);
read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf,
sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9b, FALSE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9b, FALSE, 0);
read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s
/reg:64", buf, sizeof(buf), &r);
- todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test9c, TRUE, TODO_REG_COMPARE);
+ ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ compare_query(buf, test9c, TRUE, 0);
delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
}
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index e1bdad26147..2bf8febe542 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: 48c73868720606ab62ae089ee3b9c978736bd530
+ wine: 8eef4a873513cca9ffea61fb225fa8a9c8ac784d