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
eecd136c
Commit
eecd136c
authored
Jun 30, 2015
by
Bernhard Übelacker
Committed by
Alexandre Julliard
Jul 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fail in RegEnumValue on missing value or val_count parameters.
parent
94c6e3af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
+56
-4
registry.c
dlls/advapi32/registry.c
+4
-4
registry.c
dlls/advapi32/tests/registry.c
+52
-0
No files found.
dlls/advapi32/registry.c
View file @
eecd136c
...
...
@@ -1912,8 +1912,8 @@ LSTATUS WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_
TRACE
(
"(%p,%d,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
index
,
value
,
val_count
,
reserved
,
type
,
data
,
count
);
/* NT only checks count, not val_count */
if
((
data
&&
!
count
)
||
reserved
)
return
ERROR_INVALID_PARAMETER
;
if
((
data
&&
!
count
)
||
reserved
||
!
value
||
!
val_count
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
total_size
=
info_size
+
(
MAX_PATH
+
1
)
*
sizeof
(
WCHAR
);
...
...
@@ -1997,8 +1997,8 @@ LSTATUS WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_c
TRACE
(
"(%p,%d,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
index
,
value
,
val_count
,
reserved
,
type
,
data
,
count
);
/* NT only checks count, not val_count */
if
((
data
&&
!
count
)
||
reserved
)
return
ERROR_INVALID_PARAMETER
;
if
((
data
&&
!
count
)
||
reserved
||
!
value
||
!
val_count
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
total_size
=
info_size
+
(
MAX_PATH
+
1
)
*
sizeof
(
WCHAR
);
...
...
dlls/advapi32/tests/registry.c
View file @
eecd136c
...
...
@@ -643,6 +643,32 @@ static void test_enum_value(void)
ok
(
!
strcmp
(
value
,
"Test"
),
"value is '%s' instead of Test
\n
"
,
value
);
ok
(
!
strcmp
(
data
,
"foobar"
),
"data is '%s' instead of foobar
\n
"
,
data
);
if
(
pRegGetValueA
)
/* avoid a crash on Windows 2000 */
{
/* no value and no val_count parameter */
data_count
=
20
;
type
=
1234
;
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
test_key
,
0
,
NULL
,
NULL
,
NULL
,
&
type
,
(
BYTE
*
)
data
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
/* no value parameter */
val_count
=
20
;
data_count
=
20
;
type
=
1234
;
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
test_key
,
0
,
NULL
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
data
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
/* no val_count parameter */
data_count
=
20
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
test_key
,
0
,
value
,
NULL
,
NULL
,
&
type
,
(
BYTE
*
)
data
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
}
/* Unicode tests */
SetLastError
(
0xdeadbeef
);
...
...
@@ -710,6 +736,32 @@ static void test_enum_value(void)
ok
(
!
memcmp
(
valueW
,
testW
,
sizeof
(
testW
)
),
"value is not 'Test'
\n
"
);
ok
(
!
memcmp
(
dataW
,
foobarW
,
sizeof
(
foobarW
)
),
"data is not 'foobar'
\n
"
);
if
(
pRegGetValueA
)
/* avoid a crash on Windows 2000 */
{
/* no valueW and no val_count parameter */
data_count
=
20
;
type
=
1234
;
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
test_key
,
0
,
NULL
,
NULL
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
/* no valueW parameter */
val_count
=
20
;
data_count
=
20
;
type
=
1234
;
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
test_key
,
0
,
NULL
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
/* no val_count parameter */
data_count
=
20
;
type
=
1234
;
memcpy
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
);
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
test_key
,
0
,
valueW
,
NULL
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
res
);
}
cleanup:
RegDeleteKeyA
(
test_key
,
""
);
RegCloseKey
(
test_key
);
...
...
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