https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6fa073aacd69e9f0571f7…
commit 6fa073aacd69e9f0571f73ae4bfa18c6af5e37f3
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:17:20 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:35 2022 +0200
[WINESYNC] reg: Fail if access is denied when deleting registry data.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id ab64b0e33972b31b648ee92922b1df78cb6b5a70 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/delete.c | 35 ++++++++++++++++++++++++++-------
sdk/tools/winesync/reg.cfg | 2 +-
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/base/applications/cmdutils/reg/delete.c
b/base/applications/cmdutils/reg/delete.c
index f8e62e490b9..8804e16e52f 100644
--- a/base/applications/cmdutils/reg/delete.c
+++ b/base/applications/cmdutils/reg/delete.c
@@ -18,9 +18,27 @@
#include "reg.h"
+static BOOL op_delete_key = TRUE;
+
+static void output_error(LONG rc)
+{
+ if (rc == ERROR_FILE_NOT_FOUND)
+ {
+ if (op_delete_key)
+ output_message(STRING_KEY_NONEXIST);
+ else
+ output_message(STRING_VALUE_NONEXIST);
+ }
+ else
+ {
+ output_message(STRING_ACCESS_DENIED);
+ }
+}
+
static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
BOOL value_empty, BOOL value_all, BOOL force)
{
+ LONG rc;
HKEY hkey;
if (!force)
@@ -44,26 +62,28 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR
*value_name
/* Delete registry key if no /v* option is given */
if (!value_name && !value_empty && !value_all)
{
- if (RegDeleteTreeW(root, path) != ERROR_SUCCESS)
+ if ((rc = RegDeleteTreeW(root, path)))
{
- output_message(STRING_KEY_NONEXIST);
+ output_error(rc);
return 1;
}
+
output_message(STRING_SUCCESS);
return 0;
}
- if (RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &hkey))
+ if ((rc = RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &hkey)))
{
- output_message(STRING_KEY_NONEXIST);
+ output_error(rc);
return 1;
}
+ op_delete_key = FALSE;
+
if (value_all)
{
DWORD max_value_len = 256, value_len;
WCHAR *value_name;
- LONG rc;
value_name = malloc(max_value_len * sizeof(WCHAR));
@@ -79,6 +99,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR
*value_name
free(value_name);
RegCloseKey(hkey);
output_message(STRING_VALUEALL_FAILED, key_name);
+ output_error(rc);
return 1;
}
}
@@ -93,10 +114,10 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR
*value_name
}
else if (value_name || value_empty)
{
- if (RegDeleteValueW(hkey, value_name))
+ if ((rc = RegDeleteValueW(hkey, value_name)))
{
RegCloseKey(hkey);
- output_message(STRING_VALUE_NONEXIST);
+ output_error(rc);
return 1;
}
}
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index 3b85d966bea..8fb471fc658 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: 60c8dfdd0bbaff4a2369f884ec1a553a06735676
+ wine: ab64b0e33972b31b648ee92922b1df78cb6b5a70