From 07427368d30bbb3e4e9f579ef8b04a4bbd08e5e7 Mon Sep 17 00:00:00 2001 From: winesync Date: Mon, 17 Jan 2022 18:47:14 +0100 Subject: [PATCH] [WINESYNC] reg/tests: Test whether the 'copy' command copies user-defined key classes. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard wine commit id 664f8b638d421540e73b4e046a9aa5e66f8cc4ff by Hugh McMaster --- modules/rostests/winetests/reg/copy.c | 43 +++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index 70f9496b149..2604d54b639 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -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(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 44d7c5205ee..1f071ea0f1c 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 0abc002a3e232be3445241e435ef17ac89d6c947 + wine: 664f8b638d421540e73b4e046a9aa5e66f8cc4ff