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
72db61da
Commit
72db61da
authored
Dec 03, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Dec 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Recursively export all subkeys and data.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
49180106
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
+35
-5
export.c
programs/reg/export.c
+31
-2
reg.c
programs/reg/reg.c
+1
-1
reg.h
programs/reg/reg.h
+1
-0
reg.c
programs/reg/tests/reg.c
+2
-2
No files found.
programs/reg/export.c
View file @
72db61da
...
...
@@ -236,14 +236,18 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
heap_free
(
buf
);
}
#define MAX_SUBKEY_LEN 257
static
int
export_registry_data
(
HANDLE
hFile
,
HKEY
key
,
WCHAR
*
path
)
{
LONG
rc
;
DWORD
max_value_len
=
256
,
value_len
;
DWORD
max_data_bytes
=
2048
,
data_size
;
DWORD
i
,
type
;
WCHAR
*
value_name
;
DWORD
subkey_len
;
DWORD
i
,
type
,
path_len
;
WCHAR
*
value_name
,
*
subkey_name
,
*
subkey_path
;
BYTE
*
data
;
HKEY
subkey
;
export_key_name
(
hFile
,
path
);
...
...
@@ -280,6 +284,31 @@ static int export_registry_data(HANDLE hFile, HKEY key, WCHAR *path)
heap_free
(
data
);
heap_free
(
value_name
);
subkey_name
=
heap_xalloc
(
MAX_SUBKEY_LEN
*
sizeof
(
WCHAR
));
path_len
=
lstrlenW
(
path
);
i
=
0
;
for
(;;)
{
subkey_len
=
MAX_SUBKEY_LEN
;
rc
=
RegEnumKeyExW
(
key
,
i
,
subkey_name
,
&
subkey_len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
subkey_path
=
build_subkey_path
(
path
,
path_len
,
subkey_name
,
subkey_len
);
if
(
!
RegOpenKeyExW
(
key
,
subkey_name
,
0
,
KEY_READ
,
&
subkey
))
{
export_registry_data
(
hFile
,
subkey
,
subkey_path
);
RegCloseKey
(
subkey
);
}
heap_free
(
subkey_path
);
i
++
;
}
else
break
;
}
heap_free
(
subkey_name
);
return
0
;
}
...
...
programs/reg/reg.c
View file @
72db61da
...
...
@@ -637,7 +637,7 @@ static void output_value(const WCHAR *value_name, DWORD type, BYTE *data, DWORD
output_string
(
newlineW
);
}
static
WCHAR
*
build_subkey_path
(
WCHAR
*
path
,
DWORD
path_len
,
WCHAR
*
subkey_name
,
DWORD
subkey_len
)
WCHAR
*
build_subkey_path
(
WCHAR
*
path
,
DWORD
path_len
,
WCHAR
*
subkey_name
,
DWORD
subkey_len
)
{
WCHAR
*
subkey_path
;
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
...
...
programs/reg/reg.h
View file @
72db61da
...
...
@@ -31,6 +31,7 @@ void output_writeconsole(const WCHAR *str, DWORD wlen);
void
WINAPIV
output_message
(
unsigned
int
id
,
...);
BOOL
ask_confirm
(
unsigned
int
msgid
,
WCHAR
*
reg_info
);
HKEY
path_get_rootkey
(
const
WCHAR
*
path
);
WCHAR
*
build_subkey_path
(
WCHAR
*
path
,
DWORD
path_len
,
WCHAR
*
subkey_name
,
DWORD
subkey_len
);
BOOL
parse_registry_key
(
const
WCHAR
*
key
,
HKEY
*
root
,
WCHAR
**
path
,
WCHAR
**
long_key
);
/* import.c */
...
...
programs/reg/tests/reg.c
View file @
72db61da
...
...
@@ -4489,7 +4489,7 @@ static void test_export(void)
run_reg_exe
(
"reg export HKEY_CURRENT_USER
\\
"
KEY_BASE
" file.reg"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
ok
(
compare_export
(
"file.reg"
,
complex_test
,
TODO_REG_COMPARE
),
"compare_export() failed
\n
"
);
ok
(
compare_export
(
"file.reg"
,
complex_test
,
0
),
"compare_export() failed
\n
"
);
err
=
delete_tree
(
HKEY_CURRENT_USER
,
KEY_BASE
);
ok
(
err
==
ERROR_SUCCESS
,
"delete_tree() failed: %d
\n
"
,
err
);
...
...
@@ -4503,7 +4503,7 @@ static void test_export(void)
run_reg_exe
(
"reg export HKEY_CURRENT_USER
\\
"
KEY_BASE
" file.reg"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
ok
(
compare_export
(
"file.reg"
,
key_order_test
,
TODO_REG_COMPARE
),
"compare_export() failed
\n
"
);
ok
(
compare_export
(
"file.reg"
,
key_order_test
,
0
),
"compare_export() failed
\n
"
);
delete_key
(
hkey
,
"Subkey1"
);
delete_key
(
hkey
,
"Subkey2"
);
...
...
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