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
927525a9
Commit
927525a9
authored
Jan 15, 2000
by
Juergen Schmied
Committed by
Alexandre Julliard
Jan 15, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If there is enough space in the buffer and the type is REG_SZ and the
string is not 0-terminated RegQueryValue and RegEnumValue are appending a 0.
parent
6665ad40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
registry.c
dlls/advapi32/registry.c
+18
-6
No files found.
dlls/advapi32/registry.c
View file @
927525a9
...
@@ -55,8 +55,11 @@ static inline int is_string( DWORD type )
...
@@ -55,8 +55,11 @@ static inline int is_string( DWORD type )
* 'len' is the total length of the data
* 'len' is the total length of the data
* 'count' is the size of the user-specified buffer
* 'count' is the size of the user-specified buffer
* and is updated to reflect the length copied
* and is updated to reflect the length copied
*
* if the type is REG_SZ and data is not 0-terminated and there is enough space in the
* buffer nt appends a \0
*/
*/
static
DWORD
copy_data
(
void
*
data
,
const
void
*
src
,
DWORD
len
,
DWORD
*
count
)
static
DWORD
copy_data
(
void
*
data
,
const
void
*
src
,
DWORD
len
,
DWORD
*
count
,
DWORD
type
)
{
{
DWORD
ret
=
ERROR_SUCCESS
;
DWORD
ret
=
ERROR_SUCCESS
;
if
(
data
)
if
(
data
)
...
@@ -64,7 +67,12 @@ static DWORD copy_data( void *data, const void *src, DWORD len, DWORD *count )
...
@@ -64,7 +67,12 @@ static DWORD copy_data( void *data, const void *src, DWORD len, DWORD *count )
if
(
*
count
<
len
)
ret
=
ERROR_MORE_DATA
;
if
(
*
count
<
len
)
ret
=
ERROR_MORE_DATA
;
else
memcpy
(
data
,
src
,
len
);
else
memcpy
(
data
,
src
,
len
);
}
}
if
(
count
)
*
count
=
len
;
if
(
count
)
{
if
(
is_string
(
type
)
&&
len
&&
(
len
<
*
count
)
&&
((
WCHAR
*
)
data
)[
len
-
1
])
((
WCHAR
*
)
data
)[
len
]
=
0
;
*
count
=
len
;
}
return
ret
;
return
ret
;
}
}
...
@@ -79,7 +87,11 @@ static DWORD copy_data_WtoA( void *data, const void *src, DWORD len, DWORD *coun
...
@@ -79,7 +87,11 @@ static DWORD copy_data_WtoA( void *data, const void *src, DWORD len, DWORD *coun
if
(
data
)
if
(
data
)
{
{
if
(
*
count
<
len
)
ret
=
ERROR_MORE_DATA
;
if
(
*
count
<
len
)
ret
=
ERROR_MORE_DATA
;
else
memcpyWtoA
(
data
,
src
,
len
);
else
if
(
len
)
{
memcpyWtoA
(
data
,
src
,
len
);
if
((
len
<
*
count
)
&&
((
char
*
)
data
)[
len
-
1
])
((
char
*
)
data
)[
len
]
=
0
;
}
}
}
}
}
else
if
(
data
)
else
if
(
data
)
...
@@ -131,7 +143,7 @@ static inline DWORD copy_nameAtoW( LPWSTR dest, LPCSTR name )
...
@@ -131,7 +143,7 @@ static inline DWORD copy_nameAtoW( LPWSTR dest, LPCSTR name )
* dispos [O] Receives REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY
* dispos [O] Receives REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY
*
*
* NOTES
* NOTES
* in case of failing re
mains retkey
untouched
* in case of failing re
tkey remains
untouched
*/
*/
DWORD
WINAPI
RegCreateKeyExW
(
HKEY
hkey
,
LPCWSTR
name
,
DWORD
reserved
,
LPWSTR
class
,
DWORD
WINAPI
RegCreateKeyExW
(
HKEY
hkey
,
LPCWSTR
name
,
DWORD
reserved
,
LPWSTR
class
,
DWORD
options
,
REGSAM
access
,
SECURITY_ATTRIBUTES
*
sa
,
DWORD
options
,
REGSAM
access
,
SECURITY_ATTRIBUTES
*
sa
,
...
@@ -746,7 +758,7 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDWOR
...
@@ -746,7 +758,7 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDWOR
if
((
ret
=
server_call_noerr
(
REQ_GET_KEY_VALUE
))
==
ERROR_SUCCESS
)
if
((
ret
=
server_call_noerr
(
REQ_GET_KEY_VALUE
))
==
ERROR_SUCCESS
)
{
{
if
(
type
)
*
type
=
req
->
type
;
if
(
type
)
*
type
=
req
->
type
;
ret
=
copy_data
(
data
,
req
->
data
,
req
->
len
,
count
);
ret
=
copy_data
(
data
,
req
->
data
,
req
->
len
,
count
,
req
->
type
);
}
}
return
ret
;
return
ret
;
}
}
...
@@ -870,7 +882,7 @@ DWORD WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_co
...
@@ -870,7 +882,7 @@ DWORD WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_co
*
val_count
=
len
-
1
;
*
val_count
=
len
-
1
;
if
(
type
)
*
type
=
req
->
type
;
if
(
type
)
*
type
=
req
->
type
;
return
copy_data
(
data
,
req
->
data
,
req
->
len
,
count
);
return
copy_data
(
data
,
req
->
data
,
req
->
len
,
count
,
req
->
type
);
}
}
...
...
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