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
c6615832
Commit
c6615832
authored
Feb 14, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always return success instead of overflow if caller didn't specify a
buffer.
parent
1da4707f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
73 deletions
+73
-73
registry.c
dlls/advapi32/registry.c
+73
-73
No files found.
dlls/advapi32/registry.c
View file @
c6615832
...
...
@@ -447,6 +447,7 @@ DWORD WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPDWO
return
ERROR_INVALID_PARAMETER
;
status
=
NtQueryKey
(
hkey
,
KeyFullInformation
,
buffer
,
sizeof
(
buffer
),
&
total_size
);
if
(
status
&&
status
!=
STATUS_BUFFER_OVERFLOW
)
goto
done
;
if
(
class
)
{
...
...
@@ -460,32 +461,30 @@ DWORD WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPDWO
status
=
NtQueryKey
(
hkey
,
KeyFullInformation
,
buf_ptr
,
total_size
,
&
total_size
);
}
if
(
!
status
)
if
(
status
)
goto
done
;
if
(
class_len
&&
(
info
->
ClassLength
/
sizeof
(
WCHAR
)
+
1
>
*
class_len
))
{
if
(
class_len
&&
(
info
->
ClassLength
/
sizeof
(
WCHAR
)
+
1
>
*
class_len
))
{
status
=
STATUS_BUFFER_OVERFLOW
;
}
else
{
memcpy
(
class
,
buf_ptr
+
info
->
ClassOffset
,
info
->
ClassLength
);
class
[
info
->
ClassLength
/
sizeof
(
WCHAR
)]
=
0
;
}
status
=
STATUS_BUFFER_OVERFLOW
;
}
else
{
memcpy
(
class
,
buf_ptr
+
info
->
ClassOffset
,
info
->
ClassLength
);
class
[
info
->
ClassLength
/
sizeof
(
WCHAR
)]
=
0
;
}
}
else
status
=
STATUS_SUCCESS
;
if
(
!
status
||
status
==
STATUS_BUFFER_OVERFLOW
)
{
if
(
class_len
)
*
class_len
=
info
->
ClassLength
/
sizeof
(
WCHAR
);
if
(
subkeys
)
*
subkeys
=
info
->
SubKeys
;
if
(
max_subkey
)
*
max_subkey
=
info
->
MaxNameLen
;
if
(
max_class
)
*
max_class
=
info
->
MaxClassLen
;
if
(
values
)
*
values
=
info
->
Values
;
if
(
max_value
)
*
max_value
=
info
->
MaxValueNameLen
;
if
(
max_data
)
*
max_data
=
info
->
MaxValueDataLen
;
if
(
modif
)
*
modif
=
info
->
LastWriteTime
;
}
if
(
class_len
)
*
class_len
=
info
->
ClassLength
/
sizeof
(
WCHAR
);
if
(
subkeys
)
*
subkeys
=
info
->
SubKeys
;
if
(
max_subkey
)
*
max_subkey
=
info
->
MaxNameLen
;
if
(
max_class
)
*
max_class
=
info
->
MaxClassLen
;
if
(
values
)
*
values
=
info
->
Values
;
if
(
max_value
)
*
max_value
=
info
->
MaxValueNameLen
;
if
(
max_data
)
*
max_data
=
info
->
MaxValueDataLen
;
if
(
modif
)
*
modif
=
info
->
LastWriteTime
;
done:
if
(
buf_ptr
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
buf_ptr
);
return
RtlNtStatusToDosError
(
status
);
}
...
...
@@ -502,7 +501,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
NTSTATUS
status
;
char
buffer
[
256
],
*
buf_ptr
=
buffer
;
KEY_FULL_INFORMATION
*
info
=
(
KEY_FULL_INFORMATION
*
)
buffer
;
DWORD
total_size
;
DWORD
total_size
,
len
;
TRACE
(
"(0x%x,%p,%ld,%p,%p,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
class
,
class_len
?
*
class_len
:
0
,
reserved
,
subkeys
,
max_subkey
,
values
,
max_value
,
max_data
,
security
,
modif
);
...
...
@@ -511,6 +510,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
return
ERROR_INVALID_PARAMETER
;
status
=
NtQueryKey
(
hkey
,
KeyFullInformation
,
buffer
,
sizeof
(
buffer
),
&
total_size
);
if
(
status
&&
status
!=
STATUS_BUFFER_OVERFLOW
)
goto
done
;
if
(
class
||
class_len
)
{
...
...
@@ -524,39 +524,37 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
status
=
NtQueryKey
(
hkey
,
KeyFullInformation
,
buf_ptr
,
total_size
,
&
total_size
);
}
if
(
!
status
)
if
(
status
)
goto
done
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
class_len
)
{
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
class_len
)
{
if
(
len
+
1
>
*
class_len
)
status
=
STATUS_BUFFER_OVERFLOW
;
*
class_len
=
len
;
}
if
(
class
&&
!
status
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
/
sizeof
(
WCHAR
),
class
,
len
,
NULL
,
NULL
);
class
[
len
]
=
0
;
}
if
(
len
+
1
>
*
class_len
)
status
=
STATUS_BUFFER_OVERFLOW
;
*
class_len
=
len
;
}
if
(
class
&&
!
status
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
/
sizeof
(
WCHAR
),
class
,
len
,
NULL
,
NULL
);
class
[
len
]
=
0
;
}
}
else
status
=
STATUS_SUCCESS
;
if
(
!
status
||
status
==
STATUS_BUFFER_OVERFLOW
)
{
if
(
subkeys
)
*
subkeys
=
info
->
SubKeys
;
if
(
max_subkey
)
*
max_subkey
=
info
->
MaxNameLen
;
if
(
max_class
)
*
max_class
=
info
->
MaxClassLen
;
if
(
values
)
*
values
=
info
->
Values
;
if
(
max_value
)
*
max_value
=
info
->
MaxValueNameLen
;
if
(
max_data
)
*
max_data
=
info
->
MaxValueDataLen
;
if
(
modif
)
*
modif
=
info
->
LastWriteTime
;
}
if
(
subkeys
)
*
subkeys
=
info
->
SubKeys
;
if
(
max_subkey
)
*
max_subkey
=
info
->
MaxNameLen
;
if
(
max_class
)
*
max_class
=
info
->
MaxClassLen
;
if
(
values
)
*
values
=
info
->
Values
;
if
(
max_value
)
*
max_value
=
info
->
MaxValueNameLen
;
if
(
max_data
)
*
max_data
=
info
->
MaxValueDataLen
;
if
(
modif
)
*
modif
=
info
->
LastWriteTime
;
done:
if
(
buf_ptr
!=
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
buf_ptr
);
return
RtlNtStatusToDosError
(
status
);
}
...
...
@@ -821,6 +819,7 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDWOR
}
else
if
(
status
!=
STATUS_BUFFER_OVERFLOW
)
goto
done
;
}
else
status
=
STATUS_SUCCESS
;
if
(
type
)
*
type
=
info
->
Type
;
if
(
count
)
*
count
=
total_size
-
info_size
;
...
...
@@ -880,36 +879,35 @@ DWORD WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWORD
buf_ptr
,
total_size
,
&
total_size
);
}
if
(
!
status
)
if
(
status
)
goto
done
;
if
(
is_string
(
info
->
Type
))
{
if
(
is_string
(
info
->
Type
))
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info_size
),
(
total_size
-
info_size
)
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
data
&&
len
)
{
DWORD
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info_size
),
(
total_size
-
info_size
)
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
data
&&
len
)
if
(
len
>
*
count
)
status
=
STATUS_BUFFER_OVERFLOW
;
else
{
if
(
len
>
*
count
)
status
=
STATUS_BUFFER_OVERFLOW
;
else
{
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info_size
),
(
total_size
-
info_size
)
/
sizeof
(
WCHAR
),
data
,
len
,
NULL
,
NULL
);
/* if the type is REG_SZ and data is not 0-terminated
* and there is enough space in the buffer NT appends a \0 */
if
(
len
<
*
count
&&
data
[
len
-
1
])
data
[
len
]
=
0
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
(
WCHAR
*
)(
buf_ptr
+
info_size
),
(
total_size
-
info_size
)
/
sizeof
(
WCHAR
),
data
,
len
,
NULL
,
NULL
);
/* if the type is REG_SZ and data is not 0-terminated
* and there is enough space in the buffer NT appends a \0 */
if
(
len
<
*
count
&&
data
[
len
-
1
])
data
[
len
]
=
0
;
}
total_size
=
len
+
info_size
;
}
else
if
(
data
)
{
if
(
total_size
-
info_size
>
*
count
)
status
=
STATUS_BUFFER_OVERFLOW
;
else
memcpy
(
data
,
buf_ptr
+
info_size
,
total_size
-
info_size
);
}
total_size
=
len
+
info_size
;
}
else
if
(
data
)
{
if
(
total_size
-
info_size
>
*
count
)
status
=
STATUS_BUFFER_OVERFLOW
;
else
memcpy
(
data
,
buf_ptr
+
info_size
,
total_size
-
info_size
);
}
else
if
(
status
!=
STATUS_BUFFER_OVERFLOW
)
goto
done
;
}
else
status
=
STATUS_SUCCESS
;
if
(
type
)
*
type
=
info
->
Type
;
if
(
count
)
*
count
=
total_size
-
info_size
;
...
...
@@ -1056,6 +1054,7 @@ DWORD WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_co
}
}
}
else
status
=
STATUS_SUCCESS
;
if
(
type
)
*
type
=
info
->
Type
;
if
(
count
)
*
count
=
info
->
DataLength
;
...
...
@@ -1151,6 +1150,7 @@ DWORD WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_cou
else
memcpy
(
data
,
buf_ptr
+
info
->
DataOffset
,
total_size
-
info
->
DataOffset
);
}
}
else
status
=
STATUS_SUCCESS
;
if
(
type
)
*
type
=
info
->
Type
;
if
(
count
)
*
count
=
info
->
DataLength
;
...
...
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