[WINESYNC] reg/tests: Test whether the 'copy' command copies user-defined key classes.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 664f8b638d421540e73b4e046a9aa5e66f8cc4ff by Hugh McMaster <hugh.mcmaster@outlook.com>
This commit is contained in:
winesync 2022-01-17 18:47:14 +01:00 committed by Thomas Csovcsity
parent 20aa38c6e7
commit 07427368d3
2 changed files with 44 additions and 1 deletions

View file

@ -535,6 +535,48 @@ static void test_copy_escaped_null_values(void)
delete_key(HKEY_CURRENT_USER, KEY_BASE);
}
static void test_copy_key_class(void)
{
HKEY hkey;
LONG rc;
char class[] = "class";
char buf[16];
DWORD buf_size, r;
rc = RegCreateKeyExA(HKEY_CURRENT_USER, COPY_SRC, 0, class, REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_WRITE, NULL, &hkey, NULL);
ok(rc == ERROR_SUCCESS, "RegCreateKeyExA failed: got %d, expected 0\n", rc);
add_value(hkey, "String", REG_SZ, "Data", 5);
buf_size = sizeof(buf);
rc = RegQueryInfoKeyA(hkey, buf, &buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ok(rc == ERROR_SUCCESS, "RegQueryInfoKeyA failed: got %d, expected 0\n", rc);
ok(!strcmp(buf, "class"), "Incorrect key class set; got '%s', expected '%s'\n", buf, class);
RegCloseKey(hkey);
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);
open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
verify_reg(hkey, "String", REG_SZ, "Data", 5, 0);
memset(buf, 0, sizeof(buf));
buf_size = sizeof(buf);
rc = RegQueryInfoKeyA(hkey, buf, &buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ok(rc == ERROR_SUCCESS, "RegQueryInfoKeyA failed: got %d, expected 0\n", rc);
ok(strlen(buf) == 0, "Key class should not exist\n");
RegCloseKey(hkey);
delete_key(HKEY_CURRENT_USER, COPY_SRC);
delete_key(HKEY_CURRENT_USER, KEY_BASE);
}
START_TEST(copy)
{
DWORD r;
@ -554,4 +596,5 @@ START_TEST(copy)
test_copy_embedded_null_values();
test_copy_slashes();
test_copy_escaped_null_values();
test_copy_key_class();
}

View file

@ -4,4 +4,4 @@ directories:
files:
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
tags:
wine: 0abc002a3e232be3445241e435ef17ac89d6c947
wine: 664f8b638d421540e73b4e046a9aa5e66f8cc4ff