Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 35 +++++++++++++++++++------------- programs/reg/tests/copy.c | 32 ++++++++++++++--------------- programs/reg/tests/export.c | 14 ++++++------- programs/reg/tests/import.c | 38 +++++++++++++++++------------------ programs/reg/tests/reg_test.h | 4 ++-- 5 files changed, 65 insertions(+), 58 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index 7fad8333ed5..d2548c7d170 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -138,15 +138,22 @@ void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path RegCloseKey(new_key); }
-void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *path) +void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam) { - if (path && *path) - { - LONG err; + LONG err;
- err = RegDeleteKeyA(hkey, path); + if (!path) return; + + if (!sam) + { + err = RegDeleteKeyA(root, path); lok(err == ERROR_SUCCESS, "RegDeleteKeyA failed: got error %d\n", err); } + else + { + err = RegDeleteKeyExA(root, path, sam, 0); + lok(err == ERROR_SUCCESS, "RegDeleteKeyExA failed: got error %d\n", err); + } }
LONG delete_tree(const HKEY key, const char *subkey) @@ -345,7 +352,7 @@ static void test_add(void) verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* 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); @@ -357,7 +364,7 @@ static void test_add(void) verify_reg_nonexist(hkey, NULL);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Adding a registry key via WinAPI doesn't initialize the Default value... */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); @@ -423,7 +430,7 @@ static void test_reg_none(void) verify_reg(hkey, "none1", REG_NONE, "\0", 2, 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_reg_sz(void) @@ -501,7 +508,7 @@ static void test_reg_sz(void) verify_reg(hkey, "\foo\bar", REG_SZ, "", 1, 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_reg_expand_sz(void) @@ -542,7 +549,7 @@ static void test_reg_expand_sz(void) verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_reg_binary(void) @@ -606,7 +613,7 @@ static void test_reg_binary(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_reg_dword(void) @@ -709,7 +716,7 @@ static void test_reg_dword(void) verify_reg(hkey, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN, &dword, sizeof(dword), 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
/* REG_DWORD_BIG_ENDIAN is broken in every version of Windows. It behaves @@ -742,7 +749,7 @@ static void test_reg_dword_big_endian(void) verify_reg(hkey, "Test4", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_reg_multi_sz(void) @@ -841,7 +848,7 @@ static void test_reg_multi_sz(void) verify_reg(hkey, "multi21", REG_MULTI_SZ, "two\0\0strings\0", 16, 0);
close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
START_TEST(add) diff --git a/programs/reg/tests/copy.c b/programs/reg/tests/copy.c index 763135c2a0f..dafd0e90a3a 100644 --- a/programs/reg/tests/copy.c +++ b/programs/reg/tests/copy.c @@ -143,7 +143,7 @@ static void test_copy_empty_key(void) 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");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC "\ HKCU\" KEY_BASE " /f", &r); @@ -154,7 +154,7 @@ static void test_copy_empty_key(void) 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");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE "\ /f", &r); @@ -165,7 +165,7 @@ static void test_copy_empty_key(void) 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");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC "\ HKCU\" KEY_BASE "\ /f", &r); @@ -213,7 +213,7 @@ static void test_copy_simple_data(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC "\ HKCU\" KEY_BASE " /f", &r); @@ -224,7 +224,7 @@ static void test_copy_simple_data(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE "\ /f", &r); @@ -235,7 +235,7 @@ static void test_copy_simple_data(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n");
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg copy HKCU\" COPY_SRC "\ HKCU\" KEY_BASE "\ /f", &r); @@ -406,8 +406,8 @@ static void test_copy_hex_data(void) 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, COPY_SRC); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Try copying after importing alternative registry data types */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -425,8 +425,8 @@ static void test_copy_hex_data(void) 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, COPY_SRC); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Try copying more complex hex data */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -531,8 +531,8 @@ static void test_copy_escaped_null_values(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); ok(compare_export("file.reg", escaped_null_test, 0), "compare_export() failed\n");
- delete_key(HKEY_CURRENT_USER, COPY_SRC); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_copy_key_class(void) @@ -573,8 +573,8 @@ static void test_copy_key_class(void)
RegCloseKey(hkey);
- delete_key(HKEY_CURRENT_USER, COPY_SRC); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_copy_overwrite(void) @@ -611,8 +611,8 @@ static void test_copy_overwrite(void) verify_reg(hkey, NULL, REG_SZ, "Constant value", 15, 0); close_key(hkey);
- delete_key(HKEY_CURRENT_USER, COPY_SRC); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
START_TEST(copy) diff --git a/programs/reg/tests/export.c b/programs/reg/tests/export.c index 1348b8eebdb..b45660a0e6e 100644 --- a/programs/reg/tests/export.c +++ b/programs/reg/tests/export.c @@ -297,8 +297,8 @@ 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"); + delete_key(hkey, "Subkey1", 0); + delete_key(hkey, "Subkey2", 0);
/* Test the export order of registry values. Windows exports registry values * in order of creation; Wine uses alphabetical order. @@ -310,7 +310,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", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export with empty hex data */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); @@ -327,7 +327,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", empty_hex_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export after importing alternative registry data types */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -345,7 +345,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", empty_hex_test2, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -364,7 +364,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", hex_types_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export with embedded null characters */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -401,7 +401,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", embedded_null_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export with forward and back slashes */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); diff --git a/programs/reg/tests/import.c b/programs/reg/tests/import.c index 06f9cb05f6c..5d673ede8c1 100644 --- a/programs/reg/tests/import.c +++ b/programs/reg/tests/import.c @@ -860,7 +860,7 @@ static void test_import(void) open_key(hkey, "Subkey"1", 0, &subkey); verify_reg(subkey, "Wine\31", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1"); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey/2]\n" @@ -869,7 +869,7 @@ static void test_import(void) open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/"4;'5", REG_SZ, "Random value name", 18, 0); close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2"); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2", 0);
/* Test key creation */ test_import_str("REGEDIT4\n\n" @@ -896,13 +896,13 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_key(hkey, "Subkey1c "); - delete_key(hkey, "Subkey1c "); + delete_key(hkey, "Subkey1c ", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1d\t]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_key(hkey, "Subkey1d\t"); - delete_key(hkey, "Subkey1d\t"); + delete_key(hkey, "Subkey1d\t", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1e\]\n" @@ -913,7 +913,7 @@ static void test_import(void) open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1e"); + delete_key(hkey, "Subkey1e", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1f\\]\n" @@ -925,7 +925,7 @@ static void test_import(void) open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1f\\"); + delete_key(hkey, "Subkey1f\\", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1g\\\\]\n" @@ -938,7 +938,7 @@ static void test_import(void) open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1g\\"); + delete_key(hkey, "Subkey1g\\", 0);
/* Test key deletion. We start by creating some registry keys. */ test_import_str("REGEDIT4\n\n" @@ -1183,7 +1183,7 @@ static void test_import(void) verify_reg_nonexist(hkey, "Wine54b"); verify_key(hkey, "Subkey2");
- delete_key(hkey, "Subkey2"); + delete_key(hkey, "Subkey2", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -2399,7 +2399,7 @@ static void test_unicode_import(void) open_key(hkey, "Subkey"1", 0, &subkey); verify_reg(subkey, "Wine\31", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1"); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey"1", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey/2]\n" @@ -2408,7 +2408,7 @@ static void test_unicode_import(void) open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/"4;'5", REG_SZ, "Random value name", 18, 0); close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2"); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\Subkey/2", 0);
/* Test key creation */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2435,13 +2435,13 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_key(hkey, "Subkey1c "); - delete_key(hkey, "Subkey1c "); + delete_key(hkey, "Subkey1c ", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1d\t]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_key(hkey, "Subkey1d\t"); - delete_key(hkey, "Subkey1d\t"); + delete_key(hkey, "Subkey1d\t", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1e\]\n" @@ -2452,7 +2452,7 @@ static void test_unicode_import(void) open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1e"); + delete_key(hkey, "Subkey1e", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1f\\]\n" @@ -2464,7 +2464,7 @@ static void test_unicode_import(void) open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1f\\"); + delete_key(hkey, "Subkey1f\\", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1g\\\\]\n" @@ -2477,7 +2477,7 @@ static void test_unicode_import(void) open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); - delete_key(hkey, "Subkey1g\\"); + delete_key(hkey, "Subkey1g\\", 0);
/* Test key deletion. We start by creating some registry keys. */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2725,7 +2725,7 @@ static void test_unicode_import(void) verify_reg_nonexist(hkey, "Wine54b"); verify_key(hkey, "Subkey2");
- delete_key(hkey, "Subkey2"); + delete_key(hkey, "Subkey2", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -3315,7 +3315,7 @@ static void test_import_with_whitespace(void)
close_key(hkey);
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_unicode_import_with_whitespace(void) @@ -3461,7 +3461,7 @@ static void test_unicode_import_with_whitespace(void)
close_key(hkey);
- delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); }
static void test_import_win31(void) @@ -3585,7 +3585,7 @@ static void test_import_win31(void)
close_key(hkey);
- delete_key(HKEY_CLASSES_ROOT, KEY_BASE); + delete_key(HKEY_CLASSES_ROOT, KEY_BASE, 0); }
START_TEST(import) diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index 28e2d8e3abe..140f01580e8 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -62,8 +62,8 @@ void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const #define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s) void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey);
-#define delete_key(k,p) delete_key_(__FILE__,__LINE__,k,p) -void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *path); +#define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s) +void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
LONG delete_tree(const HKEY key, const char *subkey);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 5 ++--- programs/reg/tests/reg_test.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index d2548c7d170..c8091fb7305 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -81,12 +81,11 @@ void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char (value && *value) ? value : "(Default)", err); }
-void open_key_(const char *file, unsigned line, const HKEY base, const char *path, - const DWORD sam, HKEY *hkey) +void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey) { LONG err;
- err = RegOpenKeyExA(base, path, 0, KEY_READ|sam, hkey); + err = RegOpenKeyExA(root, path, 0, KEY_READ|sam, hkey); lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err); }
diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index 140f01580e8..ef76e4c92b0 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -46,9 +46,8 @@ void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value, #define verify_reg_nonexist(k,v) verify_reg_nonexist_(__FILE__,__LINE__,k,v) void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value);
-#define open_key(b,p,s,k) open_key_(__FILE__,__LINE__,b,p,s,k) -void open_key_(const char *file, unsigned line, const HKEY base, const char *path, - const DWORD sam, HKEY *hkey); +#define open_key(r,p,s,k) open_key_(__FILE__,__LINE__,r,p,s,k) +void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey);
#define close_key(k) close_key_(__FILE__,__LINE__,k) void close_key_(const char *file, unsigned line, HKEY hkey);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 18 +++---- programs/reg/tests/copy.c | 42 ++++++++--------- programs/reg/tests/delete.c | 2 +- programs/reg/tests/import.c | 88 +++++++++++++++++------------------ programs/reg/tests/reg_test.h | 4 +- 5 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index c8091fb7305..112ae5b875d 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -97,12 +97,12 @@ void close_key_(const char *file, unsigned line, HKEY hkey) lok(err == ERROR_SUCCESS, "RegCloseKey failed: got error %d\n", err); }
-void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey) +void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam) { HKEY hkey; LONG err;
- err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey); + err = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey); lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err);
if (hkey) @@ -302,15 +302,15 @@ static void test_key_formats(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"); + verify_key(hkey, "keytest3", 0);
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"); + verify_key(hkey, "keytest4", 0);
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"); + verify_key(hkey, "https://winehq.org", 0);
close_key(hkey); delete_tree(HKEY_CURRENT_USER, KEY_BASE); @@ -384,8 +384,8 @@ static void test_add(void) 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_key(HKEY_CURRENT_USER, KEY_BASE, 0); + verify_key(hkey, "Subkey", 0); verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0); verify_reg(hkey, NULL, REG_SZ, "", 1, 0); @@ -393,8 +393,8 @@ static void test_add(void) run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_NONE /d Test /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_key(HKEY_CURRENT_USER, KEY_BASE, 0); + verify_key(hkey, "Subkey", 0); verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0); verify_reg(hkey, NULL, REG_NONE, "T\0e\0s\0t\0\0", 10, 0); diff --git a/programs/reg/tests/copy.c b/programs/reg/tests/copy.c index dafd0e90a3a..f25d520bdf6 100644 --- a/programs/reg/tests/copy.c +++ b/programs/reg/tests/copy.c @@ -137,7 +137,7 @@ static void test_copy_empty_key(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -148,7 +148,7 @@ static void test_copy_empty_key(void)
run_reg_exe("reg copy HKCU\" COPY_SRC "\ 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -159,7 +159,7 @@ static void test_copy_empty_key(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -170,7 +170,7 @@ static void test_copy_empty_key(void)
run_reg_exe("reg copy HKCU\" COPY_SRC "\ 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -179,7 +179,7 @@ static void test_copy_empty_key(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -207,7 +207,7 @@ static void test_copy_simple_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -218,7 +218,7 @@ static void test_copy_simple_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC "\ 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -229,7 +229,7 @@ static void test_copy_simple_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -240,7 +240,7 @@ static void test_copy_simple_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC "\ 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -249,7 +249,7 @@ static void test_copy_simple_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -309,7 +309,7 @@ static void test_copy_complex_data(void) /* Copy values only */ run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
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); @@ -318,7 +318,7 @@ static void test_copy_complex_data(void) /* Copy subkeys and values */ run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /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_CURRENT_USER, KEY_BASE, 0);
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); @@ -343,7 +343,7 @@ static void test_copy_key_order(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -368,7 +368,7 @@ static void test_copy_value_order(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -400,7 +400,7 @@ static void test_copy_hex_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -419,7 +419,7 @@ static void test_copy_hex_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -438,7 +438,7 @@ static void test_copy_hex_data(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
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); @@ -470,7 +470,7 @@ static void test_copy_embedded_null_values(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
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); @@ -496,7 +496,7 @@ static void test_copy_slashes(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -525,7 +525,7 @@ static void test_copy_escaped_null_values(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export HKCU\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -559,7 +559,7 @@ static void test_copy_key_class(void)
run_reg_exe("reg copy HKCU\" COPY_SRC " 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_CURRENT_USER, KEY_BASE, 0);
open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); verify_reg(hkey, "String", REG_SZ, "Data", 5, 0); diff --git a/programs/reg/tests/delete.c b/programs/reg/tests/delete.c index 575c393d2b3..ef106e67169 100644 --- a/programs/reg/tests/delete.c +++ b/programs/reg/tests/delete.c @@ -88,7 +88,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\" KEY_BASE " /va /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "foo"); - verify_key(hkey, "subkey"); + verify_key(hkey, "subkey", 0);
/* Test forward and back slashes */ add_key(hkey, "https://winehq.org", NULL); diff --git a/programs/reg/tests/import.c b/programs/reg/tests/import.c index 5d673ede8c1..54a59c1edb2 100644 --- a/programs/reg/tests/import.c +++ b/programs/reg/tests/import.c @@ -895,21 +895,21 @@ static void test_import(void) test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1c "); + verify_key(hkey, "Subkey1c ", 0); delete_key(hkey, "Subkey1c ", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1d\t]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1d\t"); + verify_key(hkey, "Subkey1d\t", 0); delete_key(hkey, "Subkey1d\t", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1e\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1e\"); - verify_key(hkey, "Subkey1e"); + verify_key(hkey, "Subkey1e\", 0); + verify_key(hkey, "Subkey1e", 0); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -919,9 +919,9 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1f\\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1f\\"); - verify_key(hkey, "Subkey1f\"); - verify_key(hkey, "Subkey1f"); + verify_key(hkey, "Subkey1f\\", 0); + verify_key(hkey, "Subkey1f\", 0); + verify_key(hkey, "Subkey1f", 0); open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -931,10 +931,10 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1g\\\\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1g\\\\"); - verify_key(hkey, "Subkey1g\\"); - verify_key(hkey, "Subkey1g\"); - verify_key(hkey, "Subkey1g"); + verify_key(hkey, "Subkey1g\\\\", 0); + verify_key(hkey, "Subkey1g\\", 0); + verify_key(hkey, "Subkey1g\", 0); + verify_key(hkey, "Subkey1g", 0); open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -945,28 +945,28 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2a", 0); + verify_key(hkey, "Subkey2b", 0);
test_import_str("REGEDIT4\n\n" "[ -HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2a", 0);
test_import_str("REGEDIT4\n\n" "[\t-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2b", 0);
test_import_str("REGEDIT4\n\n" "[- HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2a", 0);
test_import_str("REGEDIT4\n\n" "[-\tHKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2b", 0);
test_import_str("REGEDIT4\n\n" "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" @@ -980,8 +980,8 @@ static void test_import(void) "[hkey_CURRENT_user\" KEY_BASE "\Subkey3a]\n\n" "[HkEy_CuRrEnT_uSeR\" KEY_BASE "\SuBkEy3b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey3a"); - verify_key(hkey, "Subkey3b"); + verify_key(hkey, "Subkey3a", 0); + verify_key(hkey, "Subkey3b", 0);
test_import_str("REGEDIT4\n\n" "[-HKEY_current_USER\" KEY_BASE "\sUBKEY3A]\n\n" @@ -994,7 +994,7 @@ static void test_import(void) test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey4a]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey4a"); + verify_key(hkey, "Subkey4a", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n" @@ -1181,7 +1181,7 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54b"); - verify_key(hkey, "Subkey2"); + verify_key(hkey, "Subkey2", 0);
delete_key(hkey, "Subkey2", 0);
@@ -1616,7 +1616,7 @@ static void test_import(void) 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"); + verify_key(hkey, "https://winehq.org", 0);
close_key(hkey);
@@ -2434,21 +2434,21 @@ static void test_unicode_import(void) test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1c "); + verify_key(hkey, "Subkey1c ", 0); delete_key(hkey, "Subkey1c ", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1d\t]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1d\t"); + verify_key(hkey, "Subkey1d\t", 0); delete_key(hkey, "Subkey1d\t", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1e\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1e\"); - verify_key(hkey, "Subkey1e"); + verify_key(hkey, "Subkey1e\", 0); + verify_key(hkey, "Subkey1e", 0); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -2458,9 +2458,9 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1f\\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1f\\"); - verify_key(hkey, "Subkey1f\"); - verify_key(hkey, "Subkey1f"); + verify_key(hkey, "Subkey1f\\", 0); + verify_key(hkey, "Subkey1f\", 0); + verify_key(hkey, "Subkey1f", 0); open_key(hkey, "Subkey1f\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -2470,10 +2470,10 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1g\\\\]\n" ""Wine"="Test value"\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1g\\\\"); - verify_key(hkey, "Subkey1g\\"); - verify_key(hkey, "Subkey1g\"); - verify_key(hkey, "Subkey1g"); + verify_key(hkey, "Subkey1g\\\\", 0); + verify_key(hkey, "Subkey1g\\", 0); + verify_key(hkey, "Subkey1g\", 0); + verify_key(hkey, "Subkey1g", 0); open_key(hkey, "Subkey1g\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); close_key(subkey); @@ -2484,28 +2484,28 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2a", 0); + verify_key(hkey, "Subkey2b", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[ -HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2a", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[\t-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2b", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[- HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2a", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[-\tHKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); + verify_key(hkey, "Subkey2b", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" @@ -2519,8 +2519,8 @@ static void test_unicode_import(void) "[hkey_CURRENT_user\" KEY_BASE "\Subkey3a]\n\n" "[HkEy_CuRrEnT_uSeR\" KEY_BASE "\SuBkEy3b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey3a"); - verify_key(hkey, "Subkey3b"); + verify_key(hkey, "Subkey3a", 0); + verify_key(hkey, "Subkey3b", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[-HKEY_current_USER\" KEY_BASE "\sUBKEY3A]\n\n" @@ -2533,7 +2533,7 @@ static void test_unicode_import(void) test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey4a]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey4a"); + verify_key(hkey, "Subkey4a", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n" @@ -2723,7 +2723,7 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54b"); - verify_key(hkey, "Subkey2"); + verify_key(hkey, "Subkey2", 0);
delete_key(hkey, "Subkey2", 0);
@@ -3165,7 +3165,7 @@ static void test_unicode_import(void) 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"); + verify_key(hkey, "https://winehq.org", 0);
close_key(hkey);
diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index ef76e4c92b0..7cf3f86014d 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -52,8 +52,8 @@ void open_key_(const char *file, unsigned line, HKEY root, const char *path, REG #define close_key(k) close_key_(__FILE__,__LINE__,k) void close_key_(const char *file, unsigned line, HKEY hkey);
-#define verify_key(k,s) verify_key_(__FILE__,__LINE__,k,s) -void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey); +#define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s) +void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
#define verify_key_nonexist(k,s) verify_key_nonexist_(__FILE__,__LINE__,k,s) void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 13 ++++---- programs/reg/tests/copy.c | 36 ++++++++++----------- programs/reg/tests/delete.c | 6 ++-- programs/reg/tests/export.c | 2 +- programs/reg/tests/import.c | 60 +++++++++++++++++------------------ programs/reg/tests/query.c | 2 +- programs/reg/tests/reg_test.h | 4 +-- 7 files changed, 61 insertions(+), 62 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index 112ae5b875d..c2548e45f37 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -109,14 +109,13 @@ void verify_key_(const char *file, unsigned line, HKEY root, const char *path, R RegCloseKey(hkey); }
-void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey) +void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam) { HKEY hkey; LONG err;
- err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey); - lok(err == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n", - subkey, err); + err = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey); + lok(err == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n", path, err);
if (hkey) RegCloseKey(hkey); @@ -221,7 +220,7 @@ static void test_command_syntax(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg add", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -287,11 +286,11 @@ static void test_key_formats(void)
run_reg_exe("reg add \HKCU\" KEY_BASE "\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - verify_key_nonexist(hkey, "keytest0"); + verify_key_nonexist(hkey, "keytest0", 0);
run_reg_exe("reg add \\HKCU\" KEY_BASE "\keytest1 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - verify_key_nonexist(hkey, "keytest1"); + verify_key_nonexist(hkey, "keytest1", 0);
run_reg_exe("reg add HKCU\" KEY_BASE "\keytest2\\ /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), diff --git a/programs/reg/tests/copy.c b/programs/reg/tests/copy.c index f25d520bdf6..5573dd58acc 100644 --- a/programs/reg/tests/copy.c +++ b/programs/reg/tests/copy.c @@ -127,10 +127,10 @@ static void test_copy_empty_key(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, NULL);
@@ -192,10 +192,10 @@ static void test_copy_simple_data(void) DWORD r, dword;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey);
@@ -262,10 +262,10 @@ static void test_copy_complex_data(void) DWORD r, dword;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey);
@@ -331,10 +331,10 @@ static void test_copy_key_order(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_key(hkey, "Subkey2", NULL); @@ -356,10 +356,10 @@ static void test_copy_value_order(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); @@ -381,10 +381,10 @@ static void test_copy_hex_data(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Try copying empty hex values */ add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); @@ -450,10 +450,10 @@ static void test_copy_embedded_null_values(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" COPY_SRC "]\n" @@ -483,10 +483,10 @@ static void test_copy_slashes(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_key(hkey, "https://winehq.org", NULL); @@ -509,10 +509,10 @@ static void test_copy_escaped_null_values(void) DWORD r;
delete_tree(HKEY_CURRENT_USER, COPY_SRC); - verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); + verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC, 0);
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\0", 3); diff --git a/programs/reg/tests/delete.c b/programs/reg/tests/delete.c index ef106e67169..e84d78808ca 100644 --- a/programs/reg/tests/delete.c +++ b/programs/reg/tests/delete.c @@ -26,7 +26,7 @@ static void test_delete(void) const DWORD deadbeef = 0xdeadbeef;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg delete", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -97,7 +97,7 @@ static void test_delete(void)
run_reg_exe("reg delete HKCU\" KEY_BASE "\https://winehq.org /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "https://winehq.org"); + verify_key_nonexist(hkey, "https://winehq.org", 0);
run_reg_exe("reg delete HKCU\" KEY_BASE " /v count/up /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -127,7 +127,7 @@ static void test_delete(void)
run_reg_exe("reg delete HKCU\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg delete HKCU\" KEY_BASE " /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/programs/reg/tests/export.c b/programs/reg/tests/export.c index b45660a0e6e..24a5dbd2405 100644 --- a/programs/reg/tests/export.c +++ b/programs/reg/tests/export.c @@ -177,7 +177,7 @@ static void test_export(void) BYTE hex[4], buffer[8];
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg export", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/programs/reg/tests/import.c b/programs/reg/tests/import.c index 54a59c1edb2..c8a6b079a6a 100644 --- a/programs/reg/tests/import.c +++ b/programs/reg/tests/import.c @@ -79,7 +79,7 @@ static void test_import(void) BYTE hex[8];
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg import", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -695,13 +695,13 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\\n" "Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\n" "\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); + verify_key_nonexist(hkey, "Subkey2", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -875,22 +875,22 @@ static void test_import(void) test_import_str("REGEDIT4\n\n" "HKEY_CURRENT_USER\" KEY_BASE "\No_Opening_Bracket]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); + verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\No_Closing_Bracket\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); + verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
test_import_str("REGEDIT4\n\n" "[ HKEY_CURRENT_USER\" KEY_BASE "\Subkey1a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); + verify_key_nonexist(hkey, "Subkey1a", 0);
test_import_str("REGEDIT4\n\n" "[\tHKEY_CURRENT_USER\" KEY_BASE "\Subkey1b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); + verify_key_nonexist(hkey, "Subkey1b", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); @@ -972,8 +972,8 @@ static void test_import(void) "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); + verify_key_nonexist(hkey, "Subkey2a", 0); + verify_key_nonexist(hkey, "Subkey2b", 0);
/* Test case sensitivity when creating and deleting registry keys. */ test_import_str("REGEDIT4\n\n" @@ -987,8 +987,8 @@ static void test_import(void) "[-HKEY_current_USER\" KEY_BASE "\sUBKEY3A]\n\n" "[-hKeY_cUrReNt_UsEr\" KEY_BASE "\sUbKeY3B]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); + verify_key_nonexist(hkey, "Subkey3a", 0); + verify_key_nonexist(hkey, "Subkey3b", 0);
/* Test mixed key creation and deletion. We start by creating a subkey. */ test_import_str("REGEDIT4\n\n" @@ -1001,7 +1001,7 @@ static void test_import(void) "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey4a]\n" ""Wine46a"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); + verify_key_nonexist(hkey, "Subkey4a", 0); verify_reg_nonexist(hkey, "Wine46a");
test_import_str("REGEDIT4\n\n" @@ -1009,7 +1009,7 @@ static void test_import(void) "[HKEY_CURRENT_USERS\" KEY_BASE "\Subkey4b]\n" ""Wine46b"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); + verify_key_nonexist(hkey, "Subkey4b", 0); verify_reg_nonexist(hkey, "Wine46b");
/* Test value deletion. We start by creating some registry values. */ @@ -1173,7 +1173,7 @@ static void test_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0);
test_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -1632,7 +1632,7 @@ static void test_unicode_import(void) BYTE hex[8];
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
test_import_wstr("REGEDIT\n", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, @@ -2234,13 +2234,13 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\\n" "Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\n" "\Subkey2]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); + verify_key_nonexist(hkey, "Subkey2", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -2414,22 +2414,22 @@ static void test_unicode_import(void) test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "HKEY_CURRENT_USER\" KEY_BASE "\No_Opening_Bracket]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); + verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\No_Closing_Bracket\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); + verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[ HKEY_CURRENT_USER\" KEY_BASE "\Subkey1a]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); + verify_key_nonexist(hkey, "Subkey1a", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[\tHKEY_CURRENT_USER\" KEY_BASE "\Subkey1b]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); + verify_key_nonexist(hkey, "Subkey1b", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1c ]\n", &r); @@ -2511,8 +2511,8 @@ static void test_unicode_import(void) "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2a]\n\n" "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey2b]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); + verify_key_nonexist(hkey, "Subkey2a", 0); + verify_key_nonexist(hkey, "Subkey2b", 0);
/* Test case sensitivity when creating and deleting registry keys. */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2526,8 +2526,8 @@ static void test_unicode_import(void) "[-HKEY_current_USER\" KEY_BASE "\sUBKEY3A]\n\n" "[-hKeY_cUrReNt_UsEr\" KEY_BASE "\sUbKeY3B]\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); + verify_key_nonexist(hkey, "Subkey3a", 0); + verify_key_nonexist(hkey, "Subkey3b", 0);
/* Test mixed key creation and deletion. We start by creating a subkey. */ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2540,7 +2540,7 @@ static void test_unicode_import(void) "[-HKEY_CURRENT_USER\" KEY_BASE "\Subkey4a]\n" ""Wine46a"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); + verify_key_nonexist(hkey, "Subkey4a", 0); verify_reg_nonexist(hkey, "Wine46a");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -2548,7 +2548,7 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USERS\" KEY_BASE "\Subkey4b]\n" ""Wine46b"=dword:12345678\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); + verify_key_nonexist(hkey, "Subkey4b", 0); verify_reg_nonexist(hkey, "Wine46b");
/* Test value deletion. We start by creating some registry values. */ @@ -2715,7 +2715,7 @@ static void test_unicode_import(void) "[HKEY_CURRENT_USER\" KEY_BASE "\Subkey1]\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); + verify_key_nonexist(hkey, "Subkey1", 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" @@ -3178,7 +3178,7 @@ static void test_import_with_whitespace(void) DWORD r, dword;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
test_import_str(" REGEDIT4\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n", &r); @@ -3324,7 +3324,7 @@ static void test_unicode_import_with_whitespace(void) DWORD r, dword;
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n\n", &r); diff --git a/programs/reg/tests/query.c b/programs/reg/tests/query.c index 76186794f5e..4754c2bf05f 100644 --- a/programs/reg/tests/query.c +++ b/programs/reg/tests/query.c @@ -165,7 +165,7 @@ static void test_query(void) BYTE buf[512];
delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
run_reg_exe("reg query", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index 7cf3f86014d..81badf928ba 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -55,8 +55,8 @@ void close_key_(const char *file, unsigned line, HKEY hkey); #define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s) void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
-#define verify_key_nonexist(k,s) verify_key_nonexist_(__FILE__,__LINE__,k,s) -void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey); +#define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s) +void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
#define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s) void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 2 +- programs/reg/tests/reg_test.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index c2548e45f37..48e33f6564a 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -205,7 +205,7 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, lok(err == ERROR_SUCCESS, "RegSetValueExA failed: got error %d\n", err); }
-void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name) +void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name) { LONG err;
diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index 81badf928ba..1f57a3e9596 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -71,7 +71,7 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size);
#define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n) -void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name); +void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name);
/* export.c */ #define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 30 +++++++++++++-------------- programs/reg/tests/copy.c | 38 +++++++++++++++++------------------ programs/reg/tests/delete.c | 6 +++--- programs/reg/tests/export.c | 28 +++++++++++++------------- programs/reg/tests/query.c | 14 ++++++------- programs/reg/tests/reg_test.h | 4 ++-- 6 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index 48e33f6564a..384eb9012c7 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -121,17 +121,17 @@ void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char RegCloseKey(hkey); }
-void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey) +void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey) { LONG err; HKEY new_key;
- err = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, NULL, &new_key, NULL); + err = RegCreateKeyExA(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE|sam, NULL, &new_key, NULL); lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: got error %d\n", err);
- if (subkey) - *subkey = new_key; + if (hkey) + *hkey = new_key; else RegCloseKey(new_key); } @@ -282,7 +282,7 @@ static void test_key_formats(void) DWORD r; LONG err;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add \HKCU\" KEY_BASE "\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); @@ -365,7 +365,7 @@ static void test_add(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Adding a registry key via WinAPI doesn't initialize the Default value... */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); verify_reg_nonexist(hkey, NULL);
/* ... but we can add it without passing [/f] to reg.exe */ @@ -375,7 +375,7 @@ static void test_add(void) delete_value(hkey, NULL);
/* Test whether overwriting a registry key modifies existing keys and values */ - add_key(hkey, "Subkey", NULL); + add_key(hkey, "Subkey", 0, NULL); add_value(hkey, "Test1", REG_SZ, "Value1", 7); dword = 0x123; add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword)); @@ -407,7 +407,7 @@ static void test_reg_none(void) HKEY hkey; DWORD r;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_NONE /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -436,7 +436,7 @@ static void test_reg_sz(void) HKEY hkey; DWORD r;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -514,7 +514,7 @@ static void test_reg_expand_sz(void) HKEY hkey; DWORD r;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_EXPAND_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -557,7 +557,7 @@ static void test_reg_binary(void) char buffer[22]; LONG err;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_BINARY /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); @@ -620,7 +620,7 @@ static void test_reg_dword(void) DWORD r, dword, type, size; LONG err;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), @@ -734,7 +734,7 @@ static void test_reg_dword_big_endian(void) run_reg_exe("reg add HKCU\" KEY_BASE " /v Test2 /t REG_DWORD_BIG_ENDIAN /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r);
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /v Test3 /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -755,7 +755,7 @@ static void test_reg_multi_sz(void) HKEY hkey; DWORD r;
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_MULTI_SZ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); diff --git a/programs/reg/tests/copy.c b/programs/reg/tests/copy.c index 5573dd58acc..2b461c17f5e 100644 --- a/programs/reg/tests/copy.c +++ b/programs/reg/tests/copy.c @@ -132,7 +132,7 @@ static void test_copy_empty_key(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, NULL);
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /f", &r); @@ -197,7 +197,7 @@ static void test_copy_simple_data(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey);
dword = 0x100; add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); @@ -267,38 +267,38 @@ static void test_copy_complex_data(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey);
dword = 0x100; add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); add_value(hkey, "String", REG_SZ, "Your text here...", 18);
- add_key(hkey, "Subkey1", &subkey); + add_key(hkey, "Subkey1", 0, &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); close_key(subkey);
- add_key(hkey, "Subkey2a", &subkey); + add_key(hkey, "Subkey2a", 0, &subkey); add_value(subkey, "double"quote", REG_SZ, ""Hello, World!"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); close_key(subkey);
- add_key(hkey, "Subkey2a\Subkey2b", &subkey); + add_key(hkey, "Subkey2a\Subkey2b", 0, &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(subkey);
- add_key(hkey, "Subkey3a", &subkey); + add_key(hkey, "Subkey3a", 0, &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\ to escape a backslash", 29); close_key(subkey);
- add_key(hkey, "Subkey3a\Subkey3b\Subkey3c", &subkey); + add_key(hkey, "Subkey3a\Subkey3b\Subkey3c", 0, &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); close_key(subkey);
- add_key(hkey, "Subkey4", &subkey); + add_key(hkey, "Subkey4", 0, &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); @@ -336,9 +336,9 @@ static void test_copy_key_order(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); - add_key(hkey, "Subkey2", NULL); - add_key(hkey, "Subkey1", NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); + add_key(hkey, "Subkey2", 0, NULL); + add_key(hkey, "Subkey1", 0, NULL); close_key(hkey);
run_reg_exe("reg copy HKCU\" COPY_SRC " HKCU\" KEY_BASE " /s /f", &r); @@ -361,7 +361,7 @@ static void test_copy_value_order(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); close_key(hkey); @@ -387,7 +387,7 @@ static void test_copy_hex_data(void) verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Try copying empty hex values */ - add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine1a", REG_NONE, NULL, 0); add_value(hkey, "Wine1b", REG_SZ, NULL, 0); add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); @@ -488,8 +488,8 @@ static void test_copy_slashes(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); - add_key(hkey, "https://winehq.org", NULL); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); + add_key(hkey, "https://winehq.org", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\foo\bar", REG_SZ, "", 1); close_key(hkey); @@ -514,7 +514,7 @@ static void test_copy_escaped_null_values(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE, 0);
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\0", 3); add_value(hkey, "Wine5b", REG_SZ, "\0\0", 5); add_value(hkey, "Wine5c", REG_SZ, "Value1\0", 9); @@ -582,7 +582,7 @@ static void test_copy_overwrite(void) HKEY hkey; DWORD r, dword;
- add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_key(HKEY_CURRENT_USER, COPY_SRC, 0, &hkey); add_value(hkey, "Wine1", REG_SZ, "def", 4); dword = 0x5; add_value(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword)); @@ -590,7 +590,7 @@ static void test_copy_overwrite(void) add_value(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(hkey);
- add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine1", REG_SZ, "abc", 4); verify_reg_nonexist(hkey, "Wine2"); add_value(hkey, "Wine3", REG_EXPAND_SZ, "%HOME%\%PATH%", 14); diff --git a/programs/reg/tests/delete.c b/programs/reg/tests/delete.c index e84d78808ca..22c5e867461 100644 --- a/programs/reg/tests/delete.c +++ b/programs/reg/tests/delete.c @@ -70,12 +70,12 @@ static void test_delete(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
/* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef));
- add_key(hkey, "subkey", NULL); + add_key(hkey, "subkey", 0, NULL);
run_reg_exe("reg delete HKCU\" KEY_BASE " /v bar /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -91,7 +91,7 @@ static void test_delete(void) verify_key(hkey, "subkey", 0);
/* Test forward and back slashes */ - add_key(hkey, "https://winehq.org", NULL); + add_key(hkey, "https://winehq.org", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\foo\bar", REG_SZ, "", 1);
diff --git a/programs/reg/tests/export.c b/programs/reg/tests/export.c index 24a5dbd2405..df44baddb30 100644 --- a/programs/reg/tests/export.c +++ b/programs/reg/tests/export.c @@ -219,7 +219,7 @@ static void test_export(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
/* Test registry export with an empty key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -251,32 +251,32 @@ static void test_export(void) ok(compare_export("foo", simple_data_test, 0), "compare_export() failed\n");
/* Test registry export with a complex data structure */ - add_key(hkey, "Subkey1", &subkey); + add_key(hkey, "Subkey1", 0, &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); close_key(subkey);
- add_key(hkey, "Subkey2a", &subkey); + add_key(hkey, "Subkey2a", 0, &subkey); add_value(subkey, "double"quote", REG_SZ, ""Hello, World!"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); close_key(subkey);
- add_key(hkey, "Subkey2a\Subkey2b", &subkey); + add_key(hkey, "Subkey2a\Subkey2b", 0, &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); close_key(subkey);
- add_key(hkey, "Subkey3a", &subkey); + add_key(hkey, "Subkey3a", 0, &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\ to escape a backslash", 29); close_key(subkey);
- add_key(hkey, "Subkey3a\Subkey3b\Subkey3c", &subkey); + add_key(hkey, "Subkey3a\Subkey3b\Subkey3c", 0, &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); close_key(subkey);
- add_key(hkey, "Subkey4", &subkey); + add_key(hkey, "Subkey4", 0, &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); @@ -290,9 +290,9 @@ static void test_export(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE);
/* Test the export order of registry keys */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "Subkey2", NULL); - add_key(hkey, "Subkey1", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "Subkey2", 0, NULL); + add_key(hkey, "Subkey1", 0, NULL);
run_reg_exe("reg export HKEY_CURRENT_USER\" KEY_BASE " file.reg /y", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -313,7 +313,7 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export with empty hex data */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine1a", REG_NONE, NULL, 0); add_value(hkey, "Wine1b", REG_SZ, NULL, 0); add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); @@ -404,8 +404,8 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
/* Test registry export with forward and back slashes */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "https://winehq.org", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "https://winehq.org", 0, NULL); add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); add_value(hkey, "\foo\bar", REG_SZ, "", 1); close_key(hkey); @@ -416,7 +416,7 @@ static void test_export(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE);
/* Test escaped null characters */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Wine5a", REG_SZ, "\0", 3); add_value(hkey, "Wine5b", REG_SZ, "\0\0", 5); add_value(hkey, "Wine5c", REG_SZ, "Value1\0", 9); diff --git a/programs/reg/tests/query.c b/programs/reg/tests/query.c index 4754c2bf05f..3e8b134363b 100644 --- a/programs/reg/tests/query.c +++ b/programs/reg/tests/query.c @@ -184,7 +184,7 @@ static void test_query(void) ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
/* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); add_value(hkey, "Test1", REG_SZ, "Hello, World", 13); add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword));
@@ -221,7 +221,7 @@ static void test_query(void) add_value(hkey, "Wine", REG_SZ, "First instance", 15);
/* Create a test subkey */ - add_key(hkey, "subkey", &subkey); + add_key(hkey, "subkey", 0, &subkey);
read_reg_output("reg query HKCU\" KEY_BASE, buf, sizeof(buf), &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -273,11 +273,11 @@ static void test_query(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE);
/* Subkeys only */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "subkey1", NULL); - add_key(hkey, "subkey2", NULL); - add_key(hkey, "subkey3", NULL); - add_key(hkey, "subkey4", NULL); + add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + add_key(hkey, "subkey1", 0, NULL); + add_key(hkey, "subkey2", 0, NULL); + add_key(hkey, "subkey3", 0, NULL); + add_key(hkey, "subkey4", 0, NULL); close_key(hkey);
read_reg_output("reg query HKCU\" KEY_BASE, buf, sizeof(buf), &r); diff --git a/programs/reg/tests/reg_test.h b/programs/reg/tests/reg_test.h index 1f57a3e9596..db525619978 100644 --- a/programs/reg/tests/reg_test.h +++ b/programs/reg/tests/reg_test.h @@ -58,8 +58,8 @@ void verify_key_(const char *file, unsigned line, HKEY root, const char *path, R #define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s) void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
-#define add_key(k,p,s) add_key_(__FILE__,__LINE__,k,p,s) -void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey); +#define add_key(r,p,s,k) add_key_(__FILE__,__LINE__,r,p,s,k) +void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey);
#define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s) void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);