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
aa9d2a7c
Commit
aa9d2a7c
authored
Feb 15, 2016
by
Hugh McMaster
Committed by
Alexandre Julliard
Feb 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Abort the process if get_regdata returns NULL.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
07c6b139
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
23 deletions
+26
-23
reg.c
programs/reg/reg.c
+5
-2
reg.c
programs/reg/tests/reg.c
+21
-21
No files found.
programs/reg/reg.c
View file @
aa9d2a7c
...
...
@@ -379,8 +379,11 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
return
1
;
}
if
(
data
)
reg_data
=
get_regdata
(
data
,
reg_type
,
separator
,
&
reg_count
);
if
(
data
&&
!
(
reg_data
=
get_regdata
(
data
,
reg_type
,
separator
,
&
reg_count
)))
{
RegCloseKey
(
subkey
);
return
1
;
}
RegSetValueExW
(
subkey
,
value_name
,
0
,
reg_type
,
reg_data
,
reg_count
);
HeapFree
(
GetProcessHeap
(),
0
,
reg_data
);
...
...
programs/reg/tests/reg.c
View file @
aa9d2a7c
...
...
@@ -215,11 +215,11 @@ static void test_add(void)
verify_reg
(
hkey
,
""
,
REG_BINARY
,
&
dword
,
sizeof
(
DWORD
),
0
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_BINARY /v bin2 /f /d x01"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_BINARY /v bin3 /f /d 01x"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
...
...
@@ -260,9 +260,9 @@ static void test_add(void)
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
/* WinXP */
),
"got exit code %d, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v dword2 /t REG_DWORD /d zzz /f"
,
&
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 dword3 /t REG_DWORD /d deadbeef /f"
,
&
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 dword4 /t REG_DWORD /d 123xyz /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
...
...
@@ -314,43 +314,43 @@ static void test_add(void)
/* REG_MULTI_SZ */
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v multi0 /t REG_MULTI_SZ /d
\"
three
\\
0little
\\
0strings
\"
/f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
memcpy
(
buffer
,
"three
\0
little
\0
strings
\0
"
,
22
);
verify_reg
(
hkey
,
"multi0"
,
REG_MULTI_SZ
,
buffer
,
22
,
TODO_REG_SIZE
);
todo_wine
verify_reg
(
hkey
,
"multi0"
,
REG_MULTI_SZ
,
buffer
,
22
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi1 /s
\"
#
\"
/d
\"
three#little#strings
\"
/f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
verify_reg
(
hkey
,
"multi1"
,
REG_MULTI_SZ
,
buffer
,
22
,
TODO_REG_SIZE
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
todo_wine
verify_reg
(
hkey
,
"multi1"
,
REG_MULTI_SZ
,
buffer
,
22
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi2 /d
\"\"
/f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
verify_reg
(
hkey
,
"multi2"
,
REG_MULTI_SZ
,
&
buffer
[
21
],
1
,
TODO_REG_SIZE
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
todo_wine
verify_reg
(
hkey
,
"multi2"
,
REG_MULTI_SZ
,
&
buffer
[
21
],
1
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi3 /f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
verify_reg
(
hkey
,
"multi3"
,
REG_MULTI_SZ
,
&
buffer
[
21
],
1
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi4 /s
\"
#
\"
/d
\"
threelittlestrings
\"
/f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
verify_reg
(
hkey
,
"multi4"
,
REG_MULTI_SZ
,
"threelittlestrings
\0
"
,
20
,
TODO_REG_SIZE
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
todo_wine
verify_reg
(
hkey
,
"multi4"
,
REG_MULTI_SZ
,
"threelittlestrings
\0
"
,
20
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi5 /s
\"
#randomgibberish
\"
/d
\"
three#little#strings
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi6 /s
\"\\
0
\"
/d
\"
three
\\
0little
\\
0strings
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi7 /s
\"\"
/d
\"
three#little#strings
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi8 /s
\"
#
\"
/d
\"
##
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi9 /s
\"
#
\"
/d
\"
two##strings
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi10 /s
\"
#
\"
/d
\"
#a
\"
/f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /t REG_MULTI_SZ /v multi11 /s
\"
#
\"
/d
\"
a#
\"
/f"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %u
\n
"
,
r
);
buffer
[
0
]
=
'a'
;
buffer
[
1
]
=
0
;
buffer
[
2
]
=
0
;
verify_reg
(
hkey
,
"multi11"
,
REG_MULTI_SZ
,
buffer
,
3
,
TODO_REG_SIZE
);
todo_wine
verify_reg
(
hkey
,
"multi11"
,
REG_MULTI_SZ
,
buffer
,
3
,
TODO_REG_SIZE
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v multi12 /t REG_MULTI_SZ /f /d"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
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