Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index afba8424c1a..4be9e635ed7 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -4204,14 +4204,11 @@ static void test_import_31(void) { LONG err; HKEY hkey; - DWORD r; - - err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", err); + DWORD dispos, r;
/* Check if reg.exe is running with elevated privileges */ err = RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_SET_VALUE, NULL, &hkey, NULL); + KEY_READ|KEY_SET_VALUE, NULL, &hkey, &dispos); if (err == ERROR_ACCESS_DENIED) { win_skip("reg.exe is not running with elevated privileges; " @@ -4219,6 +4216,9 @@ static void test_import_31(void) return; }
+ if (dispos == REG_OPENED_EXISTING_KEY) + delete_value(hkey, NULL); + /* Test simple value */ test_import_str("REGEDIT\r\n" "HKEY_CLASSES_ROOT\" KEY_BASE " = Value0\r\n", &r);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 4be9e635ed7..e11e4e9227e 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -222,6 +222,9 @@ static void test_add(void) DWORD r, dword, type, size; char buffer[22];
+ delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + run_reg_exe("reg add", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@@ -234,11 +237,6 @@ 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);
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); - - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - run_reg_exe("reg add HKCU\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
@@ -602,12 +600,11 @@ static void test_add(void) static void test_delete(void) { HKEY hkey, hsubkey; - LONG err; DWORD r; const DWORD deadbeef = 0xdeadbeef;
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
run_reg_exe("reg delete", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -664,8 +661,8 @@ static void test_query(void) const DWORD dword1 = 0x123; const DWORD dword2 = 0xabc;
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
run_reg_exe("reg query", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -858,8 +855,8 @@ static void test_import(void) LONG err; BYTE hex[8];
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
run_reg_exe("reg import", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -2387,8 +2384,8 @@ static void test_unicode_import(void) char buffer[24]; BYTE hex[8];
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
test_import_wstr("REGEDIT\n", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, @@ -3910,8 +3907,8 @@ static void test_import_with_whitespace(void) DWORD r, dword; LONG err;
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
test_import_str(" REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n", &r); @@ -4058,8 +4055,8 @@ static void test_unicode_import_with_whitespace(void) DWORD r, dword; LONG err;
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n", &r); @@ -4453,8 +4450,8 @@ static void test_export(void) ""Wine4g"="Value2"\r\n" ""Wine4h"="abc"\r\n\r\n";
- err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
run_reg_exe("reg export", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -4691,6 +4688,9 @@ static void test_copy(void) { DWORD r;
+ delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + run_reg_exe("reg copy", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 73 +++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 38 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index e11e4e9227e..489989f12a8 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -574,6 +574,9 @@ static void test_add(void) RegCloseKey(hkey);
/* 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); @@ -581,6 +584,17 @@ static void test_add(void) 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); @@ -618,6 +632,27 @@ static void test_delete(void) run_reg_exe("reg delete -H", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ /* Multiple /v* switches */ + run_reg_exe("reg delete HKCU\" KEY_BASE " /v Wine /ve", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /v Wine /va", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /ve /va", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /v Wine /v Test /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* No /v argument */ + run_reg_exe("reg delete HKCU\" KEY_BASE " /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /f /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Create a test key */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); @@ -757,43 +792,6 @@ static void test_query(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); }
-static void test_v_flags(void) -{ - DWORD r; - - 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); - - run_reg_exe("reg delete HKCU\" KEY_BASE " /v Wine /ve", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\" KEY_BASE " /v Wine /va", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\" KEY_BASE " /ve /va", &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); - - run_reg_exe("reg delete HKCU\" KEY_BASE " /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\" KEY_BASE " /f /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* Multiple /v 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 delete HKCU\" KEY_BASE " /v Wine /v Test /f", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); -} - static BOOL write_file(const void *str, DWORD size) { HANDLE file; @@ -4772,7 +4770,6 @@ START_TEST(reg) test_add(); test_delete(); test_query(); - test_v_flags(); test_import(); test_unicode_import(); test_import_with_whitespace();
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 489989f12a8..429de8164e6 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -249,13 +249,11 @@ static void test_add(void) /* Test input key formats */ run_reg_exe("reg add \HKCU\" KEY_BASE "\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); - err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\keytest0"); - ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err); + verify_key_nonexist(hkey, "keytest0");
run_reg_exe("reg add \\HKCU\" KEY_BASE "\keytest1 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); - err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\keytest1"); - ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err); + verify_key_nonexist(hkey, "keytest1");
run_reg_exe("reg add HKCU\" KEY_BASE "\keytest2\\ /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 429de8164e6..2afa5eb01fa 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -4511,7 +4511,7 @@ static void test_export(void) add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); add_value(hkey, "String", REG_SZ, "Your text here...", 18);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", simple_test, 0), "compare_export() failed\n");
@@ -4549,7 +4549,7 @@ static void test_export(void)
RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", complex_test, 0), "compare_export() failed\n");
@@ -4563,7 +4563,7 @@ static void test_export(void) add_key(hkey, "Subkey1", &subkey); RegCloseKey(subkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", key_order_test, 0), "compare_export() failed\n");
@@ -4578,7 +4578,7 @@ static void test_export(void)
RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n");
@@ -4596,7 +4596,7 @@ static void test_export(void) add_value(hkey, "Wine1h", 0xabcd, NULL, 0); RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n");
@@ -4614,7 +4614,7 @@ static void test_export(void) verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0); RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n");
@@ -4633,7 +4633,7 @@ static void test_export(void) verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0); RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n");
@@ -4671,7 +4671,7 @@ static void test_export(void) verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); RegCloseKey(hkey);
- run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n");
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 2afa5eb01fa..9dd3a2afe81 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -4493,6 +4493,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n");
run_reg_exe("reg export /y HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -4503,7 +4504,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE), /* winxp */ "got exit code %d, expected 0\n", r); - ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n");
/* Test registry export with a simple data structure */
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 92 +++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 49 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9dd3a2afe81..471c6ad8d46 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -105,6 +105,15 @@ static void open_key_(unsigned line, const HKEY base, const char *path, const DW lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err); }
+#define close_key(k) close_key_(__LINE__,k) +static void close_key_(unsigned line, HKEY hkey) +{ + LONG err; + + err = RegCloseKey(hkey); + lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err); +} + #define verify_key(k,s) verify_key_(__LINE__,k,s) static void verify_key_(unsigned line, HKEY key_base, const char *subkey) { @@ -569,7 +578,7 @@ 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);
- RegCloseKey(hkey); + close_key(hkey);
/* Test duplicate switches */ run_reg_exe("reg add HKCU\" KEY_BASE " /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r); @@ -657,7 +666,7 @@ static void test_delete(void) add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef));
add_key(hkey, "subkey", &hsubkey); - RegCloseKey(hsubkey); + close_key(hsubkey);
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); @@ -672,7 +681,7 @@ static void test_delete(void) verify_reg_nonexist(hkey, "foo"); verify_key(hkey, "subkey");
- RegCloseKey(hkey); + close_key(hkey);
run_reg_exe("reg delete HKCU\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -686,7 +695,6 @@ static void test_query(void) { DWORD r; HKEY key, subkey; - LONG err; const char hello[] = "Hello"; const char world[] = "World"; const char empty1[] = "Empty1"; @@ -744,8 +752,7 @@ static void test_query(void) add_value(subkey, "Wine", REG_DWORD, &dword2, sizeof(dword2)); add_value(subkey, NULL, REG_SZ, empty2, sizeof(empty2));
- err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey);
run_reg_exe("reg query HKCU\" KEY_BASE "\subkey", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -777,9 +784,7 @@ static void test_query(void)
/* Clean-up, then query */ delete_key(key, "subkey"); - - err = RegCloseKey(key); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(key);
run_reg_exe("reg query HKCU\" KEY_BASE "\subkey", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -1632,8 +1637,7 @@ static void test_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey"1", 0, &subkey); verify_reg(subkey, "Wine\31", REG_SZ, "Test value", 11, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1");
test_import_str("REGEDIT4\n\n" @@ -1642,8 +1646,7 @@ static void test_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/"4;'5", REG_SZ, "Random value name", 18, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2");
/* Test key creation */ @@ -1687,7 +1690,7 @@ static void test_import(void) verify_key(hkey, "Subkey1e"); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1e");
test_import_str("REGEDIT4\n\n" @@ -1699,7 +1702,7 @@ static void test_import(void) verify_key(hkey, "Subkey1f"); open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1f\\");
test_import_str("REGEDIT4\n\n" @@ -1712,7 +1715,7 @@ static void test_import(void) verify_key(hkey, "Subkey1g"); open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1g\\");
/* Test key deletion. We start by creating some registry keys. */ @@ -2366,8 +2369,7 @@ static void test_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f");
- err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -3147,8 +3149,7 @@ static void test_unicode_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey"1", 0, &subkey); verify_reg(subkey, "Wine\31", REG_SZ, "Test value", 11, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3157,8 +3158,7 @@ static void test_unicode_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/"4;'5", REG_SZ, "Random value name", 18, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2");
/* Test key creation */ @@ -3202,7 +3202,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1e"); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1e");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3214,7 +3214,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1f"); open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1f\\");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3227,7 +3227,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1g"); open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1g\\");
/* Test key deletion. We start by creating some registry keys. */ @@ -3891,8 +3891,7 @@ static void test_unicode_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f");
- err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -3901,7 +3900,6 @@ static void test_import_with_whitespace(void) { HKEY hkey; DWORD r, dword; - LONG err;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -4039,8 +4037,7 @@ static void test_import_with_whitespace(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
- err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -4049,7 +4046,6 @@ static void test_unicode_import_with_whitespace(void) { HKEY hkey; DWORD r, dword; - LONG err;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -4187,8 +4183,7 @@ static void test_unicode_import_with_whitespace(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
- err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -4303,7 +4298,7 @@ static void test_import_31(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "");
- RegCloseKey(hkey); + close_key(hkey);
delete_key(HKEY_CLASSES_ROOT, KEY_BASE); } @@ -4519,35 +4514,35 @@ static void test_export(void) add_key(hkey, "Subkey1", &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); - RegCloseKey(subkey); + close_key(subkey);
add_key(hkey, "Subkey2a", &subkey); add_value(subkey, "double"quote", REG_SZ, ""Hello, World!"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); - RegCloseKey(subkey); + close_key(subkey);
add_key(hkey, "Subkey2a\Subkey2b", &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); - RegCloseKey(subkey); + close_key(subkey);
add_key(hkey, "Subkey3a", &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\ to escape a backslash", 29); - RegCloseKey(subkey); + close_key(subkey);
add_key(hkey, "Subkey3a\Subkey3b\Subkey3c", &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); - RegCloseKey(subkey); + close_key(subkey);
add_key(hkey, "Subkey4", &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); - RegCloseKey(subkey); + close_key(subkey);
- RegCloseKey(hkey); + close_key(hkey);
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); @@ -4559,9 +4554,9 @@ 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); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey1", &subkey); - RegCloseKey(subkey); + close_key(subkey);
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); @@ -4575,8 +4570,7 @@ static void test_export(void) */ add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); - - RegCloseKey(hkey); + close_key(hkey);
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); @@ -4594,7 +4588,7 @@ static void test_export(void) add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0); add_value(hkey, "Wine1g", 0x100, NULL, 0); add_value(hkey, "Wine1h", 0xabcd, NULL, 0); - RegCloseKey(hkey); + close_key(hkey);
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); @@ -4612,7 +4606,7 @@ static void test_export(void) verify_reg(hkey, "Wine2a", REG_SZ, NULL, 0, 0); verify_reg(hkey, "Wine2b", REG_BINARY, NULL, 0, 0); verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0); - RegCloseKey(hkey); + close_key(hkey);
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); @@ -4631,7 +4625,7 @@ static void test_export(void) verify_reg(hkey, "Wine3b", REG_BINARY, hex, 4, 0); dword = 0x10203040; verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0); - RegCloseKey(hkey); + close_key(hkey);
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); @@ -4669,7 +4663,7 @@ static void test_export(void) verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0); verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0); verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); - RegCloseKey(hkey); + close_key(hkey);
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);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 471c6ad8d46..db02fc770e2 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -2360,7 +2360,7 @@ static void test_import(void) ""Wine69c"="Value1\0\n" ""Wine69d"="Value2\0\0\0\0\n" ""Wine69e"="Value3\0Value4\n" - ""Wine69f"="\0Value4\n\n", &r); + ""Wine69f"="\0Value5\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine69a"); verify_reg_nonexist(hkey, "Wine69b"); @@ -2369,6 +2369,22 @@ static void test_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f");
+ test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Wine70a"="\0"\n" + ""Wine70b"="\0\0"\n" + ""Wine70c"="Value1\0"\n" + ""Wine70d"="Value2\0\0\0\0"\n" + ""Wine70e"="Value3\0Value4"\n" + ""Wine70f"="\0Value5"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -3882,7 +3898,7 @@ static void test_unicode_import(void) ""Wine69c"="Value1\0\n" ""Wine69d"="Value2\0\0\0\0\n" ""Wine69e"="Value3\0Value4\n" - ""Wine69f"="\0Value4\n\n", &r); + ""Wine69f"="\0Value5\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine69a"); verify_reg_nonexist(hkey, "Wine69b"); @@ -3891,6 +3907,22 @@ static void test_unicode_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f");
+ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Wine70a"="\0"\n" + ""Wine70b"="\0\0"\n" + ""Wine70c"="Value1\0"\n" + ""Wine70d"="Value2\0\0\0\0"\n" + ""Wine70e"="Value3\0Value4"\n" + ""Wine70f"="\0Value5"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + close_key(hkey);
delete_key(HKEY_CURRENT_USER, KEY_BASE);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 90 ++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 12 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index db02fc770e2..95b3a353c6a 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -578,6 +578,19 @@ 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);
/* Test duplicate switches */ @@ -615,7 +628,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\" KEY_BASE " /v invalid4 -", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); }
static void test_delete(void) @@ -681,6 +694,24 @@ static void test_delete(void) verify_reg_nonexist(hkey, "foo"); verify_key(hkey, "subkey");
+ /* Test forward and back slashes */ + add_key(hkey, "https://winehq.org", &hsubkey); + close_key(hsubkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\foo\bar", REG_SZ, "", 1); + + run_reg_exe("reg delete HKCU\" KEY_BASE "\https://winehq.org /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "https://winehq.org"); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /v count/up /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "count/up"); + + run_reg_exe("reg delete HKCU\" KEY_BASE " /v \foo\bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "\foo\bar"); + close_key(hkey);
run_reg_exe("reg delete HKCU\" KEY_BASE " /f", &r); @@ -2385,9 +2416,20 @@ static void test_import(void) todo_wine verify_reg_nonexist(hkey, "Wine70e"); todo_wine verify_reg_nonexist(hkey, "Wine70f");
+ /* Test forward and back slashes */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""count/up"="one/two/three"\n" + ""\\foo\\bar"=""\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "\https://winehq.org%5D%5Cn%5Cn", &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); + verify_reg(hkey, "\foo\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "https://winehq.org"); + close_key(hkey);
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); }
static void test_unicode_import(void) @@ -3923,9 +3965,20 @@ static void test_unicode_import(void) todo_wine verify_reg_nonexist(hkey, "Wine70e"); todo_wine verify_reg_nonexist(hkey, "Wine70f");
+ /* Test forward and back slashes */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""count/up"="one/two/three"\n" + ""\\foo\\bar"=""\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "\https://winehq.org%5D%5Cn%5Cn", &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); + verify_reg(hkey, "\foo\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "https://winehq.org"); + close_key(hkey);
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); }
static void test_import_with_whitespace(void) @@ -4473,6 +4526,13 @@ static void test_export(void) ""Wine4g"="Value2"\r\n" ""Wine4h"="abc"\r\n\r\n";
+ const char *slashes_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\r\n" + ""count/up"="one/two/three"\r\n" + ""\\foo\\bar"=""\r\n\r\n" + "[HKEY_CURRENT_USER\" KEY_BASE "\https://winehq.org%5D%5Cr%5Cn%5Cr%5Cn"; + delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
@@ -4579,9 +4639,7 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", complex_test, 0), "compare_export() failed\n"); - - err = delete_tree(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS, "delete_tree() failed: %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE);
/* Test the export order of registry keys */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); @@ -4593,7 +4651,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", key_order_test, 0), "compare_export() failed\n"); - delete_key(hkey, "Subkey1"); delete_key(hkey, "Subkey2");
@@ -4607,7 +4664,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE);
/* Test registry export with empty hex data */ @@ -4625,7 +4681,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE);
/* Test registry export after importing alternative registry data types */ @@ -4643,7 +4698,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -4662,7 +4716,6 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE);
/* Test registry export with embedded null characters */ @@ -4700,8 +4753,21 @@ static void test_export(void) run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export with forward and back slashes */ + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(hkey, "https://winehq.org", &subkey); + RegCloseKey(subkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\foo\bar", REG_SZ, "", 1); + RegCloseKey(hkey); + + run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + ok(compare_export("file.reg", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); }
#define COPY_DEST KEY_WINE "\reg_copy"