https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9ac771683e9e4717c0631617a912b96504780cc

commit d9ac771683e9e4717c0631617a912b96504780cc
Author:     winesync <[email protected]>
AuthorDate: Sun Jan 16 21:15:48 2022 +0100
Commit:     Thomas Csovcsity <[email protected]>
CommitDate: Sun Jun 19 13:06:34 2022 +0200

    [WINESYNC] reg: Don't enumerate a registry key for subkeys if we know the 
key does not have subkeys.
    
    Signed-off-by: Hugh McMaster <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 33cfc644a055a9bc88253ae8d8c824ad603e7a02 by Hugh McMaster 
<[email protected]>
---
 base/applications/cmdutils/reg/query.c | 9 ++++++---
 sdk/tools/winesync/reg.cfg             | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/base/applications/cmdutils/reg/query.c 
b/base/applications/cmdutils/reg/query.c
index 66e54548688..7e42719faf9 100644
--- a/base/applications/cmdutils/reg/query.c
+++ b/base/applications/cmdutils/reg/query.c
@@ -213,7 +213,7 @@ static int query_value(HKEY hkey, WCHAR *value_name, WCHAR 
*path, BOOL recurse)
 static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing)
 {
     LONG rc;
-    DWORD num_values;
+    DWORD num_subkeys, num_values;
     DWORD max_value_len = 256, value_len;
     DWORD max_data_bytes = 2048, data_size;
     DWORD subkey_len;
@@ -222,8 +222,8 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, 
BOOL recursing)
     BYTE *data;
     HKEY subkey;
 
-    rc = RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL,
-                          &num_values, NULL, NULL, NULL, NULL);
+    rc = RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &num_subkeys, NULL,
+                          NULL, &num_values, NULL, NULL, NULL, NULL);
     if (rc) return 1;
 
     if (num_values || recursing)
@@ -265,6 +265,9 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, 
BOOL recursing)
     if (i || recursing)
         output_string(newlineW);
 
+    if (!num_subkeys)
+        return 0;
+
     subkey_name = malloc(MAX_SUBKEY_LEN * sizeof(WCHAR));
 
     path_len = lstrlenW(path);
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index bc02cb30a1e..09d6e269b34 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: 35ccb87a767394ea3054c8890ad7b245e431290d
+  wine: 33cfc644a055a9bc88253ae8d8c824ad603e7a02

Reply via email to