https://git.reactos.org/?p=reactos.git;a=commitdiff;h=14b77379a7668d31e3efeā¦
commit 14b77379a7668d31e3efe34c66e5ee103743841d
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:15:48 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:33 2022 +0200
[WINESYNC] reg: Only print the name of the registry key if it contains values or we
are recursing.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id ec0a799ea8884479d7b56b81fb9fdd106f1a751b by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/query.c | 14 ++++++++++----
modules/rostests/winetests/reg/query.c | 2 +-
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/base/applications/cmdutils/reg/query.c
b/base/applications/cmdutils/reg/query.c
index efcd16f8ad5..4af6c7f5449 100644
--- a/base/applications/cmdutils/reg/query.c
+++ b/base/applications/cmdutils/reg/query.c
@@ -210,9 +210,10 @@ static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path,
BOOL recurse)
return 0;
}
-static int query_all(HKEY hkey, WCHAR *path, BOOL recurse)
+static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing)
{
LONG rc;
+ DWORD num_values;
DWORD max_value_len = 256, value_len;
DWORD max_data_bytes = 2048, data_size;
DWORD subkey_len;
@@ -221,7 +222,12 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse)
BYTE *data;
HKEY subkey;
- output_string(L"%1\n", path);
+ rc = RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL,
+ &num_values, NULL, NULL, NULL, NULL);
+ if (rc) return 1;
+
+ if (num_values || recursing)
+ output_string(L"%1\n", path);
value_name = malloc(max_value_len * sizeof(WCHAR));
data = malloc(max_data_bytes);
@@ -275,7 +281,7 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse)
subkey_path = build_subkey_path(path, path_len, subkey_name,
subkey_len);
if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ, &subkey))
{
- query_all(subkey, subkey_path, recurse);
+ query_all(subkey, subkey_path, recurse, TRUE);
RegCloseKey(subkey);
}
free(subkey_path);
@@ -311,7 +317,7 @@ static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR
*value_name,
output_message(STRING_MATCHES_FOUND, num_values_found);
}
else
- ret = query_all(hkey, key_name, recurse);
+ ret = query_all(hkey, key_name, recurse, FALSE);
RegCloseKey(hkey);
diff --git a/modules/rostests/winetests/reg/query.c
b/modules/rostests/winetests/reg/query.c
index a8720da8da1..4ccbab58cb8 100644
--- a/modules/rostests/winetests/reg/query.c
+++ b/modules/rostests/winetests/reg/query.c
@@ -282,7 +282,7 @@ static void test_query(void)
read_reg_output("reg query HKCU\\" KEY_BASE, buf, sizeof(buf), &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- compare_query(buf, test8a, FALSE, TODO_REG_COMPARE);
+ compare_query(buf, test8a, FALSE, 0);
read_reg_output("reg query HKCU\\" KEY_BASE " /s", buf,
sizeof(buf), &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index f3c81e9f9a5..93f3edc2ae3 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: f32816268ed5715c5bce20daf9bb20aa194a7127
+ wine: ec0a799ea8884479d7b56b81fb9fdd106f1a751b