https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f42b63fd6445bdef03496…
commit f42b63fd6445bdef034965873762dde158cfa9b9
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:10:12 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:33 2022 +0200
[WINESYNC] reg: Fail if a system key has a trailing backslash but no subkey path.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 797520db8f7eb708845891da6f08d3030393d6bc by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/reg.c | 16 +++++++++++++---
modules/rostests/winetests/reg/add.c | 8 ++++----
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c
index c66daeb32b0..d77654c81fe 100644
--- a/base/applications/cmdutils/reg/reg.c
+++ b/base/applications/cmdutils/reg/reg.c
@@ -234,9 +234,6 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
if (!sane_path(key))
return FALSE;
- *path = wcschr(key, '\\');
- if (*path) (*path)++;
-
*root = path_get_rootkey(key);
if (!*root)
{
@@ -244,6 +241,19 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
return FALSE;
}
+ *path = wcschr(key, '\\');
+
+ if (!*path)
+ return TRUE;
+
+ (*path)++;
+
+ if (!**path)
+ {
+ output_message(STRING_INVALID_SYSTEM_KEY);
+ return FALSE;
+ }
+
return TRUE;
}
diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c
index 36b5f821350..6973eefd892 100644
--- a/modules/rostests/winetests/reg/add.c
+++ b/modules/rostests/winetests/reg/add.c
@@ -311,12 +311,12 @@ static void test_key_formats(void)
/* Test validity of trailing backslash after system key */
run_reg_exe("reg add HKCU\\ /v Value1 /t REG_SZ /d foo /f", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
- todo_wine verify_reg_nonexist(HKEY_CURRENT_USER, "Value1");
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ verify_reg_nonexist(HKEY_CURRENT_USER, "Value1");
run_reg_exe("reg add HKEY_CURRENT_USER\\ /v Value2 /t REG_SZ /d bar /f",
&r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
- todo_wine verify_reg_nonexist(HKEY_CURRENT_USER, "Value2");
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ verify_reg_nonexist(HKEY_CURRENT_USER, "Value2");
}
static void test_add(void)
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index 595566ef15f..81008da16da 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: 6d2ab37a44c6d0bd58504cbc3ff20d2828afc841
+ wine: 797520db8f7eb708845891da6f08d3030393d6bc