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

commit a0060cdcee5b900fffc9776a53dcea347b516224
Author:     winesync <[email protected]>
AuthorDate: Sun Jan 16 21:10:12 2022 +0100
Commit:     Thomas Csovcsity <[email protected]>
CommitDate: Sun Jun 19 13:06:33 2022 +0200

    [WINESYNC] reg: Print the full key path without a trailing backslash.
    
    Signed-off-by: Hugh McMaster <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id e685718c3b701b67e1920a8e4f2ddce31d3ca800 by Hugh McMaster 
<[email protected]>
    
    manual adjustment needed
---
 base/applications/cmdutils/reg/reg.c   | 14 +++++++++++---
 modules/rostests/winetests/reg/query.c |  2 +-
 sdk/tools/winesync/reg.cfg             |  2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/base/applications/cmdutils/reg/reg.c 
b/base/applications/cmdutils/reg/reg.c
index d77654c81fe..0938bffe53e 100644
--- a/base/applications/cmdutils/reg/reg.c
+++ b/base/applications/cmdutils/reg/reg.c
@@ -205,10 +205,10 @@ WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, 
WCHAR *subkey_name, DWORD
 
 WCHAR *get_long_key(HKEY root, WCHAR *path)
 {
-    DWORD i, array_size = ARRAY_SIZE(root_rels), len;
+    int i, len, path_len;
     WCHAR *long_key;
 
-    for (i = 0; i < array_size; i++)
+    for (i = 0; i < ARRAY_SIZE(root_rels); i++)
     {
         if (root == root_rels[i].key)
             break;
@@ -223,7 +223,15 @@ WCHAR *get_long_key(HKEY root, WCHAR *path)
         return long_key;
     }
 
-    len += lstrlenW(path) + 1; /* add one for the backslash */
+    path_len = lstrlenW(path);
+
+    if (path[path_len - 1] == '\\')
+    {
+        path[path_len - 1] = 0;
+        path_len--;
+    }
+
+    len += path_len + 1; /* add one for the concatenating backslash */
     long_key = malloc((len + 1) * sizeof(WCHAR));
     swprintf(long_key, L"%s\\%s", root_rels[i].long_name, path);
     return long_key;
diff --git a/modules/rostests/winetests/reg/query.c 
b/modules/rostests/winetests/reg/query.c
index 5c97554648e..34196c77aa4 100644
--- a/modules/rostests/winetests/reg/query.c
+++ b/modules/rostests/winetests/reg/query.c
@@ -251,7 +251,7 @@ static void test_query(void)
 
     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);
-    compare_query(buf, test6, FALSE, TODO_REG_COMPARE);
+    compare_query(buf, test6, FALSE, 0);
 
     read_reg_output("reg query HKCU\\" KEY_BASE " /v Wine /s", buf, 
sizeof(buf), &r);
     ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */,
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index 81008da16da..ee2ece72dec 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: 797520db8f7eb708845891da6f08d3030393d6bc
+  wine: e685718c3b701b67e1920a8e4f2ddce31d3ca800

Reply via email to