https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a1c74056d127f87087116…
commit a1c74056d127f87087116733fd4984dc73f236c9
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:06:05 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:32 2022 +0200
[WINESYNC] reg: Only call get_long_key() when operations require it.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 07fdd5036ca40fd4f0475583b6e410192576d804 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/add.c | 4 ++--
base/applications/cmdutils/reg/delete.c | 4 +++-
base/applications/cmdutils/reg/export.c | 8 +++++---
base/applications/cmdutils/reg/query.c | 4 +++-
base/applications/cmdutils/reg/reg.c | 6 ++----
base/applications/cmdutils/reg/reg.h | 3 ++-
sdk/tools/winesync/reg.cfg | 2 +-
7 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c
index f259f0a4100..d94789ad484 100644
--- a/base/applications/cmdutils/reg/add.c
+++ b/base/applications/cmdutils/reg/add.c
@@ -213,11 +213,11 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL
value_empty,
int reg_add(int argc, WCHAR *argvW[])
{
HKEY root;
- WCHAR *path, *key_name, *value_name = NULL, *type = NULL, *data = NULL, separator =
'\0';
+ WCHAR *path, *value_name = NULL, *type = NULL, *data = NULL, separator =
'\0';
BOOL value_empty = FALSE, force = FALSE;
int i;
- if (!parse_registry_key(argvW[2], &root, &path, &key_name))
+ if (!parse_registry_key(argvW[2], &root, &path))
return 1;
for (i = 3; i < argc; i++)
diff --git a/base/applications/cmdutils/reg/delete.c
b/base/applications/cmdutils/reg/delete.c
index b23b14e8dab..626fcf3b341 100644
--- a/base/applications/cmdutils/reg/delete.c
+++ b/base/applications/cmdutils/reg/delete.c
@@ -113,7 +113,7 @@ int reg_delete(int argc, WCHAR *argvW[])
BOOL value_all = FALSE, value_empty = FALSE, force = FALSE;
int i;
- if (!parse_registry_key(argvW[2], &root, &path, &key_name))
+ if (!parse_registry_key(argvW[2], &root, &path))
return 1;
for (i = 3; i < argc; i++)
@@ -158,6 +158,8 @@ int reg_delete(int argc, WCHAR *argvW[])
if ((value_name && value_empty) || (value_name && value_all) ||
(value_empty && value_all))
goto invalid;
+ key_name = get_long_key(root, path);
+
return run_delete(root, path, key_name, value_name, value_empty, value_all, force);
invalid:
diff --git a/base/applications/cmdutils/reg/export.c
b/base/applications/cmdutils/reg/export.c
index 0b6d9ad9cbe..eeb17a28753 100644
--- a/base/applications/cmdutils/reg/export.c
+++ b/base/applications/cmdutils/reg/export.c
@@ -347,14 +347,14 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
int reg_export(int argc, WCHAR *argvW[])
{
HKEY root, hkey;
- WCHAR *path, *long_key;
+ WCHAR *path, *key_name;
BOOL overwrite_file = FALSE;
HANDLE hFile;
int i, ret;
if (argc < 4) goto invalid;
- if (!parse_registry_key(argvW[2], &root, &path, &long_key))
+ if (!parse_registry_key(argvW[2], &root, &path))
return 1;
for (i = 4; i < argc; i++)
@@ -378,9 +378,11 @@ int reg_export(int argc, WCHAR *argvW[])
return 1;
}
+ key_name = get_long_key(root, path);
+
hFile = get_file_handle(argvW[3], overwrite_file);
export_file_header(hFile);
- ret = export_registry_data(hFile, hkey, long_key);
+ ret = export_registry_data(hFile, hkey, key_name);
export_newline(hFile);
CloseHandle(hFile);
diff --git a/base/applications/cmdutils/reg/query.c
b/base/applications/cmdutils/reg/query.c
index cc8f264e780..76f12b4a2d3 100644
--- a/base/applications/cmdutils/reg/query.c
+++ b/base/applications/cmdutils/reg/query.c
@@ -329,7 +329,7 @@ int reg_query(int argc, WCHAR *argvW[])
BOOL value_empty = FALSE, recurse = FALSE;
int i;
- if (!parse_registry_key(argvW[2], &root, &path, &key_name))
+ if (!parse_registry_key(argvW[2], &root, &path))
return 1;
for (i = 3; i < argc; i++)
@@ -368,6 +368,8 @@ int reg_query(int argc, WCHAR *argvW[])
if (value_name && value_empty)
goto invalid;
+ key_name = get_long_key(root, path);
+
return run_query(root, path, key_name, value_name, value_empty, recurse);
invalid:
diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c
index c275b4b8d27..1230d261d8e 100644
--- a/base/applications/cmdutils/reg/reg.c
+++ b/base/applications/cmdutils/reg/reg.c
@@ -203,7 +203,7 @@ WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR
*subkey_name, DWORD
return subkey_path;
}
-static WCHAR *get_long_key(HKEY root, WCHAR *path)
+WCHAR *get_long_key(HKEY root, WCHAR *path)
{
DWORD i, array_size = ARRAY_SIZE(root_rels), len;
WCHAR *long_key;
@@ -229,7 +229,7 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path)
return long_key;
}
-BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key)
+BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
{
if (!sane_path(key))
return FALSE;
@@ -245,8 +245,6 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path,
WCHAR **long
return FALSE;
}
- *long_key = get_long_key(*root, *path);
-
return TRUE;
}
diff --git a/base/applications/cmdutils/reg/reg.h b/base/applications/cmdutils/reg/reg.h
index c7719a6e4f0..3fc9e392d45 100644
--- a/base/applications/cmdutils/reg/reg.h
+++ b/base/applications/cmdutils/reg/reg.h
@@ -39,7 +39,8 @@ void WINAPIV output_string(const WCHAR *fmt, ...);
BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info);
HKEY path_get_rootkey(const WCHAR *path);
WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD
subkey_len);
-BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key);
+WCHAR *get_long_key(HKEY root, WCHAR *path);
+BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path);
BOOL is_char(const WCHAR s, const WCHAR c);
BOOL is_switch(const WCHAR *s, const WCHAR c);
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index d8c00f2dab7..29d9c7376af 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: 2c7d74594f2bd421f6d904f334171a198a13c66e
+ wine: 07fdd5036ca40fd4f0475583b6e410192576d804