diff --git a/base/applications/cmdutils/reg/copy.c b/base/applications/cmdutils/reg/copy.c index 34abf8ade18..208adc46e00 100644 --- a/base/applications/cmdutils/reg/copy.c +++ b/base/applications/cmdutils/reg/copy.c @@ -163,6 +163,12 @@ int reg_copy(int argc, WCHAR *argvW[]) } } + if (src.root == dest.root && !lstrcmpiW(src.subkey, dest.subkey)) + { + output_message(STRING_COPY_SRC_DEST_SAME); + return 1; + } + return run_copy(&src, &dest, recurse, force); invalid: diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 7099cba594e..0c8eb47863c 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -206,7 +206,7 @@ WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD WCHAR *get_long_key(HKEY root, WCHAR *path) { - int i, len, path_len; + int i, len; WCHAR *long_key; for (i = 0; i < ARRAY_SIZE(root_rels); i++) @@ -224,15 +224,7 @@ WCHAR *get_long_key(HKEY root, WCHAR *path) return long_key; } - path_len = lstrlenW(path); - - if (path[path_len - 1] == '\\') - { - path[path_len - 1] = 0; - path_len--; - } - - len += path_len + 1; /* add one for the concatenating backslash */ + len += lstrlenW(path) + 1; /* add one for the concatenating backslash */ long_key = malloc((len + 1) * sizeof(WCHAR)); swprintf(long_key, L"%s\\%s", root_rels[i].long_name, path); return long_key; @@ -240,6 +232,8 @@ WCHAR *get_long_key(HKEY root, WCHAR *path) BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path) { + WCHAR *p; + if (!sane_path(key)) return FALSE; @@ -263,6 +257,9 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path) return FALSE; } + p = *path + lstrlenW(*path) - 1; + if (*p == '\\') *p = 0; + return TRUE; } diff --git a/base/applications/cmdutils/reg/resource.h b/base/applications/cmdutils/reg/resource.h index b3f660ca13b..b7afad26d22 100644 --- a/base/applications/cmdutils/reg/resource.h +++ b/base/applications/cmdutils/reg/resource.h @@ -61,6 +61,9 @@ #define STRING_OVERWRITE_VALUE 205 #define STRING_INVALID_CMDLINE 206 +/* copy.c */ +#define STRING_COPY_SRC_DEST_SAME 250 + /* delete.c */ #define STRING_DELETE_VALUE 300 #define STRING_DELETE_VALUEALL 301 diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 351e3803ee8..44d7c5205ee 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: 8d9a228e99e1252a0d82c88e6a64635548c478a6 + wine: 0abc002a3e232be3445241e435ef17ac89d6c947