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
baf0254b
Commit
baf0254b
authored
May 14, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg/tests: Add more data tests for the 'copy' command.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
31152763
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
29 deletions
+125
-29
copy.c
programs/reg/tests/copy.c
+93
-0
export.c
programs/reg/tests/export.c
+29
-29
reg_test.h
programs/reg/tests/reg_test.h
+3
-0
No files found.
programs/reg/tests/copy.c
View file @
baf0254b
...
...
@@ -395,6 +395,96 @@ static void test_copy_hex_data(void)
todo_wine
ok
(
compare_export
(
"file.reg"
,
hex_types_test
,
0
),
"compare_export() failed
\n
"
);
}
static
void
test_copy_embedded_null_values
(
void
)
{
DWORD
r
;
delete_tree
(
HKEY_CURRENT_USER
,
COPY_SRC
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
COPY_SRC
);
delete_tree
(
HKEY_CURRENT_USER
,
KEY_BASE
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
KEY_BASE
);
test_import_wstr
(
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\n\n
"
"[HKEY_CURRENT_USER
\\
"
COPY_SRC
"]
\n
"
"
\"
Wine4a
\"
=dword:00000005
\n
"
"
\"
Wine4b
\"
=hex(1):00,00,00,00,00,00,00,00
\n
"
"
\"
Wine4c
\"
=
\"
Value
\"\n
"
"
\"
Wine4d
\"
=hex(1):00,00,61,00,62,00,63,00
\n
"
"
\"
Wine4e
\"
=dword:00000100
\n
"
"
\"
Wine4f
\"
=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00
\n
"
"
\"
Wine4g
\"
=
\"
Value2
\"\n
"
"
\"
Wine4h
\"
=hex(1):61,00,62,00,63,00,00,00,
\\\n
"
" 64,00,65,00,66,00,00,00
\n\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
run_reg_exe
(
"reg copy HKCU
\\
"
COPY_SRC
" HKCU
\\
"
KEY_BASE
" /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
verify_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
run_reg_exe
(
"reg export HKEY_CURRENT_USER
\\
"
KEY_BASE
" file.reg /y"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
ok
(
compare_export
(
"file.reg"
,
embedded_null_test
,
0
),
"compare_export() failed
\n
"
);
}
static
void
test_copy_slashes
(
void
)
{
HKEY
hkey
;
DWORD
r
;
delete_tree
(
HKEY_CURRENT_USER
,
COPY_SRC
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
COPY_SRC
);
delete_tree
(
HKEY_CURRENT_USER
,
KEY_BASE
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
KEY_BASE
);
add_key
(
HKEY_CURRENT_USER
,
COPY_SRC
,
&
hkey
);
add_key
(
hkey
,
"https://winehq.org"
,
NULL
);
add_value
(
hkey
,
"count/up"
,
REG_SZ
,
"one/two/three"
,
14
);
add_value
(
hkey
,
"
\\
foo
\\
bar"
,
REG_SZ
,
""
,
1
);
close_key
(
hkey
);
run_reg_exe
(
"reg copy HKCU
\\
"
COPY_SRC
" HKCU
\\
"
KEY_BASE
" /s /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
verify_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
run_reg_exe
(
"reg export HKCU
\\
"
KEY_BASE
" file.reg /y"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
ok
(
compare_export
(
"file.reg"
,
slashes_test
,
0
),
"compare_export() failed
\n
"
);
}
static
void
test_copy_escaped_null_values
(
void
)
{
HKEY
hkey
;
DWORD
r
;
delete_tree
(
HKEY_CURRENT_USER
,
COPY_SRC
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
COPY_SRC
);
delete_tree
(
HKEY_CURRENT_USER
,
KEY_BASE
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
KEY_BASE
);
add_key
(
HKEY_CURRENT_USER
,
COPY_SRC
,
&
hkey
);
add_value
(
hkey
,
"Wine5a"
,
REG_SZ
,
"
\\
0"
,
3
);
add_value
(
hkey
,
"Wine5b"
,
REG_SZ
,
"
\\
0
\\
0"
,
5
);
add_value
(
hkey
,
"Wine5c"
,
REG_SZ
,
"Value1
\\
0"
,
9
);
add_value
(
hkey
,
"Wine5d"
,
REG_SZ
,
"Value2
\\
0
\\
0
\\
0
\\
0"
,
15
);
add_value
(
hkey
,
"Wine5e"
,
REG_SZ
,
"Value3
\\
0Value4"
,
15
);
add_value
(
hkey
,
"Wine5f"
,
REG_SZ
,
"
\\
0Value5"
,
9
);
close_key
(
hkey
);
run_reg_exe
(
"reg copy HKCU
\\
"
COPY_SRC
" HKCU
\\
"
KEY_BASE
" /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
verify_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
run_reg_exe
(
"reg export HKCU
\\
"
KEY_BASE
" file.reg /y"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
todo_wine
ok
(
compare_export
(
"file.reg"
,
escaped_null_test
,
0
),
"compare_export() failed
\n
"
);
delete_key
(
HKEY_CURRENT_USER
,
COPY_SRC
);
todo_wine
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
}
START_TEST
(
copy
)
{
DWORD
r
;
...
...
@@ -409,4 +499,7 @@ START_TEST(copy)
test_copy_simple_data
();
test_copy_complex_data
();
test_copy_hex_data
();
test_copy_embedded_null_values
();
test_copy_slashes
();
test_copy_escaped_null_values
();
}
programs/reg/tests/export.c
View file @
baf0254b
...
...
@@ -125,6 +125,35 @@ const char *hex_types_test =
"
\"
Wine3b
\"
=hex:12,34,56,78
\r\n
"
"
\"
Wine3c
\"
=dword:10203040
\r\n\r\n
"
;
const
char
*
embedded_null_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
Wine4a
\"
=dword:00000005
\r\n
"
"
\"
Wine4b
\"
=
\"\"\r\n
"
"
\"
Wine4c
\"
=
\"
Value
\"\r\n
"
"
\"
Wine4d
\"
=
\"\"\r\n
"
"
\"
Wine4e
\"
=dword:00000100
\r\n
"
"
\"
Wine4f
\"
=
\"\"\r\n
"
"
\"
Wine4g
\"
=
\"
Value2
\"\r\n
"
"
\"
Wine4h
\"
=
\"
abc
\"\r\n\r\n
"
;
const
char
*
slashes_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
count/up
\"
=
\"
one/two/three
\"\r\n
"
"
\"\\\\
foo
\\\\
bar
\"
=
\"\"\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
https://winehq.org]
\r\n\r\n
"
;
const
char
*
escaped_null_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
Wine5a
\"
=
\"\\\\
0
\"\r\n
"
"
\"
Wine5b
\"
=
\"\\\\
0
\\\\
0
\"\r\n
"
"
\"
Wine5c
\"
=
\"
Value1
\\\\
0
\"\r\n
"
"
\"
Wine5d
\"
=
\"
Value2
\\\\
0
\\\\
0
\\\\
0
\\\\
0
\"\r\n
"
"
\"
Wine5e
\"
=
\"
Value3
\\\\
0Value4
\"\r\n
"
"
\"
Wine5f
\"
=
\"\\\\
0Value5
\"\r\n\r\n
"
;
/* Unit tests */
...
...
@@ -147,35 +176,6 @@ static void test_export(void)
"
\"
Value 2
\"
=
\"
I was added first!
\"\r\n
"
"
\"
Value 1
\"
=
\"
I was added second!
\"\r\n\r\n
"
;
const
char
*
embedded_null_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
Wine4a
\"
=dword:00000005
\r\n
"
"
\"
Wine4b
\"
=
\"\"\r\n
"
"
\"
Wine4c
\"
=
\"
Value
\"\r\n
"
"
\"
Wine4d
\"
=
\"\"\r\n
"
"
\"
Wine4e
\"
=dword:00000100
\r\n
"
"
\"
Wine4f
\"
=
\"\"\r\n
"
"
\"
Wine4g
\"
=
\"
Value2
\"\r\n
"
"
\"
Wine4h
\"
=
\"
abc
\"\r\n\r\n
"
;
const
char
*
slashes_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
count/up
\"
=
\"
one/two/three
\"\r\n
"
"
\"\\\\
foo
\\\\
bar
\"
=
\"\"\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
https://winehq.org]
\r\n\r\n
"
;
const
char
*
escaped_null_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n
"
"
\"
Wine5a
\"
=
\"\\\\
0
\"\r\n
"
"
\"
Wine5b
\"
=
\"\\\\
0
\\\\
0
\"\r\n
"
"
\"
Wine5c
\"
=
\"
Value1
\\\\
0
\"\r\n
"
"
\"
Wine5d
\"
=
\"
Value2
\\\\
0
\\\\
0
\\\\
0
\\\\
0
\"\r\n
"
"
\"
Wine5e
\"
=
\"
Value3
\\\\
0Value4
\"\r\n
"
"
\"
Wine5f
\"
=
\"\\\\
0Value5
\"\r\n\r\n
"
;
delete_tree
(
HKEY_CURRENT_USER
,
KEY_BASE
);
verify_key_nonexist
(
HKEY_CURRENT_USER
,
KEY_BASE
);
...
...
programs/reg/tests/reg_test.h
View file @
baf0254b
...
...
@@ -84,6 +84,9 @@ extern const char *complex_data_test;
extern
const
char
*
empty_hex_test
;
extern
const
char
*
empty_hex_test2
;
extern
const
char
*
hex_types_test
;
extern
const
char
*
slashes_test
;
extern
const
char
*
embedded_null_test
;
extern
const
char
*
escaped_null_test
;
/* import.c */
#define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,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