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
4bf9d240
Commit
4bf9d240
authored
Jul 06, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix the return value of NtQueryKey for a short buffer.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
41751e61
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
reg.c
dlls/ntdll/tests/reg.c
+15
-1
registry.c
dlls/ntdll/unix/registry.c
+2
-6
No files found.
dlls/ntdll/tests/reg.c
View file @
4bf9d240
...
...
@@ -1817,10 +1817,23 @@ static void test_NtQueryKey(void)
pNtClose
(
key
);
return
;
}
todo_wine
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
length
);
/* non-zero buffer size, but insufficient */
len
=
0
;
status
=
pNtQueryKey
(
key
,
KeyNameInformation
,
info
,
1
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
length
==
len
,
"got %ld, expected %ld
\n
"
,
len
,
length
);
len
=
0
;
status
=
pNtQueryKey
(
key
,
KeyNameInformation
,
info
,
offsetof
(
KEY_NAME_INFORMATION
,
Name
)
-
1
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
length
==
len
,
"got %ld, expected %ld
\n
"
,
len
,
length
);
len
=
0
;
status
=
pNtQueryKey
(
key
,
KeyNameInformation
,
info
,
offsetof
(
KEY_NAME_INFORMATION
,
Name
),
&
len
);
ok
(
status
==
STATUS_BUFFER_OVERFLOW
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
length
==
len
,
"got %ld, expected %ld
\n
"
,
len
,
length
);
len
=
0
;
status
=
pNtQueryKey
(
key
,
KeyNameInformation
,
info
,
sizeof
(
*
info
),
&
len
);
ok
(
status
==
STATUS_BUFFER_OVERFLOW
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
length
==
len
,
"got %ld, expected %ld
\n
"
,
len
,
length
);
...
...
@@ -1828,6 +1841,7 @@ static void test_NtQueryKey(void)
info
->
NameLength
,
winetestpath
.
Length
);
/* correct buffer size */
len
=
0
;
status
=
pNtQueryKey
(
key
,
KeyNameInformation
,
info
,
length
,
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryKey Failed: 0x%08lx
\n
"
,
status
);
ok
(
length
==
len
,
"got %ld, expected %ld
\n
"
,
len
,
length
);
...
...
dlls/ntdll/unix/registry.c
View file @
4bf9d240
...
...
@@ -268,7 +268,6 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
case
KeyBasicInformation
:
{
KEY_BASIC_INFORMATION
keyinfo
;
fixed_size
=
(
char
*
)
keyinfo
.
Name
-
(
char
*
)
&
keyinfo
;
keyinfo
.
LastWriteTime
.
QuadPart
=
reply
->
modif
;
keyinfo
.
TitleIndex
=
0
;
keyinfo
.
NameLength
=
reply
->
namelen
;
...
...
@@ -279,7 +278,6 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
case
KeyFullInformation
:
{
KEY_FULL_INFORMATION
keyinfo
;
fixed_size
=
(
char
*
)
keyinfo
.
Class
-
(
char
*
)
&
keyinfo
;
keyinfo
.
LastWriteTime
.
QuadPart
=
reply
->
modif
;
keyinfo
.
TitleIndex
=
0
;
keyinfo
.
ClassLength
=
wine_server_reply_size
(
reply
);
...
...
@@ -297,7 +295,6 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
case
KeyNodeInformation
:
{
KEY_NODE_INFORMATION
keyinfo
;
fixed_size
=
(
char
*
)
keyinfo
.
Name
-
(
char
*
)
&
keyinfo
;
keyinfo
.
LastWriteTime
.
QuadPart
=
reply
->
modif
;
keyinfo
.
TitleIndex
=
0
;
if
(
reply
->
namelen
<
wine_server_reply_size
(
reply
))
...
...
@@ -318,7 +315,6 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
case
KeyNameInformation
:
{
KEY_NAME_INFORMATION
keyinfo
;
fixed_size
=
(
char
*
)
keyinfo
.
Name
-
(
char
*
)
&
keyinfo
;
keyinfo
.
NameLength
=
reply
->
namelen
;
memcpy
(
info
,
&
keyinfo
,
min
(
length
,
fixed_size
)
);
break
;
...
...
@@ -327,7 +323,6 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
case
KeyCachedInformation
:
{
KEY_CACHED_INFORMATION
keyinfo
;
fixed_size
=
sizeof
(
keyinfo
);
keyinfo
.
LastWriteTime
.
QuadPart
=
reply
->
modif
;
keyinfo
.
TitleIndex
=
0
;
keyinfo
.
SubKeys
=
reply
->
subkeys
;
...
...
@@ -344,7 +339,8 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
break
;
}
*
result_len
=
fixed_size
+
reply
->
total
;
if
(
length
<
*
result_len
)
ret
=
STATUS_BUFFER_OVERFLOW
;
if
(
length
<
fixed_size
)
ret
=
STATUS_BUFFER_TOO_SMALL
;
else
if
(
length
<
*
result_len
)
ret
=
STATUS_BUFFER_OVERFLOW
;
}
}
SERVER_END_REQ
;
...
...
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