From 9ad9ae45ace0e13fd73312a0bb1a86228eaafd68 Mon Sep 17 00:00:00 2001 From: winesync Date: Mon, 17 Jan 2022 18:47:35 +0100 Subject: [PATCH] [WINESYNC] reg/tests: Test how values are overwritten when copying. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard wine commit id 8104629672db54fcc13f05f980149d2cc4170e24 by Hugh McMaster --- modules/rostests/winetests/reg/copy.c | 39 +++++++++++++++++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/reg/copy.c b/modules/rostests/winetests/reg/copy.c index 2604d54b639..763135c2a0f 100644 --- a/modules/rostests/winetests/reg/copy.c +++ b/modules/rostests/winetests/reg/copy.c @@ -577,6 +577,44 @@ static void test_copy_key_class(void) delete_key(HKEY_CURRENT_USER, KEY_BASE); } +static void test_copy_overwrite(void) +{ + HKEY hkey; + DWORD r, dword; + + add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); + add_value(hkey, "Wine1", REG_SZ, "def", 4); + dword = 0x5; + add_value(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword)); + add_value(hkey, "Wine3", REG_BINARY, "\x11\x22\x33\x44", 4); + add_value(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); + close_key(hkey); + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_value(hkey, "Wine1", REG_SZ, "abc", 4); + verify_reg_nonexist(hkey, "Wine2"); + add_value(hkey, "Wine3", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); + dword = 0x1; + add_value(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword)); + add_value(hkey, NULL, REG_SZ, "Constant value", 15); + close_key(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); + + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + verify_reg(hkey, "Wine1", REG_SZ, "def", 4, 0); + dword = 0x5; + verify_reg(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine3", REG_BINARY, "\x11\x22\x33\x44", 4, 0); + verify_reg(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19, 0); + 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); +} + START_TEST(copy) { DWORD r; @@ -597,4 +635,5 @@ START_TEST(copy) test_copy_slashes(); test_copy_escaped_null_values(); test_copy_key_class(); + test_copy_overwrite(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 2e7adbfeb59..aaef9395814 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: aeeda123b1185e6d6f6c975354fe567c4573502e + wine: 8104629672db54fcc13f05f980149d2cc4170e24