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
bba76fca
Commit
bba76fca
authored
Jul 24, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash on NULL data in RegSetValueExA (reported by Mike Hearn and
Andreas Mohr). Removed a couple of unnecessary version checks.
parent
d0e5b8e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
registry.c
dlls/advapi32/registry.c
+11
-20
registry.c
dlls/advapi32/tests/registry.c
+11
-0
No files found.
dlls/advapi32/registry.c
View file @
bba76fca
...
...
@@ -868,16 +868,6 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
}
else
if
(
!
(
ret
=
RegOpenKeyExW
(
hkey
,
name
,
0
,
KEY_ENUMERATE_SUB_KEYS
,
&
tmp
)))
{
if
(
!
is_version_nt
())
/* win95 does recursive key deletes */
{
WCHAR
name
[
MAX_PATH
];
while
(
!
RegEnumKeyW
(
tmp
,
0
,
name
,
sizeof
(
name
)))
{
if
(
RegDeleteKeyW
(
tmp
,
name
))
/* recurse */
break
;
}
}
ret
=
RtlNtStatusToDosError
(
NtDeleteKey
(
tmp
)
);
RegCloseKey
(
tmp
);
}
...
...
@@ -947,21 +937,14 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
* RETURNS
* Success: ERROR_SUCCESS
* Failure: Error code
*
* NOTES
* win95 does not care about count for REG_SZ and finds out the len by itself (js)
* NT does definitely care (aj)
*/
DWORD
WINAPI
RegSetValueExW
(
HKEY
hkey
,
LPCWSTR
name
,
DWORD
reserved
,
DWORD
type
,
CONST
BYTE
*
data
,
DWORD
count
)
{
UNICODE_STRING
nameW
;
if
(
!
is_version_nt
())
/* win95 */
{
if
(
type
==
REG_SZ
)
count
=
(
strlenW
(
(
WCHAR
*
)
data
)
+
1
)
*
sizeof
(
WCHAR
);
}
else
if
(
count
&&
is_string
(
type
))
/* no need for version check, not implemented on win9x anyway */
if
(
count
&&
is_string
(
type
))
{
LPCWSTR
str
=
(
LPCWSTR
)
data
;
/* if user forgot to count terminating null, add it (yes NT does this) */
...
...
@@ -979,6 +962,10 @@ DWORD WINAPI RegSetValueExW( HKEY hkey, LPCWSTR name, DWORD reserved,
* RegSetValueExA [ADVAPI32.@]
*
* see RegSetValueExW
*
* NOTES
* win95 does not care about count for REG_SZ and finds out the len by itself (js)
* NT does definitely care (aj)
*/
DWORD
WINAPI
RegSetValueExA
(
HKEY
hkey
,
LPCSTR
name
,
DWORD
reserved
,
DWORD
type
,
CONST
BYTE
*
data
,
DWORD
count
)
...
...
@@ -989,7 +976,11 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type,
if
(
!
is_version_nt
())
/* win95 */
{
if
(
type
==
REG_SZ
)
count
=
strlen
(
data
)
+
1
;
if
(
type
==
REG_SZ
)
{
if
(
!
data
)
return
ERROR_INVALID_PARAMETER
;
count
=
strlen
(
data
)
+
1
;
}
}
else
if
(
count
&&
is_string
(
type
))
{
...
...
dlls/advapi32/tests/registry.c
View file @
bba76fca
...
...
@@ -67,6 +67,17 @@ static void test_enum_value(void)
static
const
WCHAR
testW
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
xxxW
[]
=
{
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
0
};
/* check NULL data with zero length */
res
=
RegSetValueExA
(
hkey_main
,
"Test"
,
0
,
REG_SZ
,
NULL
,
0
);
if
(
GetVersion
()
&
0x80000000
)
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"RegSetValueExA returned %ld
\n
"
,
res
);
else
ok
(
!
res
,
"RegSetValueExA returned %ld
\n
"
,
res
);
res
=
RegSetValueExA
(
hkey_main
,
"Test"
,
0
,
REG_EXPAND_SZ
,
NULL
,
0
);
ok
(
!
res
,
"RegSetValueExA returned %ld
\n
"
,
res
);
res
=
RegSetValueExA
(
hkey_main
,
"Test"
,
0
,
REG_BINARY
,
NULL
,
0
);
ok
(
!
res
,
"RegSetValueExA returned %ld
\n
"
,
res
);
res
=
RegSetValueExA
(
hkey_main
,
"Test"
,
0
,
REG_SZ
,
(
BYTE
*
)
"foobar"
,
7
);
ok
(
res
==
0
,
"RegSetValueExA failed error %ld
\n
"
,
res
);
...
...
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