Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ab64b0e3
Commit
ab64b0e3
authored
May 12, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
May 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Fail if access is denied when deleting registry data.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
004b1179
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
delete.c
programs/reg/delete.c
+28
-7
No files found.
programs/reg/delete.c
View file @
ab64b0e3
...
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment