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] 78/158: [WINESYNC] reg/tests: Test key creation and initialization of the Default registry value.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00ef8711f9893b8e2351d…
commit 00ef8711f9893b8e2351db0c248d03be36ef482b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:23 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:33 2022 +0200 [WINESYNC] reg/tests: Test key creation and initialization of the Default registry value. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id e9412a8ae020fe614d96d20f20355d53593048cc by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 41 ++++++++++++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index e62caeade01..36b5f821350 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -329,6 +329,46 @@ static void test_add(void) open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_WRITE, &hkey); + /* The Default value is initialized if no parameters are specified */ + todo_wine verify_reg(hkey, NULL, REG_SZ, "", 1, 0); + todo_wine delete_value(hkey, NULL); + + /* This also occurs when specifying a registry type and passing data */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /d 0x5 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x5; + verify_reg(hkey, NULL, REG_DWORD, &dword, sizeof(dword), 0); + + /* The Default value can also be overwritten as an empty string */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, NULL, REG_SZ, "", 1, TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA); + + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Specifying a value name doesn't initialize the Default value in a new key */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test /t REG_SZ /d \"Just me here\" /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + + verify_reg(hkey, "Test", REG_SZ, "Just me here", 13, 0); + verify_reg_nonexist(hkey, NULL); + + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Adding a registry key via WinAPI doesn't initialize the Default value... */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + verify_reg_nonexist(hkey, NULL); + + /* ... but we can add it without passing [/f] to reg.exe */ + run_reg_exe("reg add HKCU\\" KEY_BASE, &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg(hkey, NULL, REG_SZ, "", 1, 0); + todo_wine delete_value(hkey, NULL); + /* Test whether overwriting a registry key modifies existing keys and values */ add_key(hkey, "Subkey", NULL); add_value(hkey, "Test1", REG_SZ, "Value1", 7); @@ -342,6 +382,7 @@ static void test_add(void) verify_key(hkey, "Subkey"); verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0); + todo_wine verify_reg(hkey, NULL, REG_SZ, "", 1, 0); close_key(hkey); delete_tree(HKEY_CURRENT_USER, KEY_BASE); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 2ecf20d8ee2..0ce4b38b11f 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: 559086af62254a1f82c25f4fd4c145d93c60b973 + wine: e9412a8ae020fe614d96d20f20355d53593048cc
2 years, 6 months
1
0
0
0
[reactos] 77/158: [WINESYNC] reg/tests: Only pass a newly created HKEY if it is used in later tests.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ba10b11f887b836f02271…
commit ba10b11f887b836f022712d0072b83d17630c9a9 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:23 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:33 2022 +0200 [WINESYNC] reg/tests: Only pass a newly created HKEY if it is used in later tests. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 559086af62254a1f82c25f4fd4c145d93c60b973 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 13 +++++++++---- modules/rostests/winetests/reg/delete.c | 8 +++----- modules/rostests/winetests/reg/export.c | 9 +++------ sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 8357e9ad0bc..e62caeade01 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -126,10 +126,16 @@ void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey) { LONG err; + HKEY new_key; err = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, NULL, subkey, NULL); + KEY_READ|KEY_WRITE, NULL, &new_key, NULL); lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err); + + if (subkey) + *subkey = new_key; + else + RegCloseKey(new_key); } void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *path) @@ -315,7 +321,7 @@ static void test_key_formats(void) static void test_add(void) { - HKEY hkey, hsubkey; + HKEY hkey; DWORD r, dword; run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); @@ -324,8 +330,7 @@ static void test_add(void) open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_WRITE, &hkey); /* Test whether overwriting a registry key modifies existing keys and values */ - add_key(hkey, "Subkey", &hsubkey); - close_key(hsubkey); + add_key(hkey, "Subkey", NULL); add_value(hkey, "Test1", REG_SZ, "Value1", 7); dword = 0x123; add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c index 77d95d013c9..575c393d2b3 100644 --- a/modules/rostests/winetests/reg/delete.c +++ b/modules/rostests/winetests/reg/delete.c @@ -21,7 +21,7 @@ static void test_delete(void) { - HKEY hkey, hsubkey; + HKEY hkey; DWORD r; const DWORD deadbeef = 0xdeadbeef; @@ -75,8 +75,7 @@ static void test_delete(void) add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef)); - add_key(hkey, "subkey", &hsubkey); - close_key(hsubkey); + add_key(hkey, "subkey", 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); @@ -92,8 +91,7 @@ static void test_delete(void) verify_key(hkey, "subkey"); /* Test forward and back slashes */ - add_key(hkey, "
https://winehq.org
", &hsubkey); - close_key(hsubkey); + add_key(hkey, "
https://winehq.org
", 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 4e5ac4c71d9..daf42f66e3e 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -291,10 +291,8 @@ static void test_export(void) /* Test the export order of registry keys */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "Subkey2", &subkey); - close_key(subkey); - add_key(hkey, "Subkey1", &subkey); - close_key(subkey); + add_key(hkey, "Subkey2", NULL); + add_key(hkey, "Subkey1", 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); @@ -405,8 +403,7 @@ static void test_export(void) /* Test registry export with forward and back slashes */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "
https://winehq.org
", &subkey); - close_key(subkey); + add_key(hkey, "
https://winehq.org
", NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); close_key(hkey); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 10c74a333ae..2ecf20d8ee2 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: 45b66285c38462bb57e8ab8a577f8df2dba15363 + wine: 559086af62254a1f82c25f4fd4c145d93c60b973
2 years, 6 months
1
0
0
0
[reactos] 76/158: [WINESYNC] reg/tests: Refactor 'add' tests into registry types, keys and syntax checks.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3969dcc3de1271e3d233f…
commit 3969dcc3de1271e3d233f2f55bfcb2c16d5ed096 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:23 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:33 2022 +0200 [WINESYNC] reg/tests: Refactor 'add' tests into registry types, keys and syntax checks. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 45b66285c38462bb57e8ab8a577f8df2dba15363 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 253 +++++++++++++++++++++++------------ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 168 insertions(+), 87 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 30e5fe55667..8357e9ad0bc 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -204,12 +204,9 @@ void delete_value_(const char *file, unsigned line, const HKEY hkey, const char /* Unit tests */ -static void test_add(void) +static void test_command_syntax(void) { - HKEY hkey, hsubkey; - LONG err; - DWORD r, dword, type, size; - char buffer[22]; + DWORD r; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -226,19 +223,56 @@ static void test_add(void) run_reg_exe("reg add -H", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + /* Duplicate switches */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup2 /t REG_DWORD /d 123 /f /d 456", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /f /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /ve", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* No /v argument */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /d Test /f /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Test invalid switches */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid1 /a", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid2 /ae", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid3 /", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid4 -", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); /* 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 %u, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + +static void test_key_formats(void) +{ + HKEY hkey; + DWORD r; + LONG err; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - /* Test input key formats */ 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"); @@ -257,13 +291,19 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_key(hkey, "keytest3"); - delete_key(hkey, "keytest3"); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_key(hkey, "keytest4"); - delete_key(hkey, "keytest4"); + run_reg_exe("reg add HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "
https://winehq.org
"); + + close_key(hkey); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + + /* Test validity of trailing backslash after system key */ run_reg_exe("reg add HKCU\\ /v Value1 /t REG_SZ /d foo /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); todo_wine verify_reg_nonexist(HKEY_CURRENT_USER, "Value1"); @@ -271,8 +311,44 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\ /v Value2 /t REG_SZ /d bar /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); todo_wine verify_reg_nonexist(HKEY_CURRENT_USER, "Value2"); +} + +static void test_add(void) +{ + HKEY hkey, hsubkey; + DWORD r, dword; + + run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_WRITE, &hkey); + + /* Test whether overwriting a registry key modifies existing keys and values */ + add_key(hkey, "Subkey", &hsubkey); + close_key(hsubkey); + add_value(hkey, "Test1", REG_SZ, "Value1", 7); + dword = 0x123; + add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + verify_key(HKEY_CURRENT_USER, KEY_BASE); + verify_key(hkey, "Subkey"); + verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); + verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0); + + close_key(hkey); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_none(void) +{ + HKEY hkey; + DWORD r; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - /* REG_NONE */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0); @@ -285,7 +361,17 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0); - /* REG_SZ */ + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_sz(void) +{ + HKEY hkey; + DWORD r; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %d, expected 0\n", r); @@ -340,7 +426,26 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "\\0", REG_SZ, "Value", 6, 0); - /* REG_EXPAND_SZ */ + /* Test support for forward and back slashes in value names */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v count/up /d one/two/three /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_expand_sz(void) +{ + HKEY hkey; + DWORD r; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); @@ -365,7 +470,19 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0); - /* REG_BINARY */ + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_binary(void) +{ + HKEY hkey; + DWORD r, dword, type, size; + char buffer[22]; + LONG err; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "bin0", REG_BINARY, buffer, 0, 0); @@ -389,7 +506,7 @@ static void test_add(void) /* Remaining nibble prefixed */ buffer[0] = 0x0d; buffer[1] = 0xea; buffer[2] = 0xdb; buffer[3] = 0xee; buffer[4] = 0xf0; buffer[5] = 0xdd; - /* Remaining nibble suffixed on winXP */ + /* Remaining nibble suffixed on WinXP */ buffer[6] = 0xde; buffer[7] = 0xad; buffer[8] = 0xbe; buffer[9] = 0xef; buffer[10] = 0x0d; buffer[11] = 0xd0; size = 6; @@ -411,7 +528,18 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0); - /* REG_DWORD */ + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_dword(void) +{ + HKEY hkey; + DWORD r, dword, type, size; + LONG err; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &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 */), "got exit code %d, expected 0\n", r); @@ -510,7 +638,18 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD_BIG_ENDIAN /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r); - /* REG_MULTI_SZ */ + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_reg_multi_sz(void) +{ + HKEY hkey; + DWORD r; + char buffer[22]; + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); memcpy(buffer, "three\0little\0strings\0", 22); @@ -596,74 +735,8 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0); - /* Test forward and back slashes */ - run_reg_exe("reg add HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "
https://winehq.org
"); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v count/up /d one/two/three /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); - close_key(hkey); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - - /* Test duplicate switches */ - run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), - "got exit code %u, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup2 /t REG_DWORD /d 123 /f /d 456", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - - /* Multiple /v* switches */ - run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /ve", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* No /v argument */ - run_reg_exe("reg add HKCU\\" KEY_BASE " /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /d Test /f /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* Test invalid switches */ - run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid1 /a", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid2 /ae", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid3 /", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid4 -", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - - /* Test whether overwriting a registry key modifies existing keys and values */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "Subkey", &hsubkey); - close_key(hsubkey); - add_value(hkey, "Test1", REG_SZ, "Value1", 7); - dword = 0x123; - add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - verify_key(HKEY_CURRENT_USER, KEY_BASE); - verify_key(hkey, "Subkey"); - verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); - verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0); - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE); } START_TEST(add) @@ -675,5 +748,13 @@ START_TEST(add) return; } + test_command_syntax(); + test_key_formats(); test_add(); + test_reg_none(); + test_reg_sz(); + test_reg_expand_sz(); + test_reg_binary(); + test_reg_dword(); + test_reg_multi_sz(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 968d8ec828e..10c74a333ae 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: f6566bf7493dea2511238ad59aae873168b16963 + wine: 45b66285c38462bb57e8ab8a577f8df2dba15363
2 years, 6 months
1
0
0
0
[reactos] 75/158: [WINESYNC] reg/tests: Test output of keys with a trailing backslash.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=16cc1ad7710cb892b5b63…
commit 16cc1ad7710cb892b5b63cc5a2305e36410157f6 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:23 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:33 2022 +0200 [WINESYNC] reg/tests: Test output of keys with a trailing backslash. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id f6566bf7493dea2511238ad59aae873168b16963 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 4 ++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 410f4b250d3..c475d288fd8 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -233,6 +233,10 @@ static void test_query(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); compare_query(buf, test6, FALSE, 0); + read_reg_output("reg query HKCU\\" KEY_BASE "\\ /s", buf, sizeof(buf), &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test6, FALSE, TODO_REG_COMPARE); + read_reg_output("reg query HKCU\\" KEY_BASE " /v Wine /s", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\n", r); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index f832bc8e335..968d8ec828e 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: f4b4398d797382f238f6a21da259fed0d0e2a286 + wine: f6566bf7493dea2511238ad59aae873168b16963
2 years, 6 months
1
0
0
0
[reactos] 74/158: [WINESYNC] reg/tests: Compare output of some 'query' recursion tests.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e77afe91c9e73fe55d9f6…
commit e77afe91c9e73fe55d9f69c835378cf592ca2e92 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:22 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg/tests: Compare output of some 'query' recursion tests. Recursively querying a registry key for a given value name produces an extra line specifying the number of matches found. This line is locale-specific, so we only exclude it from the comparison on a test-by-test basis. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id f4b4398d797382f238f6a21da259fed0d0e2a286 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 51 ++++++++++++++++++++++++++-------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index af0cc3848a4..410f4b250d3 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -84,12 +84,23 @@ static BOOL read_reg_output_(const char *file, unsigned line, const char *cmd, return bret; } -#define compare_query(b,e,todo) compare_query_(__FILE__,__LINE__,b,e,todo) +#define compare_query(b,e,c,todo) compare_query_(__FILE__,__LINE__,b,e,c,todo) static void compare_query_(const char *file, unsigned line, const BYTE *buf, - const char *expected, DWORD todo) + const char *expected, BOOL cmp_len, DWORD todo) { - todo_wine_if (todo & TODO_REG_COMPARE) - lok(!strcmp((char *)buf, expected), "query output does not match expected output\n"); + const char *str = (const char *)buf; + const char *err = "query output does not match expected output"; + + if (!cmp_len) + { + todo_wine_if (todo & TODO_REG_COMPARE) + lok(!strcmp(str, expected), "%s\n", err); + } + else + { + todo_wine_if (todo & TODO_REG_COMPARE) + lok(!strncmp(str, expected, strlen(expected)), "%s\n", err); + } } /* Unit tests */ @@ -121,6 +132,22 @@ static void test_query(void) "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n" " Test4 REG_DWORD 0xabc\r\n\r\n"; + const char *test6 = "\r\n" + "HKEY_CURRENT_USER\\" 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_CURRENT_USER\\" 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"; + + const char *test7 = "\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\r\n" + " Wine REG_SZ First instance\r\n\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n" + " Wine REG_SZ Second instance\r\n\r\n"; + DWORD r, dword = 0x123; HKEY key, subkey; BYTE buf[512]; @@ -162,7 +189,7 @@ static void test_query(void) 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, 0); + compare_query(buf, test1, FALSE, 0); run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), @@ -170,7 +197,7 @@ static void test_query(void) read_reg_output("reg query HKCU\\" KEY_BASE " /v Test1", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test2, 0); + compare_query(buf, test2, FALSE, 0); run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test2", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -182,7 +209,7 @@ static void test_query(void) 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, test3, TODO_REG_COMPARE); + compare_query(buf, test3, FALSE, TODO_REG_COMPARE); add_value(subkey, "Test3", REG_SZ, "Some string data", 16); dword = 0xabc; @@ -190,24 +217,26 @@ static void test_query(void) read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test4, 0); + compare_query(buf, test4, FALSE, 0); run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test3", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey /v Test4", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - compare_query(buf, test5, 0); + compare_query(buf, test5, FALSE, 0); add_value(subkey, "Wine", REG_SZ, "Second instance", 16); /* Test recursion */ - run_reg_exe("reg query HKCU\\" KEY_BASE " /s", &r); + read_reg_output("reg query HKCU\\" KEY_BASE " /s", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test6, FALSE, 0); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine /s", &r); + read_reg_output("reg query HKCU\\" KEY_BASE " /v Wine /s", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\n", r); + compare_query(buf, test7, TRUE, 0); add_value(key, NULL, REG_SZ, "Empty", 6); add_value(subkey, NULL, REG_SZ, "Empty", 6); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 38d5fe033b8..f832bc8e335 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: 5983247c3a5a7b5b64498a2cdff0eadf5edc47b5 + wine: f4b4398d797382f238f6a21da259fed0d0e2a286
2 years, 6 months
1
0
0
0
[reactos] 73/158: [WINESYNC] reg/tests: Compare 'query'test output with expected output.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5132d26c4c4a1f6d368da…
commit 5132d26c4c4a1f6d368da5ca296f169fee2de81e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:22 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg/tests: Compare 'query'test output with expected output. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 5983247c3a5a7b5b64498a2cdff0eadf5edc47b5 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/add.c | 4 - modules/rostests/winetests/reg/export.c | 2 - modules/rostests/winetests/reg/query.c | 120 ++++++++++++++++++++++++++++-- modules/rostests/winetests/reg/reg_test.h | 5 ++ sdk/tools/winesync/reg.cfg | 2 +- 5 files changed, 121 insertions(+), 12 deletions(-) diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index 2c5a8f34ce2..30e5fe55667 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -18,10 +18,6 @@ #include "reg_test.h" -#define TODO_REG_TYPE (0x0001u) -#define TODO_REG_SIZE (0x0002u) -#define TODO_REG_DATA (0x0004u) - BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc) { STARTUPINFOA si = {sizeof(STARTUPINFOA)}; diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c index 5296ebb1e06..4e5ac4c71d9 100644 --- a/modules/rostests/winetests/reg/export.c +++ b/modules/rostests/winetests/reg/export.c @@ -18,8 +18,6 @@ #include "reg_test.h" -#define TODO_REG_COMPARE (0x0008u) - #define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo) static BOOL compare_export_(const char *file, unsigned line, const char *filename, const char *expected, DWORD todo) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index d397f36fc09..af0cc3848a4 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -19,10 +19,111 @@ #include "reg_test.h" +static void read_from_pipe(HANDLE child_proc_stdout, BYTE *buf, DWORD buf_size) +{ + DWORD read, len = 0; + BOOL ret; + + while (1) + { + ret = ReadFile(child_proc_stdout, buf + len, buf_size - len, &read, NULL); + if (!ret || !read) break; + + len += read; + } + + buf[len] = 0; +} + +#define read_reg_output(c,b,s,r) read_reg_output_(__FILE__,__LINE__,c,b,s,r) +static BOOL read_reg_output_(const char *file, unsigned line, const char *cmd, + BYTE *buf, DWORD buf_size, DWORD *rc) +{ + SECURITY_ATTRIBUTES sa; + HANDLE pipe_stdout_rd, pipe_stdout_wr; + STARTUPINFOA si = {0}; + PROCESS_INFORMATION pi; + char cmdline[256]; + BOOL bret; + DWORD ret; + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = TRUE; + sa.lpSecurityDescriptor = NULL; + + if (!CreatePipe(&pipe_stdout_rd, &pipe_stdout_wr, &sa, 0)) + return FALSE; + + if (!SetHandleInformation(pipe_stdout_rd, HANDLE_FLAG_INHERIT, 0)) + return FALSE; + + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = INVALID_HANDLE_VALUE; + si.hStdOutput = pipe_stdout_wr; + si.hStdError = INVALID_HANDLE_VALUE; + + strcpy(cmdline, cmd); + if (!CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) + return FALSE; + + CloseHandle(pipe_stdout_wr); + + read_from_pipe(pipe_stdout_rd, buf, buf_size); + + ret = WaitForSingleObject(pi.hProcess, 10000); + if (ret == WAIT_TIMEOUT) + TerminateProcess(pi.hProcess, 1); + + bret = GetExitCodeProcess(pi.hProcess, rc); + lok(bret, "GetExitCodeProcess failed: %d\n", GetLastError()); + + CloseHandle(pipe_stdout_rd); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + return bret; +} + +#define compare_query(b,e,todo) compare_query_(__FILE__,__LINE__,b,e,todo) +static void compare_query_(const char *file, unsigned line, const BYTE *buf, + const char *expected, DWORD todo) +{ + todo_wine_if (todo & TODO_REG_COMPARE) + lok(!strcmp((char *)buf, expected), "query output does not match expected output\n"); +} + +/* Unit tests */ + static void test_query(void) { + const char *test1 = "\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\r\n" + " Test1 REG_SZ Hello, World\r\n" + " Test2 REG_DWORD 0x123\r\n\r\n"; + + const char *test2 = "\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\r\n" + " Test1 REG_SZ Hello, World\r\n\r\n"; + + const char *test3 = "\r\n" + "HKEY_CURRENT_USER\\" 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_CURRENT_USER\\" KEY_BASE "\\subkey\r\n"; + + const char *test4 = "\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n" + " Test3 REG_SZ Some string data\r\n" + " Test4 REG_DWORD 0xabc\r\n\r\n"; + + const char *test5 = "\r\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n" + " Test4 REG_DWORD 0xabc\r\n\r\n"; + DWORD r, dword = 0x123; HKEY key, subkey; + BYTE buf[512]; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -59,15 +160,17 @@ static void test_query(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); - run_reg_exe("reg query HKCU\\" KEY_BASE, &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, 0); run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1", &r); + read_reg_output("reg query HKCU\\" KEY_BASE " /v Test1", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test2, 0); run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test2", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -75,19 +178,26 @@ static void test_query(void) add_value(key, "Wine", REG_SZ, "First instance", 15); /* Create a test subkey */ - add_key(key, "Subkey", &subkey); + add_key(key, "subkey", &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); + compare_query(buf, test3, TODO_REG_COMPARE); + add_value(subkey, "Test3", REG_SZ, "Some string data", 16); dword = 0xabc; add_value(subkey, "Test4", REG_DWORD, &dword, sizeof(dword)); - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); + read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test4, 0); run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test3", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test4", &r); + read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey /v Test4", buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + compare_query(buf, test5, 0); add_value(subkey, "Wine", REG_SZ, "Second instance", 16); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 14afa02930c..6718e91096f 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -30,6 +30,11 @@ #define REG_EXIT_SUCCESS 0 #define REG_EXIT_FAILURE 1 +#define TODO_REG_TYPE (0x0001u) +#define TODO_REG_SIZE (0x0002u) +#define TODO_REG_DATA (0x0004u) +#define TODO_REG_COMPARE (0x0008u) + /* add.c */ #define run_reg_exe(c,r) run_reg_exe_(__FILE__,__LINE__,c,r) BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 20b00b1e23e..38d5fe033b8 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: 5bc2af7b1cf2e4e56311dad77acd8f67b3b7a13f + wine: 5983247c3a5a7b5b64498a2cdff0eadf5edc47b5
2 years, 6 months
1
0
0
0
[reactos] 72/158: [WINESYNC] reg/tests: Give 'query' tests some structure.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a12c844899ceb5418ea5c…
commit a12c844899ceb5418ea5cd0b6e89e7c1d1753913 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:22 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg/tests: Give 'query' tests some structure. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 5bc2af7b1cf2e4e56311dad77acd8f67b3b7a13f by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 57 ++++++++++++++-------------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index 3ae79d05524..d397f36fc09 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -21,14 +21,8 @@ static void test_query(void) { - DWORD r; + DWORD r, dword = 0x123; HKEY key, subkey; - const char hello[] = "Hello"; - const char world[] = "World"; - const char empty1[] = "Empty1"; - const char empty2[] = "Empty2"; - const DWORD dword1 = 0x123; - const DWORD dword2 = 0xabc; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -47,8 +41,8 @@ static void test_query(void) /* Create a test key */ add_key(HKEY_CURRENT_USER, KEY_BASE, &key); - add_value(key, "Test", REG_SZ, hello, sizeof(hello)); - add_value(key, "Wine", REG_DWORD, &dword1, sizeof(dword1)); + add_value(key, "Test1", REG_SZ, "Hello, World", 13); + add_value(key, "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); @@ -56,65 +50,62 @@ static void test_query(void) 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 Test /v Wine", &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 Test /ve", &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); + run_reg_exe("reg query HKCU\\" KEY_BASE, &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %d, expected 0\n", r); - add_value(key, NULL, REG_SZ, empty1, sizeof(empty1)); - - run_reg_exe("reg query HKCU\\" KEY_BASE, &r); + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test", &r); + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test2", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + add_value(key, "Wine", REG_SZ, "First instance", 15); /* Create a test subkey */ add_key(key, "Subkey", &subkey); - add_value(subkey, "Test", REG_SZ, world, sizeof(world)); - add_value(subkey, "Wine", REG_DWORD, &dword2, sizeof(dword2)); - add_value(subkey, NULL, REG_SZ, empty2, sizeof(empty2)); - - close_key(subkey); + add_value(subkey, "Test3", REG_SZ, "Some string data", 16); + dword = 0xabc; + add_value(subkey, "Test4", REG_DWORD, &dword, sizeof(dword)); run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test", &r); + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test3", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Wine", &r); + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test4", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /ve", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + add_value(subkey, "Wine", REG_SZ, "Second instance", 16); /* Test recursion */ run_reg_exe("reg query HKCU\\" KEY_BASE " /s", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /s", &r); - ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, - "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine /s", &r); ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\n", r); + add_value(key, NULL, REG_SZ, "Empty", 6); + add_value(subkey, NULL, REG_SZ, "Empty", 6); + close_key(subkey); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /ve", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + run_reg_exe("reg query HKCU\\" KEY_BASE " /ve /s", &r); ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\n", r); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index a688299b625..20b00b1e23e 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: 3d772fe408970f6a1aad02321f21706408dd92e9 + wine: 5bc2af7b1cf2e4e56311dad77acd8f67b3b7a13f
2 years, 6 months
1
0
0
0
[reactos] 71/158: [WINESYNC] reg/tests: Reorder failing 'query' tests.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b12d7980378f91954ed2e…
commit b12d7980378f91954ed2edd6155065f3c3e49021 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:08:22 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg/tests: Reorder failing 'query' tests. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 3d772fe408970f6a1aad02321f21706408dd92e9 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 34 +++++++++++++++++----------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c index e2b438f8c92..3ae79d05524 100644 --- a/modules/rostests/winetests/reg/query.c +++ b/modules/rostests/winetests/reg/query.c @@ -47,24 +47,33 @@ static void test_query(void) /* Create a test key */ add_key(HKEY_CURRENT_USER, KEY_BASE, &key); + add_value(key, "Test", REG_SZ, hello, sizeof(hello)); + add_value(key, "Wine", REG_DWORD, &dword1, sizeof(dword1)); + + 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 Test /v Wine", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /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); run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %d, expected 0\n", r); - add_value(key, "Test", REG_SZ, hello, sizeof(hello)); - add_value(key, "Wine", REG_DWORD, &dword1, sizeof(dword1)); add_value(key, NULL, REG_SZ, empty1, sizeof(empty1)); run_reg_exe("reg query HKCU\\" KEY_BASE, &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 Missing", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -74,12 +83,6 @@ static void test_query(void) run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /v Wine", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /ve", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - /* Create a test subkey */ add_key(key, "Subkey", &subkey); add_value(subkey, "Test", REG_SZ, world, sizeof(world)); @@ -116,9 +119,6 @@ static void test_query(void) ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, "got exit code %d, expected 0\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); - /* Clean-up, then query */ delete_key(key, "subkey"); close_key(key); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 6a3b21ef417..a688299b625 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: 2b900e1c38d9bed0901ea036488e896e6df0cbe9 + wine: 3d772fe408970f6a1aad02321f21706408dd92e9
2 years, 6 months
1
0
0
0
[reactos] 70/158: [WINESYNC] reg: Allow /reg:32 and /reg:64 switches to be passed via the command line.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b6bc8e137107abe8efa41…
commit b6bc8e137107abe8efa4135b5975332b7579e66e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:06:06 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg: Allow /reg:32 and /reg:64 switches to be passed via the command line. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=44755
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 2b900e1c38d9bed0901ea036488e896e6df0cbe9 by Hugh McMaster <hugh.mcmaster(a)outlook.com> manual adjustment needed --- base/applications/cmdutils/reg/add.c | 2 ++ base/applications/cmdutils/reg/delete.c | 2 ++ base/applications/cmdutils/reg/export.c | 2 ++ base/applications/cmdutils/reg/import.c | 21 +++++++++++++++++---- base/applications/cmdutils/reg/lang/en-US.rc | 4 ++++ base/applications/cmdutils/reg/query.c | 2 ++ base/applications/cmdutils/reg/reg.c | 1 + base/applications/cmdutils/reg/resource.h | 1 + sdk/tools/winesync/reg.cfg | 2 +- 9 files changed, 32 insertions(+), 5 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index 4b50a13b975..de22874b901 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -235,6 +235,8 @@ int reg_add(int argc, WCHAR *argvW[]) value_empty = TRUE; continue; } + else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64")) + continue; else if (!str[0] || str[1]) goto invalid; diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index f1b29e6f3a2..db1ed0f5337 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -137,6 +137,8 @@ int reg_delete(int argc, WCHAR *argvW[]) value_empty = TRUE; continue; } + else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64")) + continue; else if (!str[0] || str[1]) goto invalid; diff --git a/base/applications/cmdutils/reg/export.c b/base/applications/cmdutils/reg/export.c index 8abecf1f595..49991c06ee3 100644 --- a/base/applications/cmdutils/reg/export.c +++ b/base/applications/cmdutils/reg/export.c @@ -368,6 +368,8 @@ int reg_export(int argc, WCHAR *argvW[]) if (is_char(*str, 'y') && !str[1]) overwrite_file = TRUE; + else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64")) + continue; else goto invalid; } diff --git a/base/applications/cmdutils/reg/import.c b/base/applications/cmdutils/reg/import.c index 223e7db0e48..5750dbf0c79 100644 --- a/base/applications/cmdutils/reg/import.c +++ b/base/applications/cmdutils/reg/import.c @@ -978,11 +978,19 @@ int reg_import(int argc, WCHAR *argvW[]) BYTE s[2]; struct parser parser; - if (argc > 3) + if (argc > 4) goto invalid; + + if (argc == 4) { - output_message(STRING_INVALID_SYNTAX); - output_message(STRING_FUNC_HELP, wcsupr(argvW[1])); - return 1; + WCHAR *str = argvW[3]; + + if (*str != '/' && *str != '-') + goto invalid; + + str++; + + if (lstrcmpiW(str, L"reg:32") && lstrcmpiW(str, L"reg:64")) + goto invalid; } filename = argvW[2]; @@ -1032,4 +1040,9 @@ int reg_import(int argc, WCHAR *argvW[]) error: fclose(fp); return 1; + +invalid: + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, wcsupr(argvW[1])); + return 1; } diff --git a/base/applications/cmdutils/reg/lang/en-US.rc b/base/applications/cmdutils/reg/lang/en-US.rc index 3457b10bc12..97064f2522b 100644 --- a/base/applications/cmdutils/reg/lang/en-US.rc +++ b/base/applications/cmdutils/reg/lang/en-US.rc @@ -148,4 +148,8 @@ STRINGTABLE STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" STRING_KEY_NONEXIST, "reg: Unable to find the specified registry key\n" STRING_KEY_IMPORT_FAILED, "reg: Unable to import the registry key '%1'\n" + STRING_REG_VIEW_USAGE, " /reg:32\n\ +\ Access the registry using the 32-bit view.\n\n\ +\ /reg:64\n\ +\ Access the registry using the 64-bit view.\n\n" } diff --git a/base/applications/cmdutils/reg/query.c b/base/applications/cmdutils/reg/query.c index d2a7968fa0b..9d840c8947d 100644 --- a/base/applications/cmdutils/reg/query.c +++ b/base/applications/cmdutils/reg/query.c @@ -347,6 +347,8 @@ int reg_query(int argc, WCHAR *argvW[]) value_empty = TRUE; continue; } + else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64")) + continue; else if (!str[0] || str[1]) goto invalid; diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 1230d261d8e..2303df81823 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -338,6 +338,7 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) if (is_help_switch(argvW[2])) { output_message(op_help); + output_message(STRING_REG_VIEW_USAGE); return 0; } diff --git a/base/applications/cmdutils/reg/resource.h b/base/applications/cmdutils/reg/resource.h index 6768aaf595e..c1698e91c7e 100644 --- a/base/applications/cmdutils/reg/resource.h +++ b/base/applications/cmdutils/reg/resource.h @@ -63,3 +63,4 @@ #define STRING_OVERWRITE_FILE 138 #define STRING_KEY_NONEXIST 139 #define STRING_KEY_IMPORT_FAILED 140 +#define STRING_REG_VIEW_USAGE 141 diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index af152700ed8..6a3b21ef417 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: 010cb1b4057550b2eb6c371db5ba5a8d11ef337e + wine: 2b900e1c38d9bed0901ea036488e896e6df0cbe9
2 years, 6 months
1
0
0
0
[reactos] 69/158: [WINESYNC] reg: Print additional help messages when syntax is invalid.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9cf114d7896097d8f08ed…
commit 9cf114d7896097d8f08ed99c28deae17b631d5e3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 21:06:06 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:32 2022 +0200 [WINESYNC] reg: Print additional help messages when syntax is invalid. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 010cb1b4057550b2eb6c371db5ba5a8d11ef337e by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/add.c | 3 ++- base/applications/cmdutils/reg/delete.c | 3 ++- base/applications/cmdutils/reg/query.c | 3 ++- sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index d94789ad484..4b50a13b975 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -273,6 +273,7 @@ int reg_add(int argc, WCHAR *argvW[]) return run_add(root, path, value_name, value_empty, type, separator, data, force); invalid: - output_message(STRING_INVALID_CMDLINE); + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, wcsupr(argvW[1])); return 1; } diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index 239bbbc672b..f1b29e6f3a2 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -163,6 +163,7 @@ int reg_delete(int argc, WCHAR *argvW[]) return run_delete(root, path, key_name, value_name, value_empty, value_all, force); invalid: - output_message(STRING_INVALID_CMDLINE); + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, wcsupr(argvW[1])); return 1; } diff --git a/base/applications/cmdutils/reg/query.c b/base/applications/cmdutils/reg/query.c index 76f12b4a2d3..d2a7968fa0b 100644 --- a/base/applications/cmdutils/reg/query.c +++ b/base/applications/cmdutils/reg/query.c @@ -373,6 +373,7 @@ int reg_query(int argc, WCHAR *argvW[]) return run_query(root, path, key_name, value_name, value_empty, recurse); invalid: - output_message(STRING_INVALID_CMDLINE); + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, wcsupr(argvW[1])); return 1; } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 540e93ecac6..af152700ed8 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: a47829e13d639831ab9f36ba4592b840259e6f80 + wine: 010cb1b4057550b2eb6c371db5ba5a8d11ef337e
2 years, 6 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
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