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
304b80a9
Commit
304b80a9
authored
Jun 18, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Jun 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Support the use of registry views during the 'add' operation.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
15b18f48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
20 deletions
+34
-20
add.c
programs/reg/add.c
+18
-4
add.c
programs/reg/tests/add.c
+16
-16
No files found.
programs/reg/add.c
View file @
304b80a9
...
...
@@ -158,7 +158,7 @@ static BOOL get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator,
return
TRUE
;
}
static
int
run_add
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
value_name
,
BOOL
value_empty
,
static
int
run_add
(
HKEY
root
,
WCHAR
*
path
,
REGSAM
sam
,
WCHAR
*
value_name
,
BOOL
value_empty
,
WCHAR
*
type
,
WCHAR
separator
,
WCHAR
*
data
,
BOOL
force
)
{
HKEY
hkey
;
...
...
@@ -167,7 +167,7 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
LONG
rc
;
if
(
RegCreateKeyExW
(
root
,
path
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
hkey
,
&
dispos
))
KEY_READ
|
KEY_WRITE
|
sam
,
NULL
,
&
hkey
,
&
dispos
))
{
output_message
(
STRING_ACCESS_DENIED
);
return
1
;
...
...
@@ -229,6 +229,7 @@ int reg_add(int argc, WCHAR *argvW[])
HKEY
root
;
WCHAR
*
path
,
*
value_name
=
NULL
,
*
type
=
NULL
,
*
data
=
NULL
,
separator
=
'\0'
;
BOOL
value_empty
=
FALSE
,
force
=
FALSE
;
REGSAM
sam
=
0
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
))
...
...
@@ -249,8 +250,18 @@ int reg_add(int argc, WCHAR *argvW[])
value_empty
=
TRUE
;
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
;
}
else
if
(
!
str
[
0
]
||
str
[
1
])
goto
invalid
;
...
...
@@ -286,7 +297,10 @@ int reg_add(int argc, WCHAR *argvW[])
if
(
value_name
&&
value_empty
)
goto
invalid
;
return
run_add
(
root
,
path
,
value_name
,
value_empty
,
type
,
separator
,
data
,
force
);
if
(
sam
==
(
KEY_WOW64_32KEY
|
KEY_WOW64_64KEY
))
goto
invalid
;
return
run_add
(
root
,
path
,
sam
,
value_name
,
value_empty
,
type
,
separator
,
data
,
force
);
invalid:
output_message
(
STRING_INVALID_SYNTAX
);
...
...
programs/reg/tests/add.c
View file @
304b80a9
...
...
@@ -277,13 +277,13 @@ static void test_command_syntax(void)
/* Test registry view */
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v abc /d 123 /f /reg:32 /reg:32"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v abc /d 123 /f /reg:32 /reg:64"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v abc /d 123 /f /reg:64 /reg:64"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
}
static
void
test_key_formats
(
void
)
...
...
@@ -914,12 +914,12 @@ static void test_registry_view_win64(void)
run_reg_exe
(
"reg add HKLM
\\
"
KEY_BASE
" /v Wine32 /d Test /f /reg:32"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
,
&
hkey
);
todo_wine
verify_reg
(
hkey
,
"Wine32"
,
REG_SZ
,
"Test"
,
5
,
0
);
todo_wine
close_key
(
hkey
);
todo_wine
delete_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
,
&
hkey
);
verify_reg
(
hkey
,
"Wine32"
,
REG_SZ
,
"Test"
,
5
,
0
);
close_key
(
hkey
);
delete_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
todo_wine
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
/* Try adding to the 64-bit registry view (64-bit Windows) */
run_reg_exe
(
"reg add HKLM
\\
"
KEY_BASE
" /v Wine64 /d Test /f /reg:64"
,
&
r
);
...
...
@@ -958,16 +958,16 @@ static void test_registry_view_wow64(void)
run_reg_exe
(
"reg add HKLM
\\
"
KEY_BASE
" /v Wine64 /d Test /f /reg:64"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
todo_wine
verify_reg
(
hkey
,
"Wine64"
,
REG_SZ
,
"Test"
,
5
,
0
);
todo_wine
close_key
(
hkey
);
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
verify_reg
(
hkey
,
"Wine64"
,
REG_SZ
,
"Test"
,
5
,
0
);
close_key
(
hkey
);
todo_wine
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
todo_wine
verify_reg
(
hkey
,
"Wine64"
,
REG_SZ
,
"Test"
,
5
,
0
);
todo_wine
close_key
(
hkey
);
todo_wine
delete_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
open_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
,
&
hkey
);
verify_reg
(
hkey
,
"Wine64"
,
REG_SZ
,
"Test"
,
5
,
0
);
close_key
(
hkey
);
delete_key
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
todo_wine
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
}
START_TEST
(
add
)
...
...
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