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
fcf79426
Commit
fcf79426
authored
Jul 15, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Jul 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Support use of registry views when exporting registry data.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0b5ba1d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
export.c
programs/reg/export.c
+20
-6
export.c
programs/reg/tests/export.c
+5
-5
No files found.
programs/reg/export.c
View file @
fcf79426
...
...
@@ -225,7 +225,7 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
free
(
buf
);
}
static
int
export_registry_data
(
HANDLE
hFile
,
HKEY
hkey
,
WCHAR
*
path
)
static
int
export_registry_data
(
HANDLE
hFile
,
HKEY
hkey
,
WCHAR
*
path
,
REGSAM
sam
)
{
LONG
rc
;
DWORD
max_value_len
=
256
,
value_len
;
...
...
@@ -284,9 +284,9 @@ static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path)
if
(
rc
==
ERROR_SUCCESS
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
if
(
!
RegOpenKeyExW
(
hkey
,
subkey_name
,
0
,
KEY_READ
|
sam
,
&
subkey
))
{
export_registry_data
(
hFile
,
subkey
,
subkey_path
);
export_registry_data
(
hFile
,
subkey
,
subkey_path
,
sam
);
RegCloseKey
(
subkey
);
}
free
(
subkey_path
);
...
...
@@ -349,6 +349,7 @@ int reg_export(int argc, WCHAR *argvW[])
HKEY
root
,
hkey
;
WCHAR
*
path
,
*
key_name
;
BOOL
overwrite_file
=
FALSE
;
REGSAM
sam
=
0
;
HANDLE
hFile
;
int
i
,
ret
;
...
...
@@ -368,13 +369,26 @@ int reg_export(int argc, WCHAR *argvW[])
if
(
is_char
(
*
str
,
'y'
)
&&
!
str
[
1
])
overwrite_file
=
TRUE
;
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
goto
invalid
;
}
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
,
&
hkey
))
if
(
sam
==
(
KEY_WOW64_32KEY
|
KEY_WOW64_64KEY
))
goto
invalid
;
if
(
RegOpenKeyExW
(
root
,
path
,
0
,
KEY_READ
|
sam
,
&
hkey
))
{
output_message
(
STRING_KEY_NONEXIST
);
return
1
;
...
...
@@ -384,7 +398,7 @@ int reg_export(int argc, WCHAR *argvW[])
hFile
=
get_file_handle
(
argvW
[
3
],
overwrite_file
);
export_file_header
(
hFile
);
ret
=
export_registry_data
(
hFile
,
hkey
,
key_name
);
ret
=
export_registry_data
(
hFile
,
hkey
,
key_name
,
sam
);
export_newline
(
hFile
);
CloseHandle
(
hFile
);
...
...
programs/reg/tests/export.c
View file @
fcf79426
...
...
@@ -528,8 +528,8 @@ static void test_registry_view_win64(void)
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /reg:32"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
ok
(
compare_export
(
"file.reg"
,
registry_view_test
,
TODO_REG_COMPARE
),
"compare_export() failed
\n
"
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
ok
(
compare_export
(
"file.reg"
,
registry_view_test
,
0
),
"compare_export() failed
\n
"
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /reg:64"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
...
...
@@ -546,7 +546,7 @@ static void test_registry_view_win64(void)
ok
(
compare_export
(
"file.reg"
,
registry_view_test
,
0
),
"compare_export() failed
\n
"
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /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
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
}
...
...
@@ -571,7 +571,7 @@ static void test_registry_view_wow64(void)
ok
(
compare_export
(
"file.reg"
,
registry_view_test
,
0
),
"compare_export() failed
\n
"
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /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
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
delete_tree
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_64KEY
);
...
...
@@ -581,7 +581,7 @@ static void test_registry_view_wow64(void)
verify_key_nonexist
(
HKEY_LOCAL_MACHINE
,
KEY_BASE
,
KEY_WOW64_32KEY
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /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
);
ok
(
compare_export
(
"file.reg"
,
registry_view_test
,
0
),
"compare_export() failed
\n
"
);
run_reg_exe
(
"reg export HKEY_LOCAL_MACHINE
\\
"
KEY_BASE
" file.reg /y /reg:32"
,
&
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