1295a04dfSwinesync /* 2295a04dfSwinesync * Copyright 2021 Hugh McMaster 3295a04dfSwinesync * 4295a04dfSwinesync * This library is free software; you can redistribute it and/or 5295a04dfSwinesync * modify it under the terms of the GNU Lesser General Public 6295a04dfSwinesync * License as published by the Free Software Foundation; either 7295a04dfSwinesync * version 2.1 of the License, or (at your option) any later version. 8295a04dfSwinesync * 9295a04dfSwinesync * This library is distributed in the hope that it will be useful, 10295a04dfSwinesync * but WITHOUT ANY WARRANTY; without even the implied warranty of 11295a04dfSwinesync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12295a04dfSwinesync * Lesser General Public License for more details. 13295a04dfSwinesync * 14295a04dfSwinesync * You should have received a copy of the GNU Lesser General Public 15295a04dfSwinesync * License along with this library; if not, write to the Free Software 16295a04dfSwinesync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17295a04dfSwinesync */ 18295a04dfSwinesync 19295a04dfSwinesync #include "reg_test.h" 20295a04dfSwinesync 211aea6bdfSwinesync #define COPY_SRC KEY_WINE "\\reg_copy" 22295a04dfSwinesync 231aea6bdfSwinesync static void test_command_syntax(void) 24295a04dfSwinesync { 25295a04dfSwinesync DWORD r; 26295a04dfSwinesync 27295a04dfSwinesync run_reg_exe("reg copy", &r); 28295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 29295a04dfSwinesync 30295a04dfSwinesync run_reg_exe("reg copy /?", &r); 31181292dcSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 32295a04dfSwinesync 33295a04dfSwinesync run_reg_exe("reg copy /h", &r); 34181292dcSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 35295a04dfSwinesync 36295a04dfSwinesync run_reg_exe("reg copy -H", &r); 37181292dcSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 38295a04dfSwinesync 39295a04dfSwinesync run_reg_exe("reg copy /? /f", &r); 4067493a40Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 41295a04dfSwinesync 42295a04dfSwinesync run_reg_exe("reg copy /h /f", &r); 4367493a40Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 44295a04dfSwinesync 45295a04dfSwinesync run_reg_exe("reg copy /? /s", &r); 4667493a40Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 47295a04dfSwinesync 48295a04dfSwinesync run_reg_exe("reg copy /h /s", &r); 4967493a40Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 50295a04dfSwinesync 51295a04dfSwinesync run_reg_exe("reg copy /f", &r); 52295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 53295a04dfSwinesync 54295a04dfSwinesync run_reg_exe("reg copy /s", &r); 55295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 56295a04dfSwinesync 57295a04dfSwinesync run_reg_exe("reg copy /s /f", &r); 58295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 59295a04dfSwinesync 60295a04dfSwinesync run_reg_exe("reg copy /f /s", &r); 61295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 62295a04dfSwinesync 631aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " /f", &r); 64295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 65295a04dfSwinesync 661aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " foo /f", &r); 67295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 68295a04dfSwinesync 691aea6bdfSwinesync run_reg_exe("reg copy /f HKCU\\" COPY_SRC " HKCU\\" KEY_BASE, &r); 70295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 71295a04dfSwinesync 721aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " /f HKCU\\" KEY_BASE, &r); 73295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 74295a04dfSwinesync 751aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " /s HKCU\\" KEY_BASE, &r); 76295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 77295a04dfSwinesync 781aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /a", &r); 79295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 80295a04dfSwinesync 811aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f /a", &r); 82295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 83295a04dfSwinesync 841aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\", &r); 85295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 86295a04dfSwinesync 871aea6bdfSwinesync /* Source and destination keys are the same */ 881aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC, &r); 89295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 90295a04dfSwinesync 91f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC, &r); 92f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 93f27a0866Swinesync 94f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\", &r); 95f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 96f27a0866Swinesync 97f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\", &r); 98f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 99f27a0866Swinesync 1001aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /f", &r); 101295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 102295a04dfSwinesync 103f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /f", &r); 104f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 105f27a0866Swinesync 106f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /f", &r); 107f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 108f27a0866Swinesync 109f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /f", &r); 110f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 111f27a0866Swinesync 1121aea6bdfSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /s /f", &r); 113295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 114f27a0866Swinesync 115f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /s /f", &r); 116f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 117f27a0866Swinesync 118f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /s /f", &r); 119f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 120f27a0866Swinesync 121f27a0866Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /s /f", &r); 122f27a0866Swinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 123295a04dfSwinesync } 124295a04dfSwinesync 125d40c4ec1Swinesync static void test_copy_empty_key(void) 126d40c4ec1Swinesync { 127d40c4ec1Swinesync DWORD r; 128d40c4ec1Swinesync 129d40c4ec1Swinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 130d40c4ec1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 131d40c4ec1Swinesync 132d40c4ec1Swinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 133d40c4ec1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 134d40c4ec1Swinesync 135d40c4ec1Swinesync add_key(HKEY_CURRENT_USER, COPY_SRC, NULL); 136d40c4ec1Swinesync 137d40c4ec1Swinesync 138d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 139da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 140da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 141d40c4ec1Swinesync 142d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r); 143da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 144da2d23fbSwinesync ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); 145d40c4ec1Swinesync 146*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 147d40c4ec1Swinesync 148d40c4ec1Swinesync 149d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE " /f", &r); 150da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 151da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 152d40c4ec1Swinesync 153d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r); 154da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 155da2d23fbSwinesync ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); 156d40c4ec1Swinesync 157*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 158d40c4ec1Swinesync 159d40c4ec1Swinesync 160d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "\\ /f", &r); 161da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 162da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 163d40c4ec1Swinesync 164d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r); 165da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 166da2d23fbSwinesync ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); 167d40c4ec1Swinesync 168*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 169d40c4ec1Swinesync 170d40c4ec1Swinesync 171d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE "\\ /f", &r); 172da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 173da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 174d40c4ec1Swinesync 175d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r); 176da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 177da2d23fbSwinesync ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); 178d40c4ec1Swinesync 179d40c4ec1Swinesync 180d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); 181da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 182da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 183d40c4ec1Swinesync 184d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r); 185da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 186da2d23fbSwinesync ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); 187d40c4ec1Swinesync } 188d40c4ec1Swinesync 189d40c4ec1Swinesync static void test_copy_simple_data(void) 190d40c4ec1Swinesync { 191d40c4ec1Swinesync HKEY hkey; 192d40c4ec1Swinesync DWORD r, dword; 193d40c4ec1Swinesync 194d40c4ec1Swinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 195d40c4ec1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 196d40c4ec1Swinesync 197d40c4ec1Swinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 198d40c4ec1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 199d40c4ec1Swinesync 200d40c4ec1Swinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 201d40c4ec1Swinesync 202d40c4ec1Swinesync dword = 0x100; 203d40c4ec1Swinesync add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); 204d40c4ec1Swinesync add_value(hkey, "String", REG_SZ, "Your text here...", 18); 205d40c4ec1Swinesync close_key(hkey); 206d40c4ec1Swinesync 207d40c4ec1Swinesync 208d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 209da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 210da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 211d40c4ec1Swinesync 212d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 213da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 214da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 215d40c4ec1Swinesync 216*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 217d40c4ec1Swinesync 218d40c4ec1Swinesync 219d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE " /f", &r); 220da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 221da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 222d40c4ec1Swinesync 223d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 224da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 225da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 226d40c4ec1Swinesync 227*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 228d40c4ec1Swinesync 229d40c4ec1Swinesync 230d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "\\ /f", &r); 231da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 232da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 233d40c4ec1Swinesync 234d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 235da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 236da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 237d40c4ec1Swinesync 238*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 239d40c4ec1Swinesync 240d40c4ec1Swinesync 241d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE "\\ /f", &r); 242da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 243da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 244d40c4ec1Swinesync 245d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 246da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 247da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 248d40c4ec1Swinesync 249d40c4ec1Swinesync 250d40c4ec1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); 251da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 252da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 253d40c4ec1Swinesync 254d40c4ec1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 255da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 256da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 257d40c4ec1Swinesync } 258d40c4ec1Swinesync 2596ae4684dSwinesync static void test_copy_complex_data(void) 2606ae4684dSwinesync { 2616ae4684dSwinesync HKEY hkey, subkey; 2626ae4684dSwinesync DWORD r, dword; 2636ae4684dSwinesync 2646ae4684dSwinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 2656ae4684dSwinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 2666ae4684dSwinesync 2676ae4684dSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 2686ae4684dSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 2696ae4684dSwinesync 2706ae4684dSwinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 2716ae4684dSwinesync 2726ae4684dSwinesync dword = 0x100; 2736ae4684dSwinesync add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); 2746ae4684dSwinesync add_value(hkey, "String", REG_SZ, "Your text here...", 18); 2756ae4684dSwinesync 2766ae4684dSwinesync add_key(hkey, "Subkey1", &subkey); 2776ae4684dSwinesync add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); 2786ae4684dSwinesync add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); 2796ae4684dSwinesync close_key(subkey); 2806ae4684dSwinesync 2816ae4684dSwinesync add_key(hkey, "Subkey2a", &subkey); 2826ae4684dSwinesync add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); 2836ae4684dSwinesync dword = 0x8; 2846ae4684dSwinesync add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); 2856ae4684dSwinesync close_key(subkey); 2866ae4684dSwinesync 2876ae4684dSwinesync add_key(hkey, "Subkey2a\\Subkey2b", &subkey); 2886ae4684dSwinesync add_value(subkey, NULL, REG_SZ, "Default value name", 19); 2896ae4684dSwinesync add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); 2906ae4684dSwinesync close_key(subkey); 2916ae4684dSwinesync 2926ae4684dSwinesync add_key(hkey, "Subkey3a", &subkey); 2936ae4684dSwinesync add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); 2946ae4684dSwinesync close_key(subkey); 2956ae4684dSwinesync 2966ae4684dSwinesync add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); 2976ae4684dSwinesync add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); 2986ae4684dSwinesync add_value(subkey, "Zero data type", REG_NONE, "Value", 6); 2996ae4684dSwinesync close_key(subkey); 3006ae4684dSwinesync 3016ae4684dSwinesync add_key(hkey, "Subkey4", &subkey); 3026ae4684dSwinesync dword = 0x12345678; 3036ae4684dSwinesync add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); 3046ae4684dSwinesync add_value(subkey, "43981", 0xabcd, "Value", 6); 3056ae4684dSwinesync close_key(subkey); 3066ae4684dSwinesync 3076ae4684dSwinesync close_key(hkey); 3086ae4684dSwinesync 3096ae4684dSwinesync /* Copy values only */ 3106ae4684dSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 311da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 312da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 3136ae4684dSwinesync 3146ae4684dSwinesync run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); 315da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 316da2d23fbSwinesync ok(compare_export("file.reg", simple_data_test, 0), "compare_export() failed\n"); 3176ae4684dSwinesync 3186ae4684dSwinesync /* Copy subkeys and values */ 3196ae4684dSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); 320da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 321da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 3226ae4684dSwinesync 3236ae4684dSwinesync run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); 324da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 325ded0675dSwinesync ok(compare_export("file.reg", complex_data_test, 0), "compare_export() failed\n"); 3266ae4684dSwinesync } 3276ae4684dSwinesync 328552256c1Swinesync static void test_copy_key_order(void) 329552256c1Swinesync { 330552256c1Swinesync HKEY hkey; 331552256c1Swinesync DWORD r; 332552256c1Swinesync 333552256c1Swinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 334552256c1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 335552256c1Swinesync 336552256c1Swinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 337552256c1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 338552256c1Swinesync 339552256c1Swinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 340552256c1Swinesync add_key(hkey, "Subkey2", NULL); 341552256c1Swinesync add_key(hkey, "Subkey1", NULL); 342552256c1Swinesync close_key(hkey); 343552256c1Swinesync 344552256c1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); 345da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 346da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 347552256c1Swinesync 348552256c1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 349da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 350ded0675dSwinesync ok(compare_export("file.reg", key_order_test, 0), "compare_export() failed\n"); 351552256c1Swinesync } 352552256c1Swinesync 353552256c1Swinesync static void test_copy_value_order(void) 354552256c1Swinesync { 355552256c1Swinesync HKEY hkey; 356552256c1Swinesync DWORD r; 357552256c1Swinesync 358552256c1Swinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 359552256c1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 360552256c1Swinesync 361552256c1Swinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 362552256c1Swinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 363552256c1Swinesync 364552256c1Swinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 365552256c1Swinesync add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); 366552256c1Swinesync add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); 367552256c1Swinesync close_key(hkey); 368552256c1Swinesync 369552256c1Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 370da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 371da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 372552256c1Swinesync 373552256c1Swinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 374da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 375da2d23fbSwinesync ok(compare_export("file.reg", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); 376552256c1Swinesync } 377552256c1Swinesync 3786ae4684dSwinesync static void test_copy_hex_data(void) 3796ae4684dSwinesync { 3806ae4684dSwinesync HKEY hkey; 3816ae4684dSwinesync DWORD r; 3826ae4684dSwinesync 3836ae4684dSwinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 3846ae4684dSwinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 3856ae4684dSwinesync 3866ae4684dSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 3876ae4684dSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 3886ae4684dSwinesync 3896ae4684dSwinesync /* Try copying empty hex values */ 3906ae4684dSwinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 3916ae4684dSwinesync add_value(hkey, "Wine1a", REG_NONE, NULL, 0); 3926ae4684dSwinesync add_value(hkey, "Wine1b", REG_SZ, NULL, 0); 3936ae4684dSwinesync add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); 3946ae4684dSwinesync add_value(hkey, "Wine1d", REG_BINARY, NULL, 0); 3956ae4684dSwinesync add_value(hkey, "Wine1e", REG_DWORD, NULL, 0); 3966ae4684dSwinesync add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0); 3976ae4684dSwinesync add_value(hkey, "Wine1g", 0x100, NULL, 0); 3986ae4684dSwinesync add_value(hkey, "Wine1h", 0xabcd, NULL, 0); 3996ae4684dSwinesync close_key(hkey); 4006ae4684dSwinesync 4016ae4684dSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 402da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 403da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 4046ae4684dSwinesync 4056ae4684dSwinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 406da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 407da2d23fbSwinesync ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n"); 4086ae4684dSwinesync 409*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); 410*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 4116ae4684dSwinesync 4126ae4684dSwinesync /* Try copying after importing alternative registry data types */ 4136ae4684dSwinesync test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" 4146ae4684dSwinesync "[HKEY_CURRENT_USER\\" COPY_SRC "]\n" 4156ae4684dSwinesync "\"Wine2a\"=hex(1):\n" 4166ae4684dSwinesync "\"Wine2b\"=hex(3):\n" 4176ae4684dSwinesync "\"Wine2c\"=hex(4):\n\n", &r); 4186ae4684dSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 4196ae4684dSwinesync 4206ae4684dSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 421da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 422da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 4236ae4684dSwinesync 4246ae4684dSwinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 425da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 426da2d23fbSwinesync ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n"); 4276ae4684dSwinesync 428*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); 429*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 4306ae4684dSwinesync 4316ae4684dSwinesync /* Try copying more complex hex data */ 4326ae4684dSwinesync test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" 4336ae4684dSwinesync "[HKEY_CURRENT_USER\\" COPY_SRC "]\n" 4346ae4684dSwinesync "\"Wine3a\"=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00\n" 4356ae4684dSwinesync "\"Wine3b\"=hex(3):12,34,56,78\n" 4366ae4684dSwinesync "\"Wine3c\"=hex(4):40,30,20,10\n\n", &r); 4376ae4684dSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 4386ae4684dSwinesync 4396ae4684dSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 440da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 441da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 4426ae4684dSwinesync 4436ae4684dSwinesync run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); 444da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 445da2d23fbSwinesync ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n"); 4466ae4684dSwinesync } 4476ae4684dSwinesync 448927db6beSwinesync static void test_copy_embedded_null_values(void) 449927db6beSwinesync { 450927db6beSwinesync DWORD r; 451927db6beSwinesync 452927db6beSwinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 453927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 454927db6beSwinesync 455927db6beSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 456927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 457927db6beSwinesync 458927db6beSwinesync test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" 459927db6beSwinesync "[HKEY_CURRENT_USER\\" COPY_SRC "]\n" 460927db6beSwinesync "\"Wine4a\"=dword:00000005\n" 461927db6beSwinesync "\"Wine4b\"=hex(1):00,00,00,00,00,00,00,00\n" 462927db6beSwinesync "\"Wine4c\"=\"Value\"\n" 463927db6beSwinesync "\"Wine4d\"=hex(1):00,00,61,00,62,00,63,00\n" 464927db6beSwinesync "\"Wine4e\"=dword:00000100\n" 465927db6beSwinesync "\"Wine4f\"=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00\n" 466927db6beSwinesync "\"Wine4g\"=\"Value2\"\n" 467927db6beSwinesync "\"Wine4h\"=hex(1):61,00,62,00,63,00,00,00, \\\n" 468927db6beSwinesync " 64,00,65,00,66,00,00,00\n\n", &r); 469927db6beSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 470927db6beSwinesync 471927db6beSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 472da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 473da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 474927db6beSwinesync 475927db6beSwinesync run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); 476da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 477da2d23fbSwinesync ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n"); 478927db6beSwinesync } 479927db6beSwinesync 480927db6beSwinesync static void test_copy_slashes(void) 481927db6beSwinesync { 482927db6beSwinesync HKEY hkey; 483927db6beSwinesync DWORD r; 484927db6beSwinesync 485927db6beSwinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 486927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 487927db6beSwinesync 488927db6beSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 489927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 490927db6beSwinesync 491927db6beSwinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 492927db6beSwinesync add_key(hkey, "https://winehq.org", NULL); 493927db6beSwinesync add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); 494927db6beSwinesync add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); 495927db6beSwinesync close_key(hkey); 496927db6beSwinesync 497927db6beSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /s /f", &r); 498da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 499da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 500927db6beSwinesync 501927db6beSwinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 502da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 503da2d23fbSwinesync ok(compare_export("file.reg", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); 504927db6beSwinesync } 505927db6beSwinesync 506927db6beSwinesync static void test_copy_escaped_null_values(void) 507927db6beSwinesync { 508927db6beSwinesync HKEY hkey; 509927db6beSwinesync DWORD r; 510927db6beSwinesync 511927db6beSwinesync delete_tree(HKEY_CURRENT_USER, COPY_SRC); 512927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC); 513927db6beSwinesync 514927db6beSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 515927db6beSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 516927db6beSwinesync 517927db6beSwinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 518927db6beSwinesync add_value(hkey, "Wine5a", REG_SZ, "\\0", 3); 519927db6beSwinesync add_value(hkey, "Wine5b", REG_SZ, "\\0\\0", 5); 520927db6beSwinesync add_value(hkey, "Wine5c", REG_SZ, "Value1\\0", 9); 521927db6beSwinesync add_value(hkey, "Wine5d", REG_SZ, "Value2\\0\\0\\0\\0", 15); 522927db6beSwinesync add_value(hkey, "Wine5e", REG_SZ, "Value3\\0Value4", 15); 523927db6beSwinesync add_value(hkey, "Wine5f", REG_SZ, "\\0Value5", 9); 524927db6beSwinesync close_key(hkey); 525927db6beSwinesync 526927db6beSwinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 527da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 528da2d23fbSwinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 529927db6beSwinesync 530927db6beSwinesync run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y", &r); 531da2d23fbSwinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 532da2d23fbSwinesync ok(compare_export("file.reg", escaped_null_test, 0), "compare_export() failed\n"); 533927db6beSwinesync 534*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); 535*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 536927db6beSwinesync } 537927db6beSwinesync 53807427368Swinesync static void test_copy_key_class(void) 53907427368Swinesync { 54007427368Swinesync HKEY hkey; 54107427368Swinesync LONG rc; 54207427368Swinesync char class[] = "class"; 54307427368Swinesync char buf[16]; 54407427368Swinesync DWORD buf_size, r; 54507427368Swinesync 54607427368Swinesync rc = RegCreateKeyExA(HKEY_CURRENT_USER, COPY_SRC, 0, class, REG_OPTION_NON_VOLATILE, 54707427368Swinesync KEY_READ|KEY_WRITE, NULL, &hkey, NULL); 54807427368Swinesync ok(rc == ERROR_SUCCESS, "RegCreateKeyExA failed: got %d, expected 0\n", rc); 54907427368Swinesync 55007427368Swinesync add_value(hkey, "String", REG_SZ, "Data", 5); 55107427368Swinesync 55207427368Swinesync buf_size = sizeof(buf); 55307427368Swinesync 55407427368Swinesync rc = RegQueryInfoKeyA(hkey, buf, &buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 55507427368Swinesync ok(rc == ERROR_SUCCESS, "RegQueryInfoKeyA failed: got %d, expected 0\n", rc); 55607427368Swinesync ok(!strcmp(buf, "class"), "Incorrect key class set; got '%s', expected '%s'\n", buf, class); 55707427368Swinesync 55807427368Swinesync RegCloseKey(hkey); 55907427368Swinesync 56007427368Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 56107427368Swinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 56207427368Swinesync verify_key(HKEY_CURRENT_USER, KEY_BASE); 56307427368Swinesync 56407427368Swinesync open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); 56507427368Swinesync verify_reg(hkey, "String", REG_SZ, "Data", 5, 0); 56607427368Swinesync 56707427368Swinesync memset(buf, 0, sizeof(buf)); 56807427368Swinesync buf_size = sizeof(buf); 56907427368Swinesync 57007427368Swinesync rc = RegQueryInfoKeyA(hkey, buf, &buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 57107427368Swinesync ok(rc == ERROR_SUCCESS, "RegQueryInfoKeyA failed: got %d, expected 0\n", rc); 57207427368Swinesync ok(strlen(buf) == 0, "Key class should not exist\n"); 57307427368Swinesync 57407427368Swinesync RegCloseKey(hkey); 57507427368Swinesync 576*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); 577*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 57807427368Swinesync } 57907427368Swinesync 5809ad9ae45Swinesync static void test_copy_overwrite(void) 5819ad9ae45Swinesync { 5829ad9ae45Swinesync HKEY hkey; 5839ad9ae45Swinesync DWORD r, dword; 5849ad9ae45Swinesync 5859ad9ae45Swinesync add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey); 5869ad9ae45Swinesync add_value(hkey, "Wine1", REG_SZ, "def", 4); 5879ad9ae45Swinesync dword = 0x5; 5889ad9ae45Swinesync add_value(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword)); 5899ad9ae45Swinesync add_value(hkey, "Wine3", REG_BINARY, "\x11\x22\x33\x44", 4); 5909ad9ae45Swinesync add_value(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); 5919ad9ae45Swinesync close_key(hkey); 5929ad9ae45Swinesync 5939ad9ae45Swinesync add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); 5949ad9ae45Swinesync add_value(hkey, "Wine1", REG_SZ, "abc", 4); 5959ad9ae45Swinesync verify_reg_nonexist(hkey, "Wine2"); 5969ad9ae45Swinesync add_value(hkey, "Wine3", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); 5979ad9ae45Swinesync dword = 0x1; 5989ad9ae45Swinesync add_value(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword)); 5999ad9ae45Swinesync add_value(hkey, NULL, REG_SZ, "Constant value", 15); 6009ad9ae45Swinesync close_key(hkey); 6019ad9ae45Swinesync 6029ad9ae45Swinesync run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f", &r); 6039ad9ae45Swinesync ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 6049ad9ae45Swinesync 6059ad9ae45Swinesync open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); 6069ad9ae45Swinesync verify_reg(hkey, "Wine1", REG_SZ, "def", 4, 0); 6079ad9ae45Swinesync dword = 0x5; 6089ad9ae45Swinesync verify_reg(hkey, "Wine2", REG_DWORD, &dword, sizeof(dword), 0); 6099ad9ae45Swinesync verify_reg(hkey, "Wine3", REG_BINARY, "\x11\x22\x33\x44", 4, 0); 6109ad9ae45Swinesync verify_reg(hkey, "Wine4", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19, 0); 6119ad9ae45Swinesync verify_reg(hkey, NULL, REG_SZ, "Constant value", 15, 0); 6129ad9ae45Swinesync close_key(hkey); 6139ad9ae45Swinesync 614*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, COPY_SRC, 0); 615*0ea0084cSwinesync delete_key(HKEY_CURRENT_USER, KEY_BASE, 0); 6169ad9ae45Swinesync } 6179ad9ae45Swinesync 618295a04dfSwinesync START_TEST(copy) 619295a04dfSwinesync { 620295a04dfSwinesync DWORD r; 621295a04dfSwinesync 622295a04dfSwinesync if (!run_reg_exe("reg.exe /?", &r)) { 6232161165dSwinesync win_skip("reg.exe not available, skipping 'copy' tests\n"); 624295a04dfSwinesync return; 625295a04dfSwinesync } 626295a04dfSwinesync 6271aea6bdfSwinesync test_command_syntax(); 628d40c4ec1Swinesync test_copy_empty_key(); 629d40c4ec1Swinesync test_copy_simple_data(); 6306ae4684dSwinesync test_copy_complex_data(); 631552256c1Swinesync test_copy_key_order(); 632552256c1Swinesync test_copy_value_order(); 6336ae4684dSwinesync test_copy_hex_data(); 634927db6beSwinesync test_copy_embedded_null_values(); 635927db6beSwinesync test_copy_slashes(); 636927db6beSwinesync test_copy_escaped_null_values(); 63707427368Swinesync test_copy_key_class(); 6389ad9ae45Swinesync test_copy_overwrite(); 639295a04dfSwinesync } 640