ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
236 discussions
Start a n
N
ew thread
[reactos] 138/158: [WINESYNC] reg: Support use of registry views when deleting registry values.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fde082ff9902f26618771…
commit fde082ff9902f26618771638e5d1fea25468d020 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 use of registry views when deleting registry values. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8d42cb9c1ca72e02b8961d6703aaa2e3ddfda5e2 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/delete.c | 22 ++++++++++++++++++---- modules/rostests/winetests/reg/delete.c | 28 ++++++++++++++-------------- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index 8804e16e52f..f6965493faa 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -35,7 +35,7 @@ static void output_error(LONG rc) } } -static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, +static int run_delete(HKEY root, WCHAR *path, REGSAM sam, WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force) { LONG rc; @@ -72,7 +72,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name return 0; } - if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &hkey))) + if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE|sam, &hkey))) { output_error(rc); return 1; @@ -132,6 +132,7 @@ int reg_delete(int argc, WCHAR *argvW[]) HKEY root; WCHAR *path, *key_name, *value_name = NULL; BOOL value_all = FALSE, value_empty = FALSE, force = FALSE; + REGSAM sam = 0; int i; if (!parse_registry_key(argvW[2], &root, &path)) @@ -158,8 +159,18 @@ int reg_delete(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; @@ -181,9 +192,12 @@ int reg_delete(int argc, WCHAR *argvW[]) if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all)) goto invalid; + if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY)) + goto invalid; + key_name = get_long_key(root, path); - return run_delete(root, path, key_name, value_name, value_empty, value_all, force); + return run_delete(root, path, sam, key_name, value_name, value_empty, value_all, force); invalid: output_message(STRING_INVALID_SYNTAX); diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index d6a3b7e1d04..102fc0d788a 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -270,17 +270,17 @@ static void test_registry_view_win64(void) open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:32", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "DWORD"); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:32", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, NULL); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:32", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "String"); - todo_wine verify_reg_nonexist(hkey, "Multiple Strings"); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); verify_key(hkey, "Subkey", KEY_WOW64_32KEY); run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:32", &r); @@ -380,17 +380,17 @@ static void test_registry_view_wow64(void) open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:64", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "DWORD"); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:64", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, NULL); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:64", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "String"); - todo_wine verify_reg_nonexist(hkey, "Multiple Strings"); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); verify_key(hkey, "Subkey", KEY_WOW64_64KEY); run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:64", &r); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index ea212a1f306..c8796ab5481 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: 556121b1cafc2182edaeb7354caf46375205bef7 + wine: 8d42cb9c1ca72e02b8961d6703aaa2e3ddfda5e2
2 years, 6 months
1
0
0
0
[reactos] 137/158: [WINESYNC] reg/tests: Test deletion of keys and values using registry views.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db92c856fd6006546e7ea…
commit db92c856fd6006546e7eac8113042d30dbd6c02f 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/tests: Test deletion of keys and values using registry views. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 556121b1cafc2182edaeb7354caf46375205bef7 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/delete.c | 275 ++++++++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 276 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index e40c0256925..d6a3b7e1d04 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -66,6 +66,16 @@ static void test_command_syntax(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /v", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Test registry view */ + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /reg:32 /reg:32", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /reg:32 /reg:64", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /reg:64 /reg:64", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); } static void test_delete(void) @@ -141,6 +151,259 @@ static void test_delete(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); } +static void create_test_key(REGSAM sam) +{ + HKEY hkey, subkey; + DWORD dword; + + add_key(HKEY_LOCAL_MACHINE, KEY_BASE, sam, &hkey); + + dword = 0x100; + add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); + add_value(hkey, "String", REG_SZ, "Your text here...", 18); + add_value(hkey, NULL, REG_SZ, "Default value name", 19); + add_value(hkey, "Multiple Strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); + + add_key(hkey, "Subkey", sam, &subkey); + add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); + add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); + close_key(subkey); + + close_key(hkey); +} + +static void test_registry_view_win32(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64, is_win32; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win32 = !is_wow64 && (sizeof(void *) == sizeof(int)); + + if (!is_win32) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Test deletion from the 32-bit registry view (32-bit Windows) */ + create_test_key(KEY_WOW64_32KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_32KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey", KEY_WOW64_32KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Test deletion from the 64-bit registry view, which doesn't exist on 32-bit Windows */ + create_test_key(KEY_WOW64_64KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_64KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey", KEY_WOW64_64KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + +static void test_registry_view_win64(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64, is_win64; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win64 = !is_wow64 && (sizeof(void *) > sizeof(int)); + + if (!is_win64) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Test deletion from the 32-bit registry view (64-bit Windows) */ + create_test_key(KEY_WOW64_32KEY); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:32", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:32", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:32", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "String"); + todo_wine verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_32KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:32", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_key_nonexist(hkey, "Subkey", KEY_WOW64_32KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:32", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Test deletion from the 64-bit registry view (64-bit Windows) */ + create_test_key(KEY_WOW64_64KEY); + + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_64KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey", KEY_WOW64_64KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + +static void test_registry_view_wow64(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + + if (!is_wow64) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Test deletion from the 32-bit registry view (WOW64) */ + create_test_key(KEY_WOW64_32KEY); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "String"); + verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_32KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey", KEY_WOW64_32KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Test deletion from the 64-bit registry view (WOW64) */ + create_test_key(KEY_WOW64_64KEY); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /v DWORD /f /reg:64", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "DWORD"); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /ve /f /reg:64", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, NULL); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /va /f /reg:64", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "String"); + todo_wine verify_reg_nonexist(hkey, "Multiple Strings"); + verify_key(hkey, "Subkey", KEY_WOW64_64KEY); + + run_reg_exe("reg delete HKLM\\" KEY_BASE "\\Subkey /f /reg:64", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_key_nonexist(hkey, "Subkey", KEY_WOW64_64KEY); + + close_key(hkey); + + run_reg_exe("reg delete HKLM\\" KEY_BASE " /f /reg:64", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + START_TEST(delete) { DWORD r; @@ -152,4 +415,16 @@ START_TEST(delete) test_command_syntax(); test_delete(); + + /* Check if reg.exe is running with elevated privileges */ + if (!is_elevated_process()) + { + win_skip("reg.exe is not running with elevated privileges; " + "skipping registry view tests\n"); + return; + } + + test_registry_view_win32(); + test_registry_view_win64(); + test_registry_view_wow64(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 971198d4739..ea212a1f306 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: 8ad9c21b056d9f3119c363e0f7e56198985d5b08 + wine: 556121b1cafc2182edaeb7354caf46375205bef7
2 years, 6 months
1
0
0
0
[reactos] 136/158: [WINESYNC] reg/tests: Remove duplicate test from test_registry_view_wow64().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92e39357b82f17533ae6e…
commit 92e39357b82f17533ae6e2368cfca714a91f61bc 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/tests: Remove duplicate test from test_registry_view_wow64(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8ad9c21b056d9f3119c363e0f7e56198985d5b08 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 4 ---- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index bb72c4a3737..36fa634796d 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -961,10 +961,6 @@ 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); - open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); - verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0); - 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); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 079df8ba158..971198d4739 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: d790c593490bfb363cf34ab2d00dddbaf04ddd15 + wine: 8ad9c21b056d9f3119c363e0f7e56198985d5b08
2 years, 6 months
1
0
0
0
[reactos] 135/158: [WINESYNC] reg/tests: Modify delete_tree() to support the use of registry views.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44c2f0d9d613224437610…
commit 44c2f0d9d613224437610f44df1a62212c12b77e 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/tests: Modify delete_tree() to support the use of registry views. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id d790c593490bfb363cf34ab2d00dddbaf04ddd15 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 17 +++++++++------ modules/rostests/winetests/reg/copy.c | 36 +++++++++++++++---------------- modules/rostests/winetests/reg/delete.c | 4 ++-- modules/rostests/winetests/reg/export.c | 8 +++---- modules/rostests/winetests/reg/import.c | 12 +++++------ modules/rostests/winetests/reg/query.c | 6 +++--- modules/rostests/winetests/reg/reg_test.h | 2 +- sdk/tools/winesync/reg.cfg | 2 +- 8 files changed, 45 insertions(+), 42 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 3b4a895d0c5..bb72c4a3737 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -154,7 +154,7 @@ void delete_key_(const char *file, unsigned line, HKEY root, const char *path, R } } -LONG delete_tree(const HKEY key, const char *subkey) +LONG delete_tree(HKEY root, const char *path, REGSAM sam) { HKEY hkey; LONG ret; @@ -162,7 +162,7 @@ LONG delete_tree(const HKEY key, const char *subkey) DWORD max_subkey_len, subkey_len; static const char empty[1]; - ret = RegOpenKeyExA(key, subkey, 0, KEY_READ, &hkey); + ret = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey); if (ret) return ret; ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &max_subkey_len, @@ -184,11 +184,14 @@ LONG delete_tree(const HKEY key, const char *subkey) ret = RegEnumKeyExA(hkey, 0, subkey_name, &subkey_len, NULL, NULL, NULL, NULL); if (ret == ERROR_NO_MORE_ITEMS) break; if (ret) goto cleanup; - ret = delete_tree(hkey, subkey_name); + ret = delete_tree(hkey, subkey_name, sam); if (ret) goto cleanup; } - ret = RegDeleteKeyA(hkey, empty); + if (!sam) + ret = RegDeleteKeyA(hkey, empty); + else + ret = RegDeleteKeyExA(hkey, empty, sam, 0); cleanup: HeapFree(GetProcessHeap(), 0, subkey_name); @@ -219,7 +222,7 @@ static void test_command_syntax(void) { DWORD r; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg add", &r); @@ -322,7 +325,7 @@ static void test_key_formats(void) verify_key(hkey, "
https://winehq.org
", 0); close_key(hkey); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test validity of trailing backslash after system key */ run_reg_exe("reg add HKCU\\ /v Value1 /t REG_SZ /d foo /f", &r); @@ -409,7 +412,7 @@ static void test_add(void) verify_reg(hkey, NULL, REG_NONE, "T\0e\0s\0t\0\0", 10, 0); close_key(hkey); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } static void test_reg_none(void) diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index 2b461c17f5e..c6a83e57276 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -126,10 +126,10 @@ static void test_copy_empty_key(void) { DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, NULL); @@ -191,10 +191,10 @@ static void test_copy_simple_data(void) HKEY hkey; DWORD r, dword; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -261,10 +261,10 @@ static void test_copy_complex_data(void) HKEY hkey, subkey; DWORD r, dword; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -330,10 +330,10 @@ static void test_copy_key_order(void) HKEY hkey; DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -355,10 +355,10 @@ static void test_copy_value_order(void) HKEY hkey; DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -380,10 +380,10 @@ static void test_copy_hex_data(void) HKEY hkey; DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Try copying empty hex values */ @@ -449,10 +449,10 @@ static void test_copy_embedded_null_values(void) { DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -482,10 +482,10 @@ static void test_copy_slashes(void) HKEY hkey; DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -508,10 +508,10 @@ static void test_copy_escaped_null_values(void) HKEY hkey; DWORD r; - delete_tree(HKEY_CURRENT_USER, COPY_SRC); + delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index 251a15f3371..e40c0256925 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -23,7 +23,7 @@ static void test_command_syntax(void) { DWORD r; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg delete", &r); @@ -74,7 +74,7 @@ static void test_delete(void) DWORD r; const DWORD deadbeef = 0xdeadbeef; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Create a test key */ diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index df44baddb30..0f48443384e 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -176,7 +176,7 @@ static void test_export(void) HKEY hkey, subkey; BYTE hex[4], buffer[8]; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg export", &r); @@ -287,7 +287,7 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", complex_data_test, 0), "compare_export() failed\n"); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test the export order of registry keys */ add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -413,7 +413,7 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test escaped null characters */ add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -428,7 +428,7 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", escaped_null_test, 0), "compare_export() failed\n"); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } START_TEST(export) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 2d8ece8990b..2531ba336e8 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -101,7 +101,7 @@ static void test_import(void) LONG err; BYTE hex[8]; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg import", &r); @@ -1643,7 +1643,7 @@ static void test_import(void) close_key(hkey); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } static void test_unicode_import(void) @@ -1654,7 +1654,7 @@ static void test_unicode_import(void) char buffer[24]; BYTE hex[8]; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("REGEDIT\n", &r); @@ -3192,7 +3192,7 @@ static void test_unicode_import(void) close_key(hkey); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } static void test_import_with_whitespace(void) @@ -3200,7 +3200,7 @@ static void test_import_with_whitespace(void) HKEY hkey; DWORD r, dword; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_str(" REGEDIT4\n\n" @@ -3346,7 +3346,7 @@ static void test_unicode_import_with_whitespace(void) HKEY hkey; DWORD r, dword; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 3e8b134363b..270f0aad75d 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -164,7 +164,7 @@ static void test_query(void) HKEY hkey, subkey; BYTE buf[512]; - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg query", &r); @@ -270,7 +270,7 @@ static void test_query(void) ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\n", r); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); /* Subkeys only */ add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -288,7 +288,7 @@ static void test_query(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test8b, FALSE, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } START_TEST(query) diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index fdc747af1e9..a5d7169beb4 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -64,7 +64,7 @@ void add_key_(const char *file, unsigned line, const HKEY root, const char *path #define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s) void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam); -LONG delete_tree(const HKEY key, const char *subkey); +LONG delete_tree(HKEY root, const char *path, REGSAM sam); #define add_value(k,n,t,d,s) add_value_(__FILE__,__LINE__,k,n,t,d,s) void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 9ab5d25993d..079df8ba158 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: 7c9f372480511cba8abd90ed04480911d96036de + wine: d790c593490bfb363cf34ab2d00dddbaf04ddd15
2 years, 6 months
1
0
0
0
[reactos] 134/158: [WINESYNC] reg/tests: Move 'delete' syntax tests into a separate function.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aabda6f60852ff7ed902b…
commit aabda6f60852ff7ed902b49527199f52e52930de 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/tests: Move 'delete' syntax tests into a separate function. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 7c9f372480511cba8abd90ed04480911d96036de by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/delete.c | 15 ++++++++++++--- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index 22c5e867461..251a15f3371 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -19,11 +19,9 @@ #include "reg_test.h" -static void test_delete(void) +static void test_command_syntax(void) { - HKEY hkey; DWORD r; - const DWORD deadbeef = 0xdeadbeef; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); @@ -68,6 +66,16 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /v", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + +static void test_delete(void) +{ + HKEY hkey; + DWORD r; + const DWORD deadbeef = 0xdeadbeef; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Create a test key */ add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -142,5 +150,6 @@ START_TEST(delete) return; } + test_command_syntax(); test_delete(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 73ccb441c23..9ab5d25993d 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: 304b80a9b5a6ed128dd8a89e22f05b99142310cd + wine: 7c9f372480511cba8abd90ed04480911d96036de
2 years, 6 months
1
0
0
0
[reactos] 133/158: [WINESYNC] reg: Support the use of registry views during the 'add' operation.
by winesync
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
2 years, 6 months
1
0
0
0
[reactos] 132/158: [WINESYNC] reg/tests: Test key and value creation in 32-bit and 64-bit registry views.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=334c2e278c4b36655304a…
commit 334c2e278c4b36655304aa9d55785cb353f21387 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/tests: Test key and value creation in 32-bit and 64-bit registry views. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 24d0d6f524d6c51cc5d8c909bf6cd942d6ae443d by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 133 ++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/import.c | 39 +++++---- modules/rostests/winetests/reg/reg_test.h | 2 + sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 160 insertions(+), 16 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 384eb9012c7..264693ab349 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -274,6 +274,16 @@ static void test_command_syntax(void) /* Test empty type */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* 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); + + 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); + + 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); } static void test_key_formats(void) @@ -849,6 +859,117 @@ static void test_reg_multi_sz(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); } +static void test_registry_view_win32(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64, is_win32; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win32 = !is_wow64 && (sizeof(void *) == sizeof(int)); + + if (!is_win32) return; + + /* Try adding to the 32-bit registry view (32-bit Windows) */ + 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); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); + verify_reg(hkey, "Wine32", REG_SZ, "Test", 5, 0); + close_key(hkey); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); + verify_reg(hkey, "Wine32", REG_SZ, "Test", 5, 0); + close_key(hkey); + + delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, 0); + + /* Try adding to the 64-bit registry view, which doesn't exist on 32-bit Windows */ + 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); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); + verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0); + close_key(hkey); + + open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey); + verify_reg(hkey, "Wine64", REG_SZ, "Test", 5, 0); + close_key(hkey); + + delete_key(HKEY_LOCAL_MACHINE, KEY_BASE, 0); +} + +static void test_registry_view_win64(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64, is_win64; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win64 = !is_wow64 && (sizeof(void *) > sizeof(int)); + + if (!is_win64) return; + + /* Try adding to the 32-bit registry view (64-bit Windows) */ + 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); + + todo_wine 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); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + 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); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); +} + +static void test_registry_view_wow64(void) +{ + HKEY hkey; + DWORD r; + BOOL is_wow64; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + + if (!is_wow64) return; + + /* Try adding to the 32-bit registry view (WOW64) */ + 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); + + 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); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try adding to the 64-bit registry view (WOW64) */ + 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); + + 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); + + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); +} + START_TEST(add) { DWORD r; @@ -868,4 +989,16 @@ START_TEST(add) test_reg_dword(); test_reg_dword_big_endian(); test_reg_multi_sz(); + + /* Check if reg.exe is running with elevated privileges */ + if (!is_elevated_process()) + { + win_skip("reg.exe is not running with elevated privileges; " + "skipping registry view tests\n"); + return; + } + + test_registry_view_win32(); + test_registry_view_win64(); + test_registry_view_wow64(); } diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index c8a6b079a6a..2d8ece8990b 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -18,6 +18,29 @@ #include "reg_test.h" +BOOL is_elevated_process(void) +{ + LONG err; + HKEY hkey; + + err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE); + + if (err == ERROR_ACCESS_DENIED) + return FALSE; + + if (err == ERROR_FILE_NOT_FOUND) + { + if (RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_READ, NULL, &hkey, NULL)) + return FALSE; + + RegCloseKey(hkey); + RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE); + } + + return TRUE; +} + static BOOL write_file(const void *str, DWORD size) { HANDLE file; @@ -3466,30 +3489,16 @@ static void test_unicode_import_with_whitespace(void) static void test_import_win31(void) { - LONG err; HKEY hkey; DWORD r; /* Check if reg.exe is running with elevated privileges */ - err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE); - if (err == ERROR_ACCESS_DENIED) + if (!is_elevated_process()) { win_skip("reg.exe is not running with elevated privileges; " "skipping Windows 3.1 import tests\n"); return; } - if (err == ERROR_FILE_NOT_FOUND) - { - if (RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ, NULL, &hkey, NULL)) - { - win_skip("reg.exe is not running with elevated privileges; " - "skipping Windows 3.1 import tests\n"); - return; - } - RegCloseKey(hkey); - RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE); - } /* Test simple value */ test_import_str("REGEDIT\r\n" diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index db525619978..fdc747af1e9 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -90,6 +90,8 @@ extern const char *embedded_null_test; extern const char *escaped_null_test; /* import.c */ +BOOL is_elevated_process(void); + #define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,r) #define test_import_wstr(c,r) import_reg(__FILE__,__LINE__,c,TRUE,r) BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index e19cdedb65b..51f62c396bf 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: 0d60749c218ae76645006e6273fc2f6a5ea87a58 + wine: 24d0d6f524d6c51cc5d8c909bf6cd942d6ae443d
2 years, 6 months
1
0
0
0
[reactos] 131/158: [WINESYNC] reg/tests: Modify add_key() to support key creation in registry views.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=77b2d21e9dca76a420ee4…
commit 77b2d21e9dca76a420ee4f5d247ab07276cb5a00 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:35 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:37 2022 +0200 [WINESYNC] reg/tests: Modify add_key() to support key creation in registry views. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 0d60749c218ae76645006e6273fc2f6a5ea87a58 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 30 ++++++++++++------------ modules/rostests/winetests/reg/copy.c | 38 +++++++++++++++---------------- modules/rostests/winetests/reg/delete.c | 6 ++--- modules/rostests/winetests/reg/export.c | 28 +++++++++++------------ modules/rostests/winetests/reg/query.c | 14 ++++++------ modules/rostests/winetests/reg/reg_test.h | 4 ++-- sdk/tools/winesync/reg.cfg | 2 +- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 48e33f6564a..384eb9012c7 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -121,17 +121,17 @@ void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char RegCloseKey(hkey); } -void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey) +void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey) { LONG err; HKEY new_key; - err = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, NULL, &new_key, NULL); + err = RegCreateKeyExA(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE|sam, NULL, &new_key, NULL); lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: got error %d\n", err); - if (subkey) - *subkey = new_key; + if (hkey) + *hkey = new_key; else RegCloseKey(new_key); } @@ -282,7 +282,7 @@ static void test_key_formats(void) DWORD r; LONG err; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); @@ -365,7 +365,7 @@ static void test_add(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); /* Adding a registry key via WinAPI doesn't initialize the Default value... */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); verify_reg_nonexist(hkey, NULL); /* ... but we can add it without passing [/f] to reg.exe */ @@ -375,7 +375,7 @@ static void test_add(void) delete_value(hkey, NULL); /* Test whether overwriting a registry key modifies existing keys and values */ - add_key(hkey, "Subkey", NULL); + add_key(hkey, "Subkey", 0, NULL); add_value(hkey, "Test1", REG_SZ, "Value1", 7); dword = 0x123; add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); @@ -407,7 +407,7 @@ static void test_reg_none(void) HKEY hkey; DWORD r; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_NONE /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -436,7 +436,7 @@ static void test_reg_sz(void) HKEY hkey; DWORD r; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -514,7 +514,7 @@ static void test_reg_expand_sz(void) HKEY hkey; DWORD r; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -557,7 +557,7 @@ static void test_reg_binary(void) char buffer[22]; LONG err; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -620,7 +620,7 @@ static void test_reg_dword(void) DWORD r, dword, type, size; LONG err; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), @@ -734,7 +734,7 @@ static void test_reg_dword_big_endian(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test2 /t REG_DWORD_BIG_ENDIAN /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r); - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test3 /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -755,7 +755,7 @@ static void test_reg_multi_sz(void) HKEY hkey; DWORD r; - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index 5573dd58acc..2b461c17f5e 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -132,7 +132,7 @@ static void test_copy_empty_key(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, NULL); run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); @@ -197,7 +197,7 @@ static void test_copy_simple_data(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); dword = 0x100; add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); @@ -267,38 +267,38 @@ static void test_copy_complex_data(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); dword = 0x100; add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); add_value(hkey, "String", REG_SZ, "Your text here...", 18); - add_key(hkey, "Subkey1", &subkey); + add_key(hkey, "Subkey1", 0, &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); close_key(subkey); - add_key(hkey, "Subkey2a", &subkey); + add_key(hkey, "Subkey2a", 0, &subkey); add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); close_key(subkey); - add_key(hkey, "Subkey2a\\Subkey2b", &subkey); + add_key(hkey, "Subkey2a\\Subkey2b", 0, &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(subkey); - add_key(hkey, "Subkey3a", &subkey); + add_key(hkey, "Subkey3a", 0, &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); close_key(subkey); - add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); + add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", 0, &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); close_key(subkey); - add_key(hkey, "Subkey4", &subkey); + add_key(hkey, "Subkey4", 0, &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); @@ -336,9 +336,9 @@ static void test_copy_key_order(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); - add_key(hkey, "Subkey2", NULL); - add_key(hkey, "Subkey1", NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); + add_key(hkey, "Subkey2", 0, NULL); + add_key(hkey, "Subkey1", 0, NULL); close_key(hkey); run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); @@ -361,7 +361,7 @@ static void test_copy_value_order(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); close_key(hkey); @@ -387,7 +387,7 @@ static void test_copy_hex_data(void) verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Try copying empty hex values */ - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine1a", REG_NONE, NULL, 0); add_value(hkey, "Wine1b", REG_SZ, NULL, 0); add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); @@ -488,8 +488,8 @@ static void test_copy_slashes(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); - add_key(hkey, "
https://winehq.org
", NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); + add_key(hkey, "
https://winehq.org
", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); close_key(hkey); @@ -514,7 +514,7 @@ static void test_copy_escaped_null_values(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\\0", 3); add_value(hkey, "Wine5b", REG_SZ, "\\0\\0", 5); add_value(hkey, "Wine5c", REG_SZ, "Value1\\0", 9); @@ -582,7 +582,7 @@ static void test_copy_overwrite(void) HKEY hkey; DWORD r, dword; - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine1", REG_SZ, "def", 4); dword = 0x5; add_value(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword)); @@ -590,7 +590,7 @@ static void test_copy_overwrite(void) add_value(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(hkey); - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine1", REG_SZ, "abc", 4); verify_reg_nonexist(hkey, "Wine2"); add_value(hkey, "Wine3", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index e84d78808ca..22c5e867461 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -70,12 +70,12 @@ static void test_delete(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); /* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef)); - add_key(hkey, "subkey", NULL); + add_key(hkey, "subkey", 0, NULL); run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -91,7 +91,7 @@ static void test_delete(void) verify_key(hkey, "subkey", 0); /* Test forward and back slashes */ - add_key(hkey, "
https://winehq.org
", NULL); + add_key(hkey, "
https://winehq.org
", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index 24a5dbd2405..df44baddb30 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -219,7 +219,7 @@ static void test_export(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); /* Test registry export with an empty key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -251,32 +251,32 @@ static void test_export(void) ok(compare_export("foo", simple_data_test, 0), "compare_export() failed\n"); /* Test registry export with a complex data structure */ - add_key(hkey, "Subkey1", &subkey); + add_key(hkey, "Subkey1", 0, &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); close_key(subkey); - add_key(hkey, "Subkey2a", &subkey); + add_key(hkey, "Subkey2a", 0, &subkey); add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); close_key(subkey); - add_key(hkey, "Subkey2a\\Subkey2b", &subkey); + add_key(hkey, "Subkey2a\\Subkey2b", 0, &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(subkey); - add_key(hkey, "Subkey3a", &subkey); + add_key(hkey, "Subkey3a", 0, &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); close_key(subkey); - add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); + add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", 0, &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); close_key(subkey); - add_key(hkey, "Subkey4", &subkey); + add_key(hkey, "Subkey4", 0, &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); @@ -290,9 +290,9 @@ static void test_export(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); /* Test the export order of registry keys */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "Subkey2", NULL); - add_key(hkey, "Subkey1", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "Subkey2", 0, NULL); + add_key(hkey, "Subkey1", 0, NULL); run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -313,7 +313,7 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test registry export with empty hex data */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine1a", REG_NONE, NULL, 0); add_value(hkey, "Wine1b", REG_SZ, NULL, 0); add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); @@ -404,8 +404,8 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test registry export with forward and back slashes */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "
https://winehq.org
", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "
https://winehq.org
", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); close_key(hkey); @@ -416,7 +416,7 @@ static void test_export(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); /* Test escaped null characters */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\\0", 3); add_value(hkey, "Wine5b", REG_SZ, "\\0\\0", 5); add_value(hkey, "Wine5c", REG_SZ, "Value1\\0", 9); diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 4754c2bf05f..3e8b134363b 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -184,7 +184,7 @@ static void test_query(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); /* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Test1", REG_SZ, "Hello, World", 13); add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); @@ -221,7 +221,7 @@ static void test_query(void) add_value(hkey, "Wine", REG_SZ, "First instance", 15); /* Create a test subkey */ - add_key(hkey, "subkey", &subkey); + add_key(hkey, "subkey", 0, &subkey); 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); @@ -273,11 +273,11 @@ static void test_query(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); /* Subkeys only */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "subkey1", NULL); - add_key(hkey, "subkey2", NULL); - add_key(hkey, "subkey3", NULL); - add_key(hkey, "subkey4", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "subkey1", 0, NULL); + add_key(hkey, "subkey2", 0, NULL); + add_key(hkey, "subkey3", 0, NULL); + add_key(hkey, "subkey4", 0, NULL); close_key(hkey); read_reg_output("reg query HKCU\\" KEY_BASE, buf, sizeof(buf), &r); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 1f57a3e9596..db525619978 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -58,8 +58,8 @@ void verify_key_(const char *file, unsigned line, HKEY root, const char *path, R #define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s) void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam); -#define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s) -void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey); +#define add_key(r,p,s,k) add_key_(__FILE__,__LINE__,r,p,s,k) +void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey); #define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s) void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index a56ccaa1f25..e19cdedb65b 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: ff0445a5de192b2984bb558ac54e7f4d54e96129 + wine: 0d60749c218ae76645006e6273fc2f6a5ea87a58
2 years, 6 months
1
0
0
0
[reactos] 130/158: [WINESYNC] reg/tests: Update delete_value() declaration to deconstify 'const HKEY'.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64c84526889a7f2f1b457…
commit 64c84526889a7f2f1b45716813fdbff5117cb956 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:35 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:37 2022 +0200 [WINESYNC] reg/tests: Update delete_value() declaration to deconstify 'const HKEY'. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id ff0445a5de192b2984bb558ac54e7f4d54e96129 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 2 +- modules/rostests/winetests/reg/reg_test.h | 2 +- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index c2548e45f37..48e33f6564a 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -205,7 +205,7 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, lok(err == ERROR_SUCCESS, "RegSetValueExA failed: got error %d\n", err); } -void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name) +void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name) { LONG err; diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 81badf928ba..1f57a3e9596 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -71,7 +71,7 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size); #define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n) -void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name); +void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name); /* export.c */ #define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo) diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 05e3edb3d15..a56ccaa1f25 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: 9780dfc01a460264b6088fe23eada214c21441bd + wine: ff0445a5de192b2984bb558ac54e7f4d54e96129
2 years, 6 months
1
0
0
0
[reactos] 129/158: [WINESYNC] reg/tests: Modify verify_key_nonexist() to support registry views.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=df92c0464bd4db7b4af3f…
commit df92c0464bd4db7b4af3fef5bd6a6a7f7ccfce9b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:35 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:37 2022 +0200 [WINESYNC] reg/tests: Modify verify_key_nonexist() to support registry views. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9780dfc01a460264b6088fe23eada214c21441bd by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 13 ++++--- modules/rostests/winetests/reg/copy.c | 36 +++++++++---------- modules/rostests/winetests/reg/delete.c | 6 ++-- modules/rostests/winetests/reg/export.c | 2 +- modules/rostests/winetests/reg/import.c | 60 +++++++++++++++---------------- modules/rostests/winetests/reg/query.c | 2 +- modules/rostests/winetests/reg/reg_test.h | 4 +-- sdk/tools/winesync/reg.cfg | 2 +- 8 files changed, 62 insertions(+), 63 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 112ae5b875d..c2548e45f37 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -109,14 +109,13 @@ void verify_key_(const char *file, unsigned line, HKEY root, const char *path, R RegCloseKey(hkey); } -void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey) +void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam) { HKEY hkey; LONG err; - err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey); - lok(err == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n", - subkey, err); + err = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey); + lok(err == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n", path, err); if (hkey) RegCloseKey(hkey); @@ -221,7 +220,7 @@ static void test_command_syntax(void) DWORD r; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg add", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -287,11 +286,11 @@ static void test_key_formats(void) run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - verify_key_nonexist(hkey, "keytest0"); + verify_key_nonexist(hkey, "keytest0", 0); run_reg_exe("reg add \\\\HKCU\\" KEY_BASE "\\keytest1 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - verify_key_nonexist(hkey, "keytest1"); + verify_key_nonexist(hkey, "keytest1", 0); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index f25d520bdf6..5573dd58acc 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -127,10 +127,10 @@ static void test_copy_empty_key(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, NULL); @@ -192,10 +192,10 @@ static void test_copy_simple_data(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); @@ -262,10 +262,10 @@ static void test_copy_complex_data(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); @@ -331,10 +331,10 @@ static void test_copy_key_order(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_key(hkey, "Subkey2", NULL); @@ -356,10 +356,10 @@ static void test_copy_value_order(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); @@ -381,10 +381,10 @@ static void test_copy_hex_data(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Try copying empty hex values */ add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); @@ -450,10 +450,10 @@ static void test_copy_embedded_null_values(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" COPY_SRC "]\n" @@ -483,10 +483,10 @@ static void test_copy_slashes(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_key(hkey, "
https://winehq.org
", NULL); @@ -509,10 +509,10 @@ static void test_copy_escaped_null_values(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\\0", 3); diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index ef106e67169..e84d78808ca 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -26,7 +26,7 @@ static void test_delete(void) const DWORD deadbeef = 0xdeadbeef; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg delete", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -97,7 +97,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "
https://winehq.org
"); + verify_key_nonexist(hkey, "
https://winehq.org
", 0); run_reg_exe("reg delete HKCU\\" KEY_BASE " /v count/up /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -127,7 +127,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index b45660a0e6e..24a5dbd2405 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -177,7 +177,7 @@ static void test_export(void) BYTE hex[4], buffer[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg export", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 54a59c1edb2..c8a6b079a6a 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -79,7 +79,7 @@ static void test_import(void) BYTE hex[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg import", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -695,13 +695,13 @@ static void test_import(void) "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" "Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0); test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\n" "\\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); + verify_key_nonexist(hkey, "Subkey2", 0); test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" @@ -875,22 +875,22 @@ static void test_import(void) test_import_str("REGEDIT4\n\n" "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); + verify_key_nonexist(hkey, "No_Opening_Bracket", 0); test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); + verify_key_nonexist(hkey, "No_Closing_Bracket", 0); test_import_str("REGEDIT4\n\n" "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); + verify_key_nonexist(hkey, "Subkey1a", 0); test_import_str("REGEDIT4\n\n" "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); + verify_key_nonexist(hkey, "Subkey1b", 0); test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); @@ -972,8 +972,8 @@ static void test_import(void) "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); + verify_key_nonexist(hkey, "Subkey2a", 0); + verify_key_nonexist(hkey, "Subkey2b", 0); /* Test case sensitivity when creating and deleting registry keys. */ test_import_str("REGEDIT4\n\n" @@ -987,8 +987,8 @@ static void test_import(void) "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); + verify_key_nonexist(hkey, "Subkey3a", 0); + verify_key_nonexist(hkey, "Subkey3b", 0); /* Test mixed key creation and deletion. We start by creating a subkey. */ test_import_str("REGEDIT4\n\n" @@ -1001,7 +1001,7 @@ static void test_import(void) "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" "\"Wine46a\"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); + verify_key_nonexist(hkey, "Subkey4a", 0); verify_reg_nonexist(hkey, "Wine46a"); test_import_str("REGEDIT4\n\n" @@ -1009,7 +1009,7 @@ static void test_import(void) "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" "\"Wine46b\"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); + verify_key_nonexist(hkey, "Subkey4b", 0); verify_reg_nonexist(hkey, "Wine46b"); /* Test value deletion. We start by creating some registry values. */ @@ -1173,7 +1173,7 @@ static void test_import(void) "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0); test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" @@ -1632,7 +1632,7 @@ static void test_unicode_import(void) BYTE hex[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("REGEDIT\n", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, @@ -2234,13 +2234,13 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" "Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\n" "\\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); + verify_key_nonexist(hkey, "Subkey2", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" @@ -2414,22 +2414,22 @@ static void test_unicode_import(void) test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); + verify_key_nonexist(hkey, "No_Opening_Bracket", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); + verify_key_nonexist(hkey, "No_Closing_Bracket", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); + verify_key_nonexist(hkey, "Subkey1a", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); + verify_key_nonexist(hkey, "Subkey1b", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); @@ -2511,8 +2511,8 @@ static void test_unicode_import(void) "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); + verify_key_nonexist(hkey, "Subkey2a", 0); + verify_key_nonexist(hkey, "Subkey2b", 0); /* Test case sensitivity when creating and deleting registry keys. */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2526,8 +2526,8 @@ static void test_unicode_import(void) "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); + verify_key_nonexist(hkey, "Subkey3a", 0); + verify_key_nonexist(hkey, "Subkey3b", 0); /* Test mixed key creation and deletion. We start by creating a subkey. */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2540,7 +2540,7 @@ static void test_unicode_import(void) "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" "\"Wine46a\"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); + verify_key_nonexist(hkey, "Subkey4a", 0); verify_reg_nonexist(hkey, "Wine46a"); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2548,7 +2548,7 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" "\"Wine46b\"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); + verify_key_nonexist(hkey, "Subkey4b", 0); verify_reg_nonexist(hkey, "Wine46b"); /* Test value deletion. We start by creating some registry values. */ @@ -2715,7 +2715,7 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" @@ -3178,7 +3178,7 @@ static void test_import_with_whitespace(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_str(" REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); @@ -3324,7 +3324,7 @@ static void test_unicode_import_with_whitespace(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 76186794f5e..4754c2bf05f 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -165,7 +165,7 @@ static void test_query(void) BYTE buf[512]; delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); run_reg_exe("reg query", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 7cf3f86014d..81badf928ba 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -55,8 +55,8 @@ void close_key_(const char *file, unsigned line, HKEY hkey); #define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s) void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam); -#define verify_key_nonexist(k,s) verify_key_nonexist_(__FILE__,__LINE__,k,s) -void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey); +#define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s) +void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam); #define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s) void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 03a12dc17cf..05e3edb3d15 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: fdceb5ed7e5ce058cf9a64564e116f1bbe42d5ea + wine: 9780dfc01a460264b6088fe23eada214c21441bd
2 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
24
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Results per page:
10
25
50
100
200