https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad80ceabc3b15b8698a68…
commit ad80ceabc3b15b8698a689be42a668205485203e
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Jan 17 18:47:36 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:37 2022 +0200
[WINESYNC] reg: Support the use of registry views during the 'add' operation.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 304b80a9b5a6ed128dd8a89e22f05b99142310cd by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/add.c | 22 ++++++++++++++++++----
modules/rostests/winetests/reg/add.c | 32 ++++++++++++++++----------------
sdk/tools/winesync/reg.cfg | 2 +-
3 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c
index fb0ee2a03fd..269fa30e5e1 100644
--- a/base/applications/cmdutils/reg/add.c
+++ b/base/applications/cmdutils/reg/add.c
@@ -158,7 +158,7 @@ static BOOL get_regdata(const WCHAR *data, DWORD reg_type, WCHAR
separator,
return TRUE;
}
-static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
+static int run_add(HKEY root, WCHAR *path, REGSAM sam, WCHAR *value_name, BOOL
value_empty,
WCHAR *type, WCHAR separator, WCHAR *data, BOOL force)
{
HKEY hkey;
@@ -167,7 +167,7 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL
value_empty,
LONG rc;
if (RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ|KEY_WRITE, NULL, &hkey, &dispos))
+ KEY_READ|KEY_WRITE|sam, NULL, &hkey, &dispos))
{
output_message(STRING_ACCESS_DENIED);
return 1;
@@ -229,6 +229,7 @@ int reg_add(int argc, WCHAR *argvW[])
HKEY root;
WCHAR *path, *value_name = NULL, *type = NULL, *data = NULL, separator =
'\0';
BOOL value_empty = FALSE, force = FALSE;
+ REGSAM sam = 0;
int i;
if (!parse_registry_key(argvW[2], &root, &path))
@@ -249,8 +250,18 @@ int reg_add(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;
@@ -286,7 +297,10 @@ int reg_add(int argc, WCHAR *argvW[])
if (value_name && value_empty)
goto invalid;
- return run_add(root, path, value_name, value_empty, type, separator, data, force);
+ if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY))
+ goto invalid;
+
+ return run_add(root, path, sam, value_name, value_empty, type, separator, data,
force);
invalid:
output_message(STRING_INVALID_SYNTAX);
diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c
index 264693ab349..3b4a895d0c5 100644
--- a/modules/rostests/winetests/reg/add.c
+++ b/modules/rostests/winetests/reg/add.c
@@ -277,13 +277,13 @@ static void test_command_syntax(void)
/* Test registry view */
run_reg_exe("reg add HKCU\\" KEY_BASE " /v abc /d 123 /f /reg:32
/reg:32", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v abc /d 123 /f /reg:32
/reg:64", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v abc /d 123 /f /reg:64
/reg:64", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+ ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
}
static void test_key_formats(void)
@@ -914,12 +914,12 @@ static void test_registry_view_win64(void)
run_reg_exe("reg add HKLM\\" KEY_BASE " /v Wine32 /d Test /f
/reg:32", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- todo_wine open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey);
- todo_wine verify_reg(hkey, "Wine32", REG_SZ, "Test", 5, 0);
- todo_wine close_key(hkey);
- todo_wine delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
+ open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey);
+ verify_reg(hkey, "Wine32", REG_SZ, "Test", 5, 0);
+ close_key(hkey);
+ delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
- todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
+ verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
/* Try adding to the 64-bit registry view (64-bit Windows) */
run_reg_exe("reg add HKLM\\" KEY_BASE " /v Wine64 /d Test /f
/reg:64", &r);
@@ -958,16 +958,16 @@ static void test_registry_view_wow64(void)
run_reg_exe("reg add HKLM\\" KEY_BASE " /v Wine64 /d Test /f
/reg:64", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- todo_wine open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
- todo_wine verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0);
- todo_wine close_key(hkey);
+ open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
+ verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0);
+ close_key(hkey);
- todo_wine open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
- todo_wine verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0);
- todo_wine close_key(hkey);
- todo_wine delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
+ open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
+ verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0);
+ close_key(hkey);
+ delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
- todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
+ verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
}
START_TEST(add)
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index 51f62c396bf..73ccb441c23 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: 24d0d6f524d6c51cc5d8c909bf6cd942d6ae443d
+ wine: 304b80a9b5a6ed128dd8a89e22f05b99142310cd