Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
8d42cb9c
Commit
8d42cb9c
authored
Jun 28, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Jun 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Support use of registry views when deleting registry values.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e6603ae4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
18 deletions
+32
-18
delete.c
programs/reg/delete.c
+18
-4
delete.c
programs/reg/tests/delete.c
+14
-14
No files found.
programs/reg/delete.c
View file @
8d42cb9c
...
@@ -35,7 +35,7 @@ static void output_error(LONG rc)
...
@@ -35,7 +35,7 @@ static void output_error(LONG rc)
}
}
}
}
static
int
run_delete
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
static
int
run_delete
(
HKEY
root
,
WCHAR
*
path
,
REGSAM
sam
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
{
{
LONG
rc
;
LONG
rc
;
...
@@ -72,7 +72,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
...
@@ -72,7 +72,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name
return
0
;
return
0
;
}
}
if
((
rc
=
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
hkey
)))
if
((
rc
=
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
KEY_SET_VALUE
|
sam
,
&
hkey
)))
{
{
output_error
(
rc
);
output_error
(
rc
);
return
1
;
return
1
;
...
@@ -132,6 +132,7 @@ int reg_delete(int argc, WCHAR *argvW[])
...
@@ -132,6 +132,7 @@ int reg_delete(int argc, WCHAR *argvW[])
HKEY
root
;
HKEY
root
;
WCHAR
*
path
,
*
key_name
,
*
value_name
=
NULL
;
WCHAR
*
path
,
*
key_name
,
*
value_name
=
NULL
;
BOOL
value_all
=
FALSE
,
value_empty
=
FALSE
,
force
=
FALSE
;
BOOL
value_all
=
FALSE
,
value_empty
=
FALSE
,
force
=
FALSE
;
REGSAM
sam
=
0
;
int
i
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
...
@@ -158,8 +159,18 @@ int reg_delete(int argc, WCHAR *argvW[])
...
@@ -158,8 +159,18 @@ int reg_delete(int argc, WCHAR *argvW[])
value_empty
=
TRUE
;
value_empty
=
TRUE
;
continue
;
continue
;
}
}
else
if
(
!
lstrcmpiW
(
str
,
L"reg:32"
)
||
!
lstrcmpiW
(
str
,
L"reg:64"
))
else
if
(
!
lstrcmpiW
(
str
,
L"reg:32"
))
{
if
(
sam
&
KEY_WOW64_32KEY
)
goto
invalid
;
sam
|=
KEY_WOW64_32KEY
;
continue
;
}
else
if
(
!
lstrcmpiW
(
str
,
L"reg:64"
))
{
if
(
sam
&
KEY_WOW64_64KEY
)
goto
invalid
;
sam
|=
KEY_WOW64_64KEY
;
continue
;
continue
;
}
else
if
(
!
str
[
0
]
||
str
[
1
])
else
if
(
!
str
[
0
]
||
str
[
1
])
goto
invalid
;
goto
invalid
;
...
@@ -181,9 +192,12 @@ int reg_delete(int argc, WCHAR *argvW[])
...
@@ -181,9 +192,12 @@ int reg_delete(int argc, WCHAR *argvW[])
if
((
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
))
if
((
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
))
goto
invalid
;
goto
invalid
;
if
(
sam
==
(
KEY_WOW64_32KEY
|
KEY_WOW64_64KEY
))
goto
invalid
;
key_name
=
get_long_key
(
root
,
path
);
key_name
=
get_long_key
(
root
,
path
);
return
run_delete
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
return
run_delete
(
root
,
path
,
sam
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
invalid:
invalid:
output_message
(
STRING_INVALID_SYNTAX
);
output_message
(
STRING_INVALID_SYNTAX
);
...
...
programs/reg/tests/delete.c
View file @
8d42cb9c
...
@@ -270,17 +270,17 @@ static void test_registry_view_win64(void)
...
@@ -270,17 +270,17 @@ static void test_registry_view_win64(void)
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
,
&
hkey
);
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
,
&
hkey
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /v DWORD /f /reg:32"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /v DWORD /f /reg:32"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
"DWORD"
);
verify_reg_nonexist
(
hkey
,
"DWORD"
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /ve /f /reg:32"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /ve /f /reg:32"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
NULL
);
verify_reg_nonexist
(
hkey
,
NULL
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /va /f /reg:32"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /va /f /reg:32"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
"String"
);
verify_reg_nonexist
(
hkey
,
"String"
);
todo_wine
verify_reg_nonexist
(
hkey
,
"Multiple Strings"
);
verify_reg_nonexist
(
hkey
,
"Multiple Strings"
);
verify_key
(
hkey
,
"Subkey"
,
KEY_WOW64_32KEY
);
verify_key
(
hkey
,
"Subkey"
,
KEY_WOW64_32KEY
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
"
\\
Subkey /f /reg:32"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
"
\\
Subkey /f /reg:32"
,
&
r
);
...
@@ -380,17 +380,17 @@ static void test_registry_view_wow64(void)
...
@@ -380,17 +380,17 @@ static void test_registry_view_wow64(void)
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /v DWORD /f /reg:64"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /v DWORD /f /reg:64"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
"DWORD"
);
verify_reg_nonexist
(
hkey
,
"DWORD"
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /ve /f /reg:64"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /ve /f /reg:64"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
NULL
);
verify_reg_nonexist
(
hkey
,
NULL
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /va /f /reg:64"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
" /va /f /reg:64"
,
&
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
);
todo_wine
verify_reg_nonexist
(
hkey
,
"String"
);
verify_reg_nonexist
(
hkey
,
"String"
);
todo_wine
verify_reg_nonexist
(
hkey
,
"Multiple Strings"
);
verify_reg_nonexist
(
hkey
,
"Multiple Strings"
);
verify_key
(
hkey
,
"Subkey"
,
KEY_WOW64_64KEY
);
verify_key
(
hkey
,
"Subkey"
,
KEY_WOW64_64KEY
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
"
\\
Subkey /f /reg:64"
,
&
r
);
run_reg_exe
(
"reg delete HKLM
\\
"
KEY_BASE
"
\\
Subkey /f /reg:64"
,
&
r
);
...
...
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