Reactos

[WINESYNC] reg: Add initial support for the 'copy' command.

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

wine commit id ac32dd8abcdd93f5428ba93c8aff7f0bb5a7c2f2 by Hugh McMaster <hugh.mcmaster@outlook.com>

manual adjustment needed

authored by

winesync and committed by
Thomas Csovcsity
181292dc f6fb1eb0

+64 -8
+24
base/applications/cmdutils/reg/copy.c
··· 1 + /* 2 + * Copyright 2021 Hugh McMaster 3 + * 4 + * This library is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU Lesser General Public 6 + * License as published by the Free Software Foundation; either 7 + * version 2.1 of the License, or (at your option) any later version. 8 + * 9 + * This library is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 + * Lesser General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU Lesser General Public 15 + * License along with this library; if not, write to the Free Software 16 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 + */ 18 + 19 + #include "reg.h" 20 + 21 + int reg_copy(int argc, WCHAR *argvW[]) 22 + { 23 + return 1; 24 + }
+22
base/applications/cmdutils/reg/lang/en-US.rc
··· 148 148 STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" 149 149 STRING_KEY_NONEXIST, "reg: Unable to find the specified registry key\n" 150 150 STRING_KEY_IMPORT_FAILED, "reg: Unable to import the registry key '%1'\n" 151 + 151 152 STRING_REG_VIEW_USAGE, " /reg:32\n\ 152 153 \ Access the registry using the 32-bit view.\n\n\ 153 154 \ /reg:64\n\ 154 155 \ Access the registry using the 64-bit view.\n\n" 155 156 STRING_ACCESS_DENIED, "reg: Unable to access or create the specified registry key\n" 157 + 158 + STRING_COPY_USAGE, "REG COPY <key1> <key2> [/s] [/f]\n\n\ 159 + \ Copies the contents of a specified registry key to another location.\n\ 160 + \ By default, this operation only copies registry values. Use [/s] to\n\ 161 + \ recursively copy all subkeys and values.\n\n\ 162 + \ <key1>, <key2>\n\ 163 + \ Registry keys specifying the source (<key1>) and destination (<key2>)\n\ 164 + \ of the data. If <key2> does not exist, it is created.\n\n\ 165 + \ Format: ROOT\\Subkey\n\n\ 166 + \ ROOT: A predefined registry key. This must be one of the following:\n\n\ 167 + \ HKEY_LOCAL_MACHINE | HKLM\n\ 168 + \ HKEY_CURRENT_USER | HKCU\n\ 169 + \ HKEY_CLASSES_ROOT | HKCR\n\ 170 + \ HKEY_USERS | HKU\n\ 171 + \ HKEY_CURRENT_CONFIG | HKCC\n\n\ 172 + \ Subkey: The full path to a registry key under a given ROOT key.\n\n\ 173 + \ /s\n\ 174 + \ Copy all subkeys and values from <key1> to <key2>.\n\n\ 175 + \ /f\n\ 176 + \ Overwrite all registry data in <key2> without prompting for confirmation.\n\ 177 + \ This option does not modify subkeys and values that only exist in <key2>.\n\n" 156 178 }
+6
base/applications/cmdutils/reg/reg.c
··· 1 1 /* 2 2 * Copyright 2008 Andrew Riedi 3 + * Copyright 2016-2017, 2021 Hugh McMaster 3 4 * 4 5 * This library is free software; you can redistribute it and/or 5 6 * modify it under the terms of the GNU Lesser General Public ··· 285 286 286 287 enum operations { 287 288 REG_ADD, 289 + REG_COPY, 288 290 REG_DELETE, 289 291 REG_EXPORT, 290 292 REG_IMPORT, ··· 299 301 static const struct op_info op_array[] = 300 302 { 301 303 { L"add", REG_ADD, STRING_ADD_USAGE }, 304 + { L"copy", REG_COPY, STRING_COPY_USAGE }, 302 305 { L"delete", REG_DELETE, STRING_DELETE_USAGE }, 303 306 { L"export", REG_EXPORT, STRING_EXPORT_USAGE }, 304 307 { L"import", REG_IMPORT, STRING_IMPORT_USAGE }, ··· 361 364 362 365 if (op == REG_ADD) 363 366 return reg_add(argc, argvW); 367 + 368 + if (op == REG_COPY) 369 + return reg_copy(argc, argvW); 364 370 365 371 if (op == REG_DELETE) 366 372 return reg_delete(argc, argvW);
+3
base/applications/cmdutils/reg/reg.h
··· 47 47 /* add.c */ 48 48 int reg_add(int argc, WCHAR *argvW[]); 49 49 50 + /* copy.c */ 51 + int reg_copy(int argc, WCHAR *argvW[]); 52 + 50 53 /* delete.c */ 51 54 int reg_delete(int argc, WCHAR *argvW[]); 52 55
+1
base/applications/cmdutils/reg/resource.h
··· 65 65 #define STRING_KEY_IMPORT_FAILED 140 66 66 #define STRING_REG_VIEW_USAGE 141 67 67 #define STRING_ACCESS_DENIED 142 68 + #define STRING_COPY_USAGE 143
+7 -7
modules/rostests/winetests/reg/copy.c
··· 28 28 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 29 29 30 30 run_reg_exe("reg copy /?", &r); 31 - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 31 + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 32 32 33 33 run_reg_exe("reg copy /h", &r); 34 - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 34 + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 35 35 36 36 run_reg_exe("reg copy -H", &r); 37 - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 37 + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); 38 38 39 39 run_reg_exe("reg copy /? /f", &r); 40 - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 40 + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 41 41 42 42 run_reg_exe("reg copy /h /f", &r); 43 - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 43 + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 44 44 45 45 run_reg_exe("reg copy /? /s", &r); 46 - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 46 + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 47 47 48 48 run_reg_exe("reg copy /h /s", &r); 49 - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 49 + todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); 50 50 51 51 run_reg_exe("reg copy /f", &r); 52 52 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
+1 -1
sdk/tools/winesync/reg.cfg
··· 4 4 files: 5 5 programs/reg/resource.h: base/applications/cmdutils/reg/resource.h 6 6 tags: 7 - wine: 537cd26f7cf799bf51875d1bc4970ec79a1184a3 7 + wine: ac32dd8abcdd93f5428ba93c8aff7f0bb5a7c2f2