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 21295a04dfSwinesync #define COPY_DEST KEY_WINE "\\reg_copy" 22295a04dfSwinesync 23295a04dfSwinesync static void test_copy(void) 24295a04dfSwinesync { 25295a04dfSwinesync DWORD r; 26295a04dfSwinesync 27295a04dfSwinesync delete_tree(HKEY_CURRENT_USER, KEY_BASE); 28295a04dfSwinesync verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); 29295a04dfSwinesync 30295a04dfSwinesync run_reg_exe("reg copy", &r); 31295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 32295a04dfSwinesync 33295a04dfSwinesync run_reg_exe("reg copy /?", &r); 34295a04dfSwinesync todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 35295a04dfSwinesync 36295a04dfSwinesync run_reg_exe("reg copy /h", &r); 37295a04dfSwinesync todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 38295a04dfSwinesync 39295a04dfSwinesync run_reg_exe("reg copy -H", &r); 40295a04dfSwinesync todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 41295a04dfSwinesync 42295a04dfSwinesync run_reg_exe("reg copy /? /f", &r); 43295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 44295a04dfSwinesync 45295a04dfSwinesync run_reg_exe("reg copy /h /f", &r); 46295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 47295a04dfSwinesync 48295a04dfSwinesync run_reg_exe("reg copy /? /s", &r); 49295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 50295a04dfSwinesync 51295a04dfSwinesync run_reg_exe("reg copy /h /s", &r); 52295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 53295a04dfSwinesync 54295a04dfSwinesync run_reg_exe("reg copy /f", &r); 55295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 56295a04dfSwinesync 57295a04dfSwinesync run_reg_exe("reg copy /s", &r); 58295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 59295a04dfSwinesync 60295a04dfSwinesync run_reg_exe("reg copy /s /f", &r); 61295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 62295a04dfSwinesync 63295a04dfSwinesync run_reg_exe("reg copy /f /s", &r); 64295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 65295a04dfSwinesync 66295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " /f", &r); 67295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 68295a04dfSwinesync 69295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " foo /f", &r); 70295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 71295a04dfSwinesync 72295a04dfSwinesync run_reg_exe("reg copy /f HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" KEY_BASE, &r); 73295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 74295a04dfSwinesync 75295a04dfSwinesync run_reg_exe("reg copy /f HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" COPY_DEST, &r); 76295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 77295a04dfSwinesync 78295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " /f HKEY_CURRENT_USER\\" COPY_DEST, &r); 79295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 80295a04dfSwinesync 81295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " /s HKEY_CURRENT_USER\\" COPY_DEST, &r); 82295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 83295a04dfSwinesync 84295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" COPY_DEST " /a", &r); 85295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 86295a04dfSwinesync 87295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" COPY_DEST " /f /a", &r); 88295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 89295a04dfSwinesync 90295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" KEY_BASE, &r); 91295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 92295a04dfSwinesync 93295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" KEY_BASE " /f", &r); 94295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 95295a04dfSwinesync 96295a04dfSwinesync run_reg_exe("reg copy HKEY_CURRENT_USER\\" KEY_BASE " HKEY_CURRENT_USER\\" KEY_BASE " /s /f", &r); 97295a04dfSwinesync ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 98295a04dfSwinesync } 99295a04dfSwinesync 100295a04dfSwinesync START_TEST(copy) 101295a04dfSwinesync { 102295a04dfSwinesync DWORD r; 103295a04dfSwinesync 104295a04dfSwinesync if (!run_reg_exe("reg.exe /?", &r)) { 105*2161165dSwinesync win_skip("reg.exe not available, skipping 'copy' tests\n"); 106295a04dfSwinesync return; 107295a04dfSwinesync } 108295a04dfSwinesync 109295a04dfSwinesync test_copy(); 110295a04dfSwinesync } 111