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] 148/158: [WINESYNC] reg/tests: Test use of registry views when importing keys and values.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bed77337e8a64714ef41b…
commit bed77337e8a64714ef41b98da25372c2d5fce5f5 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Test use of registry views when importing keys and values. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id f2ce614d85091500c071f9b7234f17d5d6418727 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/export.c | 3 +- modules/rostests/winetests/reg/import.c | 272 +++++++++++++++++++++++++++++- modules/rostests/winetests/reg/reg_test.h | 3 + sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 268 insertions(+), 12 deletions(-) diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index e32f750079e..af00262212b 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -50,8 +50,7 @@ BOOL compare_export_(const char *file, unsigned line, const char *filename, todo_wine_if (todo & TODO_REG_COMPARE) lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n"); - ret = DeleteFileA(filename); - lok(ret, "DeleteFile failed: %u\n", GetLastError()); + ret = delete_file(filename); exit: HeapFree(GetProcessHeap(), 0, fbuf); diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 598319628dc..edae8277eb3 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -41,14 +41,23 @@ BOOL is_elevated_process(void) return TRUE; } -static BOOL write_file(const void *str, DWORD size) +BOOL delete_file_(const char *file, unsigned line, const char *fname) +{ + BOOL ret; + + ret = DeleteFileA(fname); + lok(ret, "DeleteFile failed: %u\n", GetLastError()); + + return ret; +} + +static BOOL write_file(const char *fname, const void *str, DWORD size) { HANDLE file; BOOL ret; DWORD written; - file = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFileA(fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); if (file == INVALID_HANDLE_VALUE) return FALSE; @@ -60,7 +69,7 @@ static BOOL write_file(const void *str, DWORD size) return ret; } -BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc) +static BOOL write_reg_file(const char *fname, const char *contents, BOOL unicode) { int lenA; BOOL ret; @@ -70,23 +79,30 @@ BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unic if (unicode) { int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0); - int size = len * sizeof(WCHAR); + DWORD size = len * sizeof(WCHAR); WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size); if (!wstr) return FALSE; MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len); - ret = write_file(wstr, size); + ret = write_file(fname, wstr, size); HeapFree(GetProcessHeap(), 0, wstr); } else - ret = write_file(contents, lenA); + ret = write_file(fname, contents, lenA); + return ret; +} + +BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc) +{ + BOOL ret; + + ret = write_reg_file("test.reg", contents, unicode); if (!ret) return FALSE; run_reg_exe("reg import test.reg", rc); - ret = DeleteFileA("test.reg"); - lok(ret, "DeleteFile failed: %u\n", GetLastError()); + delete_file("test.reg"); return ret; } @@ -3598,6 +3614,232 @@ static void test_import_win31(void) delete_key(HKEY_CLASSES_ROOT, KEY_BASE, 0); } +static BOOL write_test_files(void) +{ + const char *test1, *test2; + BOOL ret; + + test1 = "REGEDIT4\n\n" + "[HKEY_LOCAL_MACHINE\\" KEY_BASE "]\n" + "\"Wine1\"=dword:00000123\n\n" + "\"Wine2\"=\"Test Value\"\n" + "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "#comment\n" + "@=\"Test\"\n" + ";comment\n\n" + "\"Wine4\"=hex(2):25,50,41,54,48,25,00\n\n"; + + test2 = "\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey]\n" + "\"Empty string\"=\"\"\n" + "\"\"=\"Default registry value\"\n\n"; + + ret = write_reg_file("reg4.reg", test1, FALSE); + ret = write_reg_file("reg5.reg", test2, TRUE); + + return ret; +} + +static void test_registry_view_win32(void) +{ + DWORD r, dword = 0x123; + BOOL is_wow64, is_win32; + HKEY hkey, subkey; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win32 = !is_wow64 && (sizeof(void *) == sizeof(int)); + + if (!is_win32) return; + + if (!write_test_files()) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Try adding to the 32-bit registry view (32-bit Windows) */ + run_reg_exe("reg import reg4.reg /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey); + verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + close_key(subkey); + close_key(hkey); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try adding to the 64-bit registry view, which doesn't exist on 32-bit Windows */ + run_reg_exe("reg import reg4.reg /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey); + verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + close_key(subkey); + close_key(hkey); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + delete_file("reg4.reg"); + delete_file("reg5.reg"); +} + +static void test_registry_view_win64(void) +{ + DWORD r, dword = 0x123; + BOOL is_wow64, is_win64; + HKEY hkey, subkey; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + is_win64 = !is_wow64 && (sizeof(void *) > sizeof(int)); + + if (!is_win64) return; + + if (!write_test_files()) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try adding to the 32-bit registry view (64-bit Windows) */ + run_reg_exe("reg import reg4.reg /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + todo_wine verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + todo_wine verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + todo_wine verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + todo_wine verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + todo_wine open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey); + todo_wine verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + todo_wine verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + todo_wine close_key(subkey); + todo_wine close_key(hkey); + + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Try adding to the 64-bit registry view (64-bit Windows) */ + run_reg_exe("reg import reg4.reg /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey); + verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + close_key(subkey); + close_key(hkey); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + delete_file("reg4.reg"); + delete_file("reg5.reg"); +} + +static void test_registry_view_wow64(void) +{ + DWORD r, dword = 0x123; + BOOL is_wow64; + HKEY hkey, subkey; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + + if (!is_wow64) return; + + if (!write_test_files()) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try adding to the 32-bit registry view (WOW64) */ + run_reg_exe("reg import reg4.reg /reg:32", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey); + verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + close_key(subkey); + close_key(hkey); + + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Try adding to the 64-bit registry view (WOW64) */ + run_reg_exe("reg import reg4.reg /reg:64", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import reg5.reg /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, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + todo_wine verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + todo_wine verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + todo_wine verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + todo_wine verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0); + + todo_wine open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey); + todo_wine verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0); + todo_wine verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0); + todo_wine close_key(subkey); + todo_wine close_key(hkey); + + todo_wine verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + delete_file("reg4.reg"); + delete_file("reg5.reg"); +} + START_TEST(import) { DWORD r; @@ -3613,4 +3855,16 @@ START_TEST(import) test_import_with_whitespace(); test_unicode_import_with_whitespace(); test_import_win31(); + + /* 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/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 3f64e552a19..45d480cda49 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -93,6 +93,9 @@ extern const char *escaped_null_test; /* import.c */ BOOL is_elevated_process(void); +#define delete_file(f) delete_file_(__FILE__,__LINE__,f) +BOOL delete_file_(const char *file, unsigned line, const char *fname); + #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 29deebe4a07..23f9a809e0f 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: e3d14e66f71193faeb532c28b5b5565d5ea9b12f + wine: f2ce614d85091500c071f9b7234f17d5d6418727
2 years, 6 months
1
0
0
0
[reactos] 147/158: [WINESYNC] reg/tests: Split 'import' syntax tests into a separate function.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7beb1390e2fed08908763…
commit 7beb1390e2fed089087632fe927e7f27a0a59e91 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Split 'import' 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 e3d14e66f71193faeb532c28b5b5565d5ea9b12f by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/import.c | 22 ++++++++++++++-------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index ace45cf5984..598319628dc 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -93,15 +93,9 @@ BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unic /* Unit tests */ -static void test_import(void) +static void test_command_syntax(void) { - DWORD r, dword = 0x123, type, size; - char buffer[24]; - HKEY hkey, subkey = NULL; - LONG err; - BYTE hex[8]; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); + DWORD r; run_reg_exe("reg import", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -120,6 +114,17 @@ static void test_import(void) run_reg_exe("reg import a.reg b.reg", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + +static void test_import(void) +{ + DWORD r, dword = 0x123, type, size; + char buffer[24]; + HKEY hkey, subkey = NULL; + LONG err; + BYTE hex[8]; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); /* Test file contents */ test_import_str("regedit\n", &r); @@ -3602,6 +3607,7 @@ START_TEST(import) return; } + test_command_syntax(); test_import(); test_unicode_import(); test_import_with_whitespace(); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 2bf8febe542..29deebe4a07 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: 8eef4a873513cca9ffea61fb225fa8a9c8ac784d + wine: e3d14e66f71193faeb532c28b5b5565d5ea9b12f
2 years, 6 months
1
0
0
0
[reactos] 146/158: [WINESYNC] reg: Support use of registry views in the 'query' operation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c69933739b91e89c564d0…
commit c69933739b91e89c564d02783490420e1891efdf Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg: Support use of registry views in the 'query' operation. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8eef4a873513cca9ffea61fb225fa8a9c8ac784d by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/query.c | 24 +++++++++++++++++++----- modules/rostests/winetests/reg/query.c | 24 ++++++++++++------------ sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/base/applications/cmdutils/reg/query.c b/base/applications/cmdutils/reg/query.c index 4886fb84bc1..c1d08541c68 100644 --- a/base/applications/cmdutils/reg/query.c +++ b/base/applications/cmdutils/reg/query.c @@ -140,6 +140,7 @@ static void output_value(const WCHAR *value_name, DWORD type, BYTE *data, DWORD } static unsigned int num_values_found = 0; +static REGSAM sam = 0; static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path, BOOL recurse) { @@ -203,7 +204,7 @@ static int query_value(HKEY hkey, WCHAR *value_name, WCHAR *path, BOOL recurse) if (rc == ERROR_SUCCESS) { subkey_path = build_subkey_path(path, path_len, subkey_name, subkey_len); - if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ, &subkey)) + if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ|sam, &subkey)) { query_value(subkey, value_name, subkey_path, recurse); RegCloseKey(subkey); @@ -290,7 +291,7 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing) if (recurse) { subkey_path = build_subkey_path(path, path_len, subkey_name, subkey_len); - if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ, &subkey)) + if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ|sam, &subkey)) { query_all(subkey, subkey_path, recurse, TRUE); RegCloseKey(subkey); @@ -308,12 +309,12 @@ static int query_all(HKEY hkey, WCHAR *path, BOOL recurse, BOOL recursing) } static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, - BOOL value_empty, BOOL recurse) + BOOL value_empty, BOOL recurse) { HKEY hkey; int ret; - if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey) != ERROR_SUCCESS) + if (RegOpenKeyExW(root, path, 0, KEY_READ|sam, &hkey)) { output_message(STRING_KEY_NONEXIST); return 1; @@ -360,8 +361,18 @@ int reg_query(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; @@ -383,6 +394,9 @@ int reg_query(int argc, WCHAR *argvW[]) if (value_name && value_empty) goto invalid; + if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY)) + goto invalid; + key_name = get_long_key(root, path); return run_query(root, path, key_name, value_name, value_empty, recurse); diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index dcc98a9a0c4..a63b341546f 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -414,16 +414,16 @@ static void test_registry_view_win64(void) create_test_key(KEY_WOW64_32KEY); read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9a, FALSE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9c, TRUE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); @@ -480,16 +480,16 @@ static void test_registry_view_wow64(void) create_test_key(KEY_WOW64_64KEY); read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9a, FALSE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test9c, TRUE, TODO_REG_COMPARE); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index e1bdad26147..2bf8febe542 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: 48c73868720606ab62ae089ee3b9c978736bd530 + wine: 8eef4a873513cca9ffea61fb225fa8a9c8ac784d
2 years, 6 months
1
0
0
0
[reactos] 145/158: [WINESYNC] reg/tests: Check all error codes in delete_tree() before returning.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5caeeb0399969f36b4370…
commit 5caeeb0399969f36b43700e307bbff43894b38b8 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Check all error codes in delete_tree() before returning. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 48c73868720606ab62ae089ee3b9c978736bd530 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 3 +-- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 2c1a2cf35e3..1be34602408 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -194,9 +194,8 @@ LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, else ret = RegDeleteKeyExA(hkey, empty, sam, 0); - lok(!ret, "Failed to delete registry key, got error %d\n", ret); - cleanup: + lok(!ret, "Failed to delete registry key, got error %d\n", ret); HeapFree(GetProcessHeap(), 0, subkey_name); RegCloseKey(hkey); return ret; diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 3c5790ae82d..e1bdad26147 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: 45955658e18b65d3af701885e2cfa58bd0c95ceb + wine: 48c73868720606ab62ae089ee3b9c978736bd530
2 years, 6 months
1
0
0
0
[reactos] 144/158: [WINESYNC] reg/tests: Test use of registry views when querying registry values.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2592a360a0702302c5119…
commit 2592a360a0702302c5119d0805864148639926d0 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Test use of registry views when querying registry values. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 45955658e18b65d3af701885e2cfa58bd0c95ceb by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 30 ++++++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index eca392b64d9..dcc98a9a0c4 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -322,6 +322,12 @@ static const char *test9b = "\r\n" " Test4 REG_DWORD 0xabc\r\n" " Wine REG_SZ Second instance\r\n\r\n"; +static const char *test9c = "\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n" + " Wine REG_SZ First instance\r\n\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n" + " Wine REG_SZ Second instance\r\n\r\n"; + static void create_test_key(REGSAM sam) { HKEY hkey, subkey; @@ -367,6 +373,10 @@ static void test_registry_view_win32(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, 0); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); /* Try querying the 64-bit registry view, which doesn't exist on 32-bit Windows */ @@ -380,6 +390,10 @@ static void test_registry_view_win32(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, 0); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); } @@ -407,6 +421,10 @@ static void test_registry_view_win64(void) todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, TODO_REG_COMPARE); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); @@ -421,6 +439,10 @@ static void test_registry_view_win64(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, 0); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); } @@ -447,6 +469,10 @@ static void test_registry_view_wow64(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, 0); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, 0); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); @@ -461,6 +487,10 @@ static void test_registry_view_wow64(void) todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9c, TRUE, TODO_REG_COMPARE); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index dfe68741881..3c5790ae82d 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: 3186a0046336e82a2e8133f8a5958e6250c6fe61 + wine: 45955658e18b65d3af701885e2cfa58bd0c95ceb
2 years, 6 months
1
0
0
0
[reactos] 143/158: [WINESYNC] reg/tests: Don't verify key deletion after calling delete_tree().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=df1bb03b05f8ed8e21948…
commit df1bb03b05f8ed8e21948c0f3c2337d9fca35449 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Don't verify key deletion after calling delete_tree(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 3186a0046336e82a2e8133f8a5958e6250c6fe61 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 1 - modules/rostests/winetests/reg/copy.c | 27 --------------------------- modules/rostests/winetests/reg/delete.c | 9 --------- modules/rostests/winetests/reg/export.c | 1 - modules/rostests/winetests/reg/import.c | 4 ---- modules/rostests/winetests/reg/query.c | 1 - sdk/tools/winesync/reg.cfg | 2 +- 7 files changed, 1 insertion(+), 44 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 469f354de39..2c1a2cf35e3 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -226,7 +226,6 @@ static void test_command_syntax(void) DWORD r; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - 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); diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index c6a83e57276..e9542a67f5e 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -127,10 +127,7 @@ static void test_copy_empty_key(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); @@ -192,10 +189,7 @@ static void test_copy_simple_data(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); @@ -262,10 +256,7 @@ static void test_copy_complex_data(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); @@ -331,10 +322,7 @@ static void test_copy_key_order(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); add_key(hkey, "Subkey2", 0, NULL); @@ -356,10 +344,7 @@ static void test_copy_value_order(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); @@ -381,10 +366,7 @@ static void test_copy_hex_data(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Try copying empty hex values */ add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); @@ -450,10 +432,7 @@ static void test_copy_embedded_null_values(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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" "[HKEY_CURRENT_USER\\" COPY_SRC "]\n" @@ -483,10 +462,7 @@ static void test_copy_slashes(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); add_key(hkey, "
https://winehq.org
", 0, NULL); @@ -509,10 +485,7 @@ static void test_copy_escaped_null_values(void) DWORD r; delete_tree(HKEY_CURRENT_USER, COPY_SRC, 0); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0); - 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); 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 0c313c12a31..2bc1abadfcb 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -24,7 +24,6 @@ static void test_command_syntax(void) DWORD r; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - 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); @@ -85,7 +84,6 @@ static void test_delete(void) const DWORD deadbeef = 0xdeadbeef; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Create a test key */ add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -184,7 +182,6 @@ static void test_registry_view_win32(void) 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); @@ -257,10 +254,7 @@ static void test_registry_view_win64(void) 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); @@ -336,10 +330,7 @@ static void test_registry_view_wow64(void) 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); diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index 0f48443384e..e32f750079e 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -177,7 +177,6 @@ static void test_export(void) BYTE hex[4], buffer[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - 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 2531ba336e8..ace45cf5984 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -102,7 +102,6 @@ static void test_import(void) BYTE hex[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - 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); @@ -1655,7 +1654,6 @@ static void test_unicode_import(void) BYTE hex[8]; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - 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 */, @@ -3201,7 +3199,6 @@ static void test_import_with_whitespace(void) DWORD r, dword; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); test_import_str(" REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); @@ -3347,7 +3344,6 @@ static void test_unicode_import_with_whitespace(void) DWORD r, dword; 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" "[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 590d322c37c..eca392b64d9 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -204,7 +204,6 @@ static void test_query(void) BYTE buf[512]; delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0); /* Key not present */ run_reg_exe("reg query HKCU\\" KEY_BASE, &r); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index fdd5714c815..dfe68741881 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: 5115e51adb103f023600269ddc1833386fcc1e79 + wine: 3186a0046336e82a2e8133f8a5958e6250c6fe61
2 years, 6 months
1
0
0
0
[reactos] 142/158: [WINESYNC] reg/tests: Verify key opening and key deletion in delete_tree().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d9dfc03d8d9c9e212712…
commit 2d9dfc03d8d9c9e212712827a63855884763cd1f Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Verify key opening and key deletion in delete_tree(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 5115e51adb103f023600269ddc1833386fcc1e79 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 7 +++++-- modules/rostests/winetests/reg/reg_test.h | 3 ++- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 36fa634796d..469f354de39 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(HKEY root, const char *path, REGSAM sam) +LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam) { HKEY hkey; LONG ret; @@ -163,6 +163,7 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam) static const char empty[1]; ret = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey); + lok(!ret || ret == ERROR_FILE_NOT_FOUND, "RegOpenKeyExA failed, got error %d\n", ret); if (ret) return ret; ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &max_subkey_len, @@ -184,7 +185,7 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam) 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, sam); + ret = delete_tree_(file, line, hkey, subkey_name, sam); if (ret) goto cleanup; } @@ -193,6 +194,8 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam) else ret = RegDeleteKeyExA(hkey, empty, sam, 0); + lok(!ret, "Failed to delete registry key, got error %d\n", ret); + cleanup: HeapFree(GetProcessHeap(), 0, subkey_name); RegCloseKey(hkey); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index a5d7169beb4..3f64e552a19 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -64,7 +64,8 @@ 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(HKEY root, const char *path, REGSAM sam); +#define delete_tree(r,p,s) delete_tree_(__FILE__,__LINE__,r,p,s) +LONG delete_tree_(const char *file, unsigned line, 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 823cdbe2830..fdd5714c815 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: 76b30097525f755f572d835b0187d9496941d985 + wine: 5115e51adb103f023600269ddc1833386fcc1e79
2 years, 6 months
1
0
0
0
[reactos] 141/158: [WINESYNC] reg/tests: Test use of registry views with the 'query' operation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4e13fbcfcc8009739a6de…
commit 4e13fbcfcc8009739a6de3137bfac4d9d84c4b40 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Jan 17 18:47:37 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:38 2022 +0200 [WINESYNC] reg/tests: Test use of registry views with the 'query' operation. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 76b30097525f755f572d835b0187d9496941d985 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 181 +++++++++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 182 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index f5ba32f97e3..590d322c37c 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -132,6 +132,16 @@ static void test_command_syntax(void) run_reg_exe("reg query HKCU\\" KEY_BASE " /s /s", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Test registry view */ + run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:32 /reg:32", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:32 /reg:64", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:64 /reg:64", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); } static void test_query(void) @@ -296,6 +306,165 @@ static void test_query(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); } +static const char *test9a = "\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n" + " Test1 REG_SZ Hello, World\r\n" + " Test2 REG_DWORD 0x123\r\n" + " Wine REG_SZ First instance\r\n\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n"; + +static const char *test9b = "\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n" + " Test1 REG_SZ Hello, World\r\n" + " Test2 REG_DWORD 0x123\r\n" + " Wine REG_SZ First instance\r\n\r\n" + "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n" + " Test3 REG_SZ Some string data\r\n" + " Test4 REG_DWORD 0xabc\r\n" + " Wine REG_SZ Second instance\r\n\r\n"; + +static void create_test_key(REGSAM sam) +{ + HKEY hkey, subkey; + DWORD dword; + + add_key(HKEY_LOCAL_MACHINE, KEY_BASE, sam, &hkey); + add_value(hkey, "Test1", REG_SZ, "Hello, World", 13); + dword = 0x123; + add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); + add_value(hkey, "Wine", REG_SZ, "First instance", 15); + + add_key(hkey, "subkey", sam, &subkey); + add_value(subkey, "Test3", REG_SZ, "Some string data", 16); + dword = 0xabc; + add_value(subkey, "Test4", REG_DWORD, &dword, sizeof(dword)); + add_value(subkey, "Wine", REG_SZ, "Second instance", 16); + + close_key(subkey); + close_key(hkey); +} + +static void test_registry_view_win32(void) +{ + BOOL is_wow64, is_win32; + DWORD r; + BYTE buf[512]; + + 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); + + /* Try querying the 32-bit registry view (32-bit Windows) */ + create_test_key(KEY_WOW64_32KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Try querying the 64-bit registry view, which doesn't exist on 32-bit Windows */ + create_test_key(KEY_WOW64_64KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + +static void test_registry_view_win64(void) +{ + BOOL is_wow64, is_win64; + DWORD r; + BYTE buf[512]; + + 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); + + /* Try querying the 32-bit registry view (64-bit Windows) */ + create_test_key(KEY_WOW64_32KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, TODO_REG_COMPARE); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try querying the 64-bit registry view (64-bit Windows) */ + create_test_key(KEY_WOW64_64KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + +static void test_registry_view_wow64(void) +{ + BOOL is_wow64; + DWORD r; + BYTE buf[512]; + + IsWow64Process(GetCurrentProcess(), &is_wow64); + + if (!is_wow64) return; + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + + /* Try querying the 32-bit registry view (WOW64) */ + create_test_key(KEY_WOW64_32KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, 0); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, 0); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY); + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); + + /* Try querying the 64-bit registry view (WOW64) */ + create_test_key(KEY_WOW64_64KEY); + + read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9a, FALSE, TODO_REG_COMPARE); + + read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test9b, FALSE, TODO_REG_COMPARE); + + delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); +} + START_TEST(query) { DWORD r; @@ -307,4 +476,16 @@ START_TEST(query) test_command_syntax(); test_query(); + + /* 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 60ba2410111..823cdbe2830 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: a899d743c585fe8004c41f12cf0a080ebe622fd1 + wine: 76b30097525f755f572d835b0187d9496941d985
2 years, 6 months
1
0
0
0
[reactos] 140/158: [WINESYNC] reg/tests: Split 'query' syntax tests into a separate function.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e89696846fa18e589202f…
commit e89696846fa18e589202f9ad1151828413cd9838 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:38 2022 +0200 [WINESYNC] reg/tests: Split 'query' 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 a899d743c585fe8004c41f12cf0a080ebe622fd1 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 54 +++++++++++++++++++--------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 270f0aad75d..f5ba32f97e3 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -105,6 +105,35 @@ static void compare_query_(const char *file, unsigned line, const BYTE *buf, /* Unit tests */ +static void test_command_syntax(void) +{ + DWORD r; + + run_reg_exe("reg query", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query /?", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query /h", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query -H", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /v Test2", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /ve", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /s /s", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + static void test_query(void) { const char *test1 = "\r\n" @@ -167,18 +196,6 @@ static void test_query(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0); 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); - - run_reg_exe("reg query /?", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query /h", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query -H", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - /* Key not present */ run_reg_exe("reg query HKCU\\" KEY_BASE, &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -188,21 +205,9 @@ static void test_query(void) add_value(hkey, "Test1", REG_SZ, "Hello, World", 13); add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Missing", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /v Test2", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /ve", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /s /s", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - 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); compare_query(buf, test1, FALSE, 0); @@ -300,5 +305,6 @@ START_TEST(query) return; } + test_command_syntax(); test_query(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 7f559185a17..60ba2410111 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: 31f070f7d3e312942d72e774a4a7dbd21b655a31 + wine: a899d743c585fe8004c41f12cf0a080ebe622fd1
2 years, 6 months
1
0
0
0
[reactos] 139/158: [WINESYNC] reg: Support use of registry views when deleting registry keys.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=129ed8f5fb523ae0cae40…
commit 129ed8f5fb523ae0cae40affd4625697c356c139 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 keys. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 31f070f7d3e312942d72e774a4a7dbd21b655a31 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/delete.c | 18 +++++++++++------- modules/rostests/winetests/reg/delete.c | 18 +++++++++--------- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index f6965493faa..cf0108664fd 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -59,25 +59,29 @@ static int run_delete(HKEY root, WCHAR *path, REGSAM sam, WCHAR *key_name, WCHAR } } + if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE|sam, &hkey))) + { + output_error(rc); + return 1; + } + /* Delete registry key if no /v* option is given */ if (!value_name && !value_empty && !value_all) { - if ((rc = RegDeleteTreeW(root, path))) + if ((rc = RegDeleteTreeW(hkey, NULL))) { + RegCloseKey(hkey); output_error(rc); return 1; } + RegDeleteKeyW(hkey, L""); + RegCloseKey(hkey); + output_message(STRING_SUCCESS); return 0; } - if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE|sam, &hkey))) - { - output_error(rc); - return 1; - } - op_delete_key = FALSE; if (value_all) diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index 102fc0d788a..0c313c12a31 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -284,19 +284,19 @@ static void test_registry_view_win64(void) 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); + 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); - 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); + 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 (64-bit Windows) */ create_test_key(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); open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey); @@ -394,14 +394,14 @@ static void test_registry_view_wow64(void) 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); + 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); - 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); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY); } START_TEST(delete) diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index c8796ab5481..7f559185a17 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: 8d42cb9c1ca72e02b8961d6703aaa2e3ddfda5e2 + wine: 31f070f7d3e312942d72e774a4a7dbd21b655a31
2 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
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