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
b3913c4f
Commit
b3913c4f
authored
May 15, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
May 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for accessing \\Device\\Null.
parent
c8362ec3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
0 deletions
+100
-0
om.c
dlls/ntdll/tests/om.c
+100
-0
No files found.
dlls/ntdll/tests/om.c
View file @
b3913c4f
...
...
@@ -1032,6 +1032,105 @@ static void test_keyed_events(void)
NtClose
(
event
);
}
static
void
test_null_device
(
void
)
{
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
iosb
;
UNICODE_STRING
str
;
NTSTATUS
status
;
DWORD
num_bytes
;
OVERLAPPED
ov
;
char
buf
[
64
];
HANDLE
null
;
BOOL
ret
;
memset
(
buf
,
0xAA
,
sizeof
(
buf
));
memset
(
&
ov
,
0
,
sizeof
(
ov
));
ov
.
hEvent
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
Device
\\
Null"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtOpenSymbolicLinkObject
(
&
null
,
SYMBOLIC_LINK_QUERY
,
&
attr
);
todo_wine
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"expected STATUS_OBJECT_TYPE_MISMATCH, got %08x
\n
"
,
status
);
status
=
pNtOpenFile
(
&
null
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
0
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
if
(
status
!=
STATUS_SUCCESS
)
{
skip
(
"opening
\\
Device
\\
Null failed, skipping read/write tests
\n
"
);
goto
out
;
}
SetLastError
(
0xdeadbeef
);
ret
=
WriteFile
(
null
,
buf
,
sizeof
(
buf
),
&
num_bytes
,
NULL
);
ok
(
!
ret
,
"WriteFile unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
ReadFile
(
null
,
buf
,
sizeof
(
buf
),
&
num_bytes
,
NULL
);
ok
(
!
ret
,
"ReadFile unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
num_bytes
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
WriteFile
(
null
,
buf
,
sizeof
(
buf
),
&
num_bytes
,
&
ov
);
if
(
ret
||
GetLastError
()
!=
ERROR_IO_PENDING
)
{
ok
(
ret
,
"WriteFile failed with error %u
\n
"
,
GetLastError
());
}
else
{
num_bytes
=
0xdeadbeef
;
ret
=
GetOverlappedResult
(
null
,
&
ov
,
&
num_bytes
,
TRUE
);
ok
(
ret
,
"GetOverlappedResult failed with error %u
\n
"
,
GetLastError
());
}
ok
(
num_bytes
==
sizeof
(
buf
),
"expected num_bytes = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
buf
),
num_bytes
);
num_bytes
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadFile
(
null
,
buf
,
sizeof
(
buf
),
&
num_bytes
,
&
ov
);
if
(
ret
||
GetLastError
()
!=
ERROR_IO_PENDING
)
{
ok
(
!
ret
,
"ReadFile unexpectedly succeeded
\n
"
);
}
else
{
num_bytes
=
0xdeadbeef
;
ret
=
GetOverlappedResult
(
null
,
&
ov
,
&
num_bytes
,
TRUE
);
ok
(
!
ret
,
"GetOverlappedResult unexpectedly succeeded
\n
"
);
}
ok
(
GetLastError
()
==
ERROR_HANDLE_EOF
,
"expected ERROR_HANDLE_EOF, got %u
\n
"
,
GetLastError
());
pNtClose
(
null
);
out:
null
=
CreateFileA
(
"
\\\\
.
\\
Null"
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
null
==
INVALID_HANDLE_VALUE
,
"CreateFileA unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"expected ERROR_FILE_NOT_FOUND, got %u
\n
"
,
GetLastError
());
null
=
CreateFileA
(
"
\\\\
.
\\
Device
\\
Null"
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
null
==
INVALID_HANDLE_VALUE
,
"CreateFileA unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"expected ERROR_PATH_NOT_FOUND, got %u
\n
"
,
GetLastError
());
pRtlFreeUnicodeString
(
&
str
);
CloseHandle
(
ov
.
hEvent
);
}
START_TEST
(
om
)
{
HMODULE
hntdll
=
GetModuleHandleA
(
"ntdll.dll"
);
...
...
@@ -1081,4 +1180,5 @@ START_TEST(om)
test_type_mismatch
();
test_event
();
test_keyed_events
();
test_null_device
();
}
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