mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
[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
This commit is contained in:
parent
f6fb1eb081
commit
181292dc07
7 changed files with 64 additions and 8 deletions
24
base/applications/cmdutils/reg/copy.c
Normal file
24
base/applications/cmdutils/reg/copy.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2021 Hugh McMaster
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "reg.h"
|
||||
|
||||
int reg_copy(int argc, WCHAR *argvW[])
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -148,9 +148,31 @@ STRINGTABLE
|
|||
STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?"
|
||||
STRING_KEY_NONEXIST, "reg: Unable to find the specified registry key\n"
|
||||
STRING_KEY_IMPORT_FAILED, "reg: Unable to import the registry key '%1'\n"
|
||||
|
||||
STRING_REG_VIEW_USAGE, " /reg:32\n\
|
||||
\ Access the registry using the 32-bit view.\n\n\
|
||||
\ /reg:64\n\
|
||||
\ Access the registry using the 64-bit view.\n\n"
|
||||
STRING_ACCESS_DENIED, "reg: Unable to access or create the specified registry key\n"
|
||||
|
||||
STRING_COPY_USAGE, "REG COPY <key1> <key2> [/s] [/f]\n\n\
|
||||
\ Copies the contents of a specified registry key to another location.\n\
|
||||
\ By default, this operation only copies registry values. Use [/s] to\n\
|
||||
\ recursively copy all subkeys and values.\n\n\
|
||||
\ <key1>, <key2>\n\
|
||||
\ Registry keys specifying the source (<key1>) and destination (<key2>)\n\
|
||||
\ of the data. If <key2> does not exist, it is created.\n\n\
|
||||
\ Format: ROOT\\Subkey\n\n\
|
||||
\ ROOT: A predefined registry key. This must be one of the following:\n\n\
|
||||
\ HKEY_LOCAL_MACHINE | HKLM\n\
|
||||
\ HKEY_CURRENT_USER | HKCU\n\
|
||||
\ HKEY_CLASSES_ROOT | HKCR\n\
|
||||
\ HKEY_USERS | HKU\n\
|
||||
\ HKEY_CURRENT_CONFIG | HKCC\n\n\
|
||||
\ Subkey: The full path to a registry key under a given ROOT key.\n\n\
|
||||
\ /s\n\
|
||||
\ Copy all subkeys and values from <key1> to <key2>.\n\n\
|
||||
\ /f\n\
|
||||
\ Overwrite all registry data in <key2> without prompting for confirmation.\n\
|
||||
\ This option does not modify subkeys and values that only exist in <key2>.\n\n"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2008 Andrew Riedi
|
||||
* Copyright 2016-2017, 2021 Hugh McMaster
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -285,6 +286,7 @@ static BOOL is_help_switch(const WCHAR *s)
|
|||
|
||||
enum operations {
|
||||
REG_ADD,
|
||||
REG_COPY,
|
||||
REG_DELETE,
|
||||
REG_EXPORT,
|
||||
REG_IMPORT,
|
||||
|
@ -299,6 +301,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help)
|
|||
static const struct op_info op_array[] =
|
||||
{
|
||||
{ L"add", REG_ADD, STRING_ADD_USAGE },
|
||||
{ L"copy", REG_COPY, STRING_COPY_USAGE },
|
||||
{ L"delete", REG_DELETE, STRING_DELETE_USAGE },
|
||||
{ L"export", REG_EXPORT, STRING_EXPORT_USAGE },
|
||||
{ L"import", REG_IMPORT, STRING_IMPORT_USAGE },
|
||||
|
@ -362,6 +365,9 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
|
|||
if (op == REG_ADD)
|
||||
return reg_add(argc, argvW);
|
||||
|
||||
if (op == REG_COPY)
|
||||
return reg_copy(argc, argvW);
|
||||
|
||||
if (op == REG_DELETE)
|
||||
return reg_delete(argc, argvW);
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ BOOL is_switch(const WCHAR *s, const WCHAR c);
|
|||
/* add.c */
|
||||
int reg_add(int argc, WCHAR *argvW[]);
|
||||
|
||||
/* copy.c */
|
||||
int reg_copy(int argc, WCHAR *argvW[]);
|
||||
|
||||
/* delete.c */
|
||||
int reg_delete(int argc, WCHAR *argvW[]);
|
||||
|
||||
|
|
|
@ -65,3 +65,4 @@
|
|||
#define STRING_KEY_IMPORT_FAILED 140
|
||||
#define STRING_REG_VIEW_USAGE 141
|
||||
#define STRING_ACCESS_DENIED 142
|
||||
#define STRING_COPY_USAGE 143
|
||||
|
|
|
@ -28,25 +28,25 @@ static void test_command_syntax(void)
|
|||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
||||
run_reg_exe("reg copy /?", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
|
||||
run_reg_exe("reg copy /h", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
|
||||
run_reg_exe("reg copy -H", &r);
|
||||
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
|
||||
run_reg_exe("reg copy /? /f", &r);
|
||||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
||||
run_reg_exe("reg copy /h /f", &r);
|
||||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
||||
run_reg_exe("reg copy /? /s", &r);
|
||||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
||||
run_reg_exe("reg copy /h /s", &r);
|
||||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
||||
run_reg_exe("reg copy /f", &r);
|
||||
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
|
||||
|
|
|
@ -4,4 +4,4 @@ directories:
|
|||
files:
|
||||
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
|
||||
tags:
|
||||
wine: 537cd26f7cf799bf51875d1bc4970ec79a1184a3
|
||||
wine: ac32dd8abcdd93f5428ba93c8aff7f0bb5a7c2f2
|
||||
|
|
Loading…
Reference in a new issue