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
6fe37f35
Commit
6fe37f35
authored
Jan 30, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add tests for the length of the object attributes structure.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b93c78dc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
21 deletions
+63
-21
reg.c
dlls/ntdll/reg.c
+0
-1
sync.c
dlls/ntdll/sync.c
+3
-1
file.c
dlls/ntdll/tests/file.c
+0
-19
om.c
dlls/ntdll/tests/om.c
+60
-0
No files found.
dlls/ntdll/reg.c
View file @
6fe37f35
...
...
@@ -129,7 +129,6 @@ NTSTATUS WINAPI NtOpenKeyEx( PHANDLE retkey, ACCESS_MASK access, const OBJECT_AT
NTSTATUS
ret
;
if
(
!
retkey
||
!
attr
||
!
attr
->
ObjectName
)
return
STATUS_ACCESS_VIOLATION
;
if
(
attr
->
Length
>
sizeof
(
OBJECT_ATTRIBUTES
))
return
STATUS_INVALID_PARAMETER
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
TRACE
(
"(%p,%s,%x,%p)
\n
"
,
attr
->
RootDirectory
,
...
...
dlls/ntdll/sync.c
View file @
6fe37f35
...
...
@@ -88,6 +88,8 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
if
(
!
attr
)
return
STATUS_SUCCESS
;
if
(
attr
->
Length
!=
sizeof
(
*
attr
))
return
STATUS_INVALID_PARAMETER
;
if
((
sd
=
attr
->
SecurityDescriptor
))
{
len
+=
sizeof
(
struct
security_descriptor
);
...
...
@@ -153,7 +155,7 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
NTSTATUS
validate_open_object_attributes
(
const
OBJECT_ATTRIBUTES
*
attr
)
{
if
(
!
attr
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
attr
||
attr
->
Length
!=
sizeof
(
*
attr
)
)
return
STATUS_INVALID_PARAMETER
;
if
(
attr
->
ObjectName
)
{
...
...
dlls/ntdll/tests/file.c
View file @
6fe37f35
...
...
@@ -1139,25 +1139,6 @@ static void nt_mailslot_test(void)
if
(
rc
==
STATUS_SUCCESS
)
pNtClose
(
hslot
);
/*
* Test that the length field is checked properly
*/
attr
.
Length
=
0
;
rc
=
pNtCreateMailslotFile
(
&
hslot
,
DesiredAccess
,
&
attr
,
&
IoStatusBlock
,
CreateOptions
,
MailslotQuota
,
MaxMessageSize
,
&
TimeOut
);
todo_wine
ok
(
rc
==
STATUS_INVALID_PARAMETER
,
"rc = %x not c000000d STATUS_INVALID_PARAMETER
\n
"
,
rc
);
if
(
rc
==
STATUS_SUCCESS
)
pNtClose
(
hslot
);
attr
.
Length
=
sizeof
(
OBJECT_ATTRIBUTES
)
+
1
;
rc
=
pNtCreateMailslotFile
(
&
hslot
,
DesiredAccess
,
&
attr
,
&
IoStatusBlock
,
CreateOptions
,
MailslotQuota
,
MaxMessageSize
,
&
TimeOut
);
todo_wine
ok
(
rc
==
STATUS_INVALID_PARAMETER
,
"rc = %x not c000000d STATUS_INVALID_PARAMETER
\n
"
,
rc
);
if
(
rc
==
STATUS_SUCCESS
)
pNtClose
(
hslot
);
/*
* Test a valid call
*/
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
...
...
dlls/ntdll/tests/om.c
View file @
6fe37f35
...
...
@@ -587,6 +587,16 @@ static void test_name_limits(void)
str
.
Length
=
67
;
test_all_kernel_objects
(
__LINE__
,
&
attr2
,
STATUS_OBJECT_NAME_INVALID
,
STATUS_OBJECT_NAME_INVALID
);
str
.
Length
=
128
;
for
(
attr
.
Length
=
0
;
attr
.
Length
<=
2
*
sizeof
(
attr
);
attr
.
Length
++
)
{
if
(
attr
.
Length
==
sizeof
(
attr
))
test_all_kernel_objects
(
__LINE__
,
&
attr
,
STATUS_SUCCESS
,
STATUS_SUCCESS
);
else
test_all_kernel_objects
(
__LINE__
,
&
attr
,
STATUS_INVALID_PARAMETER
,
STATUS_INVALID_PARAMETER
);
}
attr
.
Length
=
sizeof
(
attr
);
str
.
Length
=
65532
;
test_all_kernel_objects
(
__LINE__
,
&
attr
,
STATUS_SUCCESS
,
STATUS_SUCCESS
);
...
...
@@ -719,6 +729,20 @@ static void test_name_limits(void)
status
=
pNtCreateNamedPipeFile
(
&
ret
,
GENERIC_ALL
,
&
attr2
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
0
,
0
,
0
,
1
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_OBJECT_NAME_INVALID
,
"%u: NtCreateNamedPipeFile failed %x
\n
"
,
str
.
Length
,
status
);
str
.
Length
=
128
;
for
(
attr
.
Length
=
0
;
attr
.
Length
<=
2
*
sizeof
(
attr
);
attr
.
Length
++
)
{
status
=
pNtCreateNamedPipeFile
(
&
ret
,
GENERIC_ALL
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
0
,
0
,
0
,
1
,
256
,
256
,
&
timeout
);
if
(
attr
.
Length
==
sizeof
(
attr
))
{
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtCreateNamedPipeFile failed %x
\n
"
,
str
.
Length
,
status
);
pNtClose
(
ret
);
}
else
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"%u: NtCreateNamedPipeFile failed %x
\n
"
,
str
.
Length
,
status
);
}
attr
.
Length
=
sizeof
(
attr
);
str
.
Length
=
65532
;
status
=
pNtCreateNamedPipeFile
(
&
ret
,
GENERIC_ALL
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
0
,
0
,
0
,
1
,
256
,
256
,
&
timeout
);
...
...
@@ -754,6 +778,19 @@ static void test_name_limits(void)
str
.
Length
=
67
;
status
=
pNtCreateMailslotFile
(
&
ret
,
GENERIC_ALL
,
&
attr2
,
&
iosb
,
0
,
0
,
0
,
NULL
);
ok
(
status
==
STATUS_OBJECT_NAME_INVALID
,
"%u: NtCreateMailslotFile failed %x
\n
"
,
str
.
Length
,
status
);
str
.
Length
=
128
;
for
(
attr
.
Length
=
0
;
attr
.
Length
<=
2
*
sizeof
(
attr
);
attr
.
Length
++
)
{
status
=
pNtCreateMailslotFile
(
&
ret
,
GENERIC_ALL
,
&
attr
,
&
iosb
,
0
,
0
,
0
,
NULL
);
if
(
attr
.
Length
==
sizeof
(
attr
))
{
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtCreateMailslotFile failed %x
\n
"
,
str
.
Length
,
status
);
pNtClose
(
ret
);
}
else
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"%u: NtCreateMailslotFile failed %x
\n
"
,
str
.
Length
,
status
);
}
attr
.
Length
=
sizeof
(
attr
);
str
.
Length
=
65532
;
status
=
pNtCreateMailslotFile
(
&
ret
,
GENERIC_ALL
,
&
attr
,
&
iosb
,
0
,
0
,
0
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtCreateMailslotFile failed %x
\n
"
,
str
.
Length
,
status
);
...
...
@@ -810,6 +847,29 @@ static void test_name_limits(void)
pNtClose
(
ret2
);
pNtDeleteKey
(
ret
);
pNtClose
(
ret
);
str
.
Length
=
sizeof
(
registryW
)
+
256
*
sizeof
(
WCHAR
);
for
(
attr
.
Length
=
0
;
attr
.
Length
<=
2
*
sizeof
(
attr
);
attr
.
Length
++
)
{
if
(
attr
.
Length
==
sizeof
(
attr
))
{
status
=
pNtCreateKey
(
&
ret
,
GENERIC_ALL
,
&
attr
,
0
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtCreateKey failed %x
\n
"
,
str
.
Length
,
status
);
status
=
pNtOpenKey
(
&
ret2
,
KEY_READ
,
&
attr
);
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtOpenKey failed %x
\n
"
,
str
.
Length
,
status
);
pNtClose
(
ret2
);
pNtDeleteKey
(
ret
);
pNtClose
(
ret
);
}
else
{
status
=
pNtCreateKey
(
&
ret
,
GENERIC_ALL
,
&
attr
,
0
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"%u: NtCreateKey failed %x
\n
"
,
str
.
Length
,
status
);
status
=
pNtOpenKey
(
&
ret2
,
KEY_READ
,
&
attr
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"%u: NtOpenKey failed %x
\n
"
,
str
.
Length
,
status
);
}
}
attr
.
Length
=
sizeof
(
attr
);
}
str
.
Length
=
sizeof
(
registryW
)
+
256
*
sizeof
(
WCHAR
)
+
1
;
status
=
pNtCreateKey
(
&
ret
,
GENERIC_ALL
,
&
attr
,
0
,
NULL
,
0
,
NULL
);
...
...
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