Commit fdceb5ed authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg/tests: Modify verify_key() to support opening of registry views.

parent 0eb85504
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment