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
7cd90766
Commit
7cd90766
authored
Apr 19, 2018
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit/tests: Add tests for values with embedded null characters.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6bca0abb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
regedit.c
programs/regedit/tests/regedit.c
+74
-0
No files found.
programs/regedit/tests/regedit.c
View file @
7cd90766
...
...
@@ -1638,6 +1638,22 @@ static void test_invalid_import(void)
verify_reg_nonexist
(
hkey
,
"Wine32a"
);
verify_reg_nonexist
(
hkey
,
"Wine32b"
);
/* Test with embedded null characters */
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\n
"
"
\"
Wine33a
\"
=
\"\\
0
\n
"
"
\"
Wine33b
\"
=
\"\\
0
\\
0
\n
"
"
\"
Wine33c
\"
=
\"
Value1
\\
0
\n
"
"
\"
Wine33d
\"
=
\"
Value2
\\
0
\\
0
\\
0
\\
0
\n
"
"
\"
Wine33e
\"
=
\"
Value3
\\
0Value4
\n
"
"
\"
Wine33f
\"
=
\"\\
0Value4
\n\n
"
);
verify_reg_nonexist
(
hkey
,
"Wine33a"
);
verify_reg_nonexist
(
hkey
,
"Wine33b"
);
verify_reg_nonexist
(
hkey
,
"Wine33c"
);
verify_reg_nonexist
(
hkey
,
"Wine33d"
);
verify_reg_nonexist
(
hkey
,
"Wine33e"
);
verify_reg_nonexist
(
hkey
,
"Wine33f"
);
RegCloseKey
(
hkey
);
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
...
...
@@ -2134,6 +2150,22 @@ static void test_invalid_import_unicode(void)
verify_reg_nonexist
(
hkey
,
"Wine32a"
);
verify_reg_nonexist
(
hkey
,
"Wine32b"
);
/* Test with embedded null characters */
exec_import_wstr
(
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\n
"
"
\"
Wine33a
\"
=
\"\\
0
\n
"
"
\"
Wine33b
\"
=
\"\\
0
\\
0
\n
"
"
\"
Wine33c
\"
=
\"
Value1
\\
0
\n
"
"
\"
Wine33d
\"
=
\"
Value2
\\
0
\\
0
\\
0
\\
0
\n
"
"
\"
Wine33e
\"
=
\"
Value3
\\
0Value4
\n
"
"
\"
Wine33f
\"
=
\"\\
0Value4
\n\n
"
);
verify_reg_nonexist
(
hkey
,
"Wine33a"
);
verify_reg_nonexist
(
hkey
,
"Wine33b"
);
verify_reg_nonexist
(
hkey
,
"Wine33c"
);
verify_reg_nonexist
(
hkey
,
"Wine33d"
);
verify_reg_nonexist
(
hkey
,
"Wine33e"
);
verify_reg_nonexist
(
hkey
,
"Wine33f"
);
RegCloseKey
(
hkey
);
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
...
...
@@ -3483,6 +3515,18 @@ static void test_export(void)
"
\"
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
"
;
lr
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
KEY_BASE
);
ok
(
lr
==
ERROR_SUCCESS
||
lr
==
ERROR_FILE_NOT_FOUND
,
"RegDeleteKeyA failed: %d
\n
"
,
lr
);
...
...
@@ -3600,6 +3644,7 @@ static void test_export(void)
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
/* Test registry export with embedded null characters */
exec_import_wstr
(
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\n
"
"
\"
Wine3a
\"
=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00
\n
"
...
...
@@ -3617,6 +3662,35 @@ static void test_export(void)
ok
(
compare_export
(
"file.reg"
,
hex_types_test
,
0
),
"compare_export() failed
\n
"
);
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
exec_import_wstr
(
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\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
"
);
open_key
(
HKEY_CURRENT_USER
,
KEY_BASE
,
0
,
&
hkey
);
dword
=
0x5
;
verify_reg
(
hkey
,
"Wine4a"
,
REG_DWORD
,
&
dword
,
sizeof
(
dword
),
0
);
verify_reg
(
hkey
,
"Wine4b"
,
REG_SZ
,
"
\0\0\0\0\0\0\0
"
,
4
,
0
);
verify_reg
(
hkey
,
"Wine4c"
,
REG_SZ
,
"Value"
,
6
,
0
);
verify_reg
(
hkey
,
"Wine4d"
,
REG_SZ
,
"
\0
abc"
,
5
,
TODO_REG_SIZE
);
dword
=
0x100
;
verify_reg
(
hkey
,
"Wine4e"
,
REG_DWORD
,
&
dword
,
sizeof
(
dword
),
0
);
verify_reg
(
hkey
,
"Wine4f"
,
REG_SZ
,
"
\0
Value"
,
7
,
0
);
verify_reg
(
hkey
,
"Wine4g"
,
REG_SZ
,
"Value2"
,
7
,
0
);
verify_reg
(
hkey
,
"Wine4h"
,
REG_SZ
,
"abc
\0
def"
,
8
,
0
);
RegCloseKey
(
hkey
);
run_regedit_exe
(
"regedit.exe /e file.reg HKEY_CURRENT_USER
\\
"
KEY_BASE
);
ok
(
compare_export
(
"file.reg"
,
embedded_null_test
,
TODO_REG_COMPARE
),
"compare_export() failed
\n
"
);
delete_key
(
HKEY_CURRENT_USER
,
KEY_BASE
);
}
START_TEST
(
regedit
)
...
...
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