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
8c0eec2c
Commit
8c0eec2c
authored
Aug 13, 2009
by
Mike Kaplinskiy
Committed by
Alexandre Julliard
Aug 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Test NtCancelIoFile(Ex).
parent
a5c03fbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
3 deletions
+84
-3
file.c
dlls/ntdll/tests/file.c
+84
-3
No files found.
dlls/ntdll/tests/file.c
View file @
8c0eec2c
...
@@ -54,6 +54,7 @@ static NTSTATUS (WINAPI *pNtWriteFile)(HANDLE hFile, HANDLE hEvent,
...
@@ -54,6 +54,7 @@ static NTSTATUS (WINAPI *pNtWriteFile)(HANDLE hFile, HANDLE hEvent,
PIO_STATUS_BLOCK
io_status
,
PIO_STATUS_BLOCK
io_status
,
const
void
*
buffer
,
ULONG
length
,
const
void
*
buffer
,
ULONG
length
,
PLARGE_INTEGER
offset
,
PULONG
key
);
PLARGE_INTEGER
offset
,
PULONG
key
);
static
NTSTATUS
(
WINAPI
*
pNtCancelIoFile
)(
HANDLE
hFile
,
PIO_STATUS_BLOCK
io_status
);
static
NTSTATUS
(
WINAPI
*
pNtCancelIoFileEx
)(
HANDLE
hFile
,
PIO_STATUS_BLOCK
iosb
,
PIO_STATUS_BLOCK
io_status
);
static
NTSTATUS
(
WINAPI
*
pNtCancelIoFileEx
)(
HANDLE
hFile
,
PIO_STATUS_BLOCK
iosb
,
PIO_STATUS_BLOCK
io_status
);
static
NTSTATUS
(
WINAPI
*
pNtClose
)(
PHANDLE
);
static
NTSTATUS
(
WINAPI
*
pNtClose
)(
PHANDLE
);
...
@@ -208,7 +209,7 @@ static void read_file_test(void)
...
@@ -208,7 +209,7 @@ static void read_file_test(void)
const
char
text
[]
=
"foobar"
;
const
char
text
[]
=
"foobar"
;
HANDLE
handle
,
read
,
write
;
HANDLE
handle
,
read
,
write
;
NTSTATUS
status
;
NTSTATUS
status
;
IO_STATUS_BLOCK
iosb
;
IO_STATUS_BLOCK
iosb
,
iosb2
;
DWORD
written
;
DWORD
written
;
int
apc_count
=
0
;
int
apc_count
=
0
;
char
buffer
[
128
];
char
buffer
[
128
];
...
@@ -356,11 +357,63 @@ static void read_file_test(void)
...
@@ -356,11 +357,63 @@ static void read_file_test(void)
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
CloseHandle
(
read
);
CloseHandle
(
read
);
if
(
!
create_pipe
(
&
read
,
&
write
,
FILE_FLAG_OVERLAPPED
,
4096
))
return
;
ok
(
DuplicateHandle
(
GetCurrentProcess
(),
read
,
GetCurrentProcess
(),
&
handle
,
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
),
"Failed to duplicate handle: %d
\n
"
,
GetLastError
());
apc_count
=
0
;
U
(
iosb
).
Status
=
0xdeadbabe
;
iosb
.
Information
=
0xdeadbeef
;
status
=
pNtReadFile
(
handle
,
event
,
apc
,
&
apc_count
,
&
iosb
,
buffer
,
2
,
NULL
,
NULL
);
ok
(
status
==
STATUS_PENDING
,
"wrong status %x
\n
"
,
status
);
ok
(
!
is_signaled
(
event
),
"event is signaled
\n
"
);
ok
(
U
(
iosb
).
Status
==
0xdeadbabe
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0xdeadbeef
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
!
apc_count
,
"apc was called
\n
"
);
/* Cancel by other handle */
status
=
pNtCancelIoFile
(
read
,
&
iosb2
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to cancel by different handle: %x
\n
"
,
status
);
Sleep
(
1
);
/* FIXME: needed for wine to run the i/o apc */
ok
(
U
(
iosb
).
Status
==
STATUS_CANCELLED
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
is_signaled
(
event
),
"event is signaled
\n
"
);
todo_wine
ok
(
!
apc_count
,
"apc was called
\n
"
);
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
apc_count
=
0
;
U
(
iosb
).
Status
=
0xdeadbabe
;
iosb
.
Information
=
0xdeadbeef
;
status
=
pNtReadFile
(
read
,
event
,
apc
,
&
apc_count
,
&
iosb
,
buffer
,
2
,
NULL
,
NULL
);
ok
(
status
==
STATUS_PENDING
,
"wrong status %x
\n
"
,
status
);
ok
(
!
is_signaled
(
event
),
"event is signaled
\n
"
);
ok
(
U
(
iosb
).
Status
==
0xdeadbabe
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0xdeadbeef
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
!
apc_count
,
"apc was called
\n
"
);
/* Close queued handle */
CloseHandle
(
read
);
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
ok
(
U
(
iosb
).
Status
==
0xdeadbabe
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0xdeadbeef
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
status
=
pNtCancelIoFile
(
read
,
&
iosb2
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"cancelled by closed handle?
\n
"
);
status
=
pNtCancelIoFile
(
handle
,
&
iosb2
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to cancel: %x
\n
"
,
status
);
Sleep
(
1
);
/* FIXME: needed for wine to run the i/o apc */
ok
(
U
(
iosb
).
Status
==
STATUS_CANCELLED
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
is_signaled
(
event
),
"event is signaled
\n
"
);
todo_wine
ok
(
!
apc_count
,
"apc was called
\n
"
);
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
CloseHandle
(
handle
);
CloseHandle
(
write
);
if
(
pNtCancelIoFileEx
)
if
(
pNtCancelIoFileEx
)
{
{
IO_STATUS_BLOCK
iosb2
;
/* Basic Cancel Ex */
/* test param order for NtCancelIoFileEx */
if
(
!
create_pipe
(
&
read
,
&
write
,
FILE_FLAG_OVERLAPPED
,
4096
))
return
;
if
(
!
create_pipe
(
&
read
,
&
write
,
FILE_FLAG_OVERLAPPED
,
4096
))
return
;
apc_count
=
0
;
apc_count
=
0
;
U
(
iosb
).
Status
=
0xdeadbabe
;
U
(
iosb
).
Status
=
0xdeadbabe
;
iosb
.
Information
=
0xdeadbeef
;
iosb
.
Information
=
0xdeadbeef
;
...
@@ -379,6 +432,33 @@ static void read_file_test(void)
...
@@ -379,6 +432,33 @@ static void read_file_test(void)
todo_wine
ok
(
!
apc_count
,
"apc was called
\n
"
);
todo_wine
ok
(
!
apc_count
,
"apc was called
\n
"
);
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
ok
(
apc_count
==
1
,
"apc was not called
\n
"
);
/* Duplicate iosb */
apc_count
=
0
;
U
(
iosb
).
Status
=
0xdeadbabe
;
iosb
.
Information
=
0xdeadbeef
;
status
=
pNtReadFile
(
read
,
event
,
apc
,
&
apc_count
,
&
iosb
,
buffer
,
2
,
NULL
,
NULL
);
ok
(
status
==
STATUS_PENDING
,
"wrong status %x
\n
"
,
status
);
ok
(
!
is_signaled
(
event
),
"event is signaled
\n
"
);
ok
(
U
(
iosb
).
Status
==
0xdeadbabe
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0xdeadbeef
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
!
apc_count
,
"apc was called
\n
"
);
status
=
pNtReadFile
(
read
,
event
,
apc
,
&
apc_count
,
&
iosb
,
buffer
,
2
,
NULL
,
NULL
);
ok
(
status
==
STATUS_PENDING
,
"wrong status %x
\n
"
,
status
);
ok
(
!
is_signaled
(
event
),
"event is signaled
\n
"
);
ok
(
U
(
iosb
).
Status
==
0xdeadbabe
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0xdeadbeef
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
!
apc_count
,
"apc was called
\n
"
);
status
=
pNtCancelIoFileEx
(
read
,
&
iosb
,
&
iosb2
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to cancel I/O
\n
"
);
Sleep
(
1
);
/* FIXME: needed for wine to run the i/o apc */
ok
(
U
(
iosb
).
Status
==
STATUS_CANCELLED
,
"wrong status %x
\n
"
,
U
(
iosb
).
Status
);
ok
(
iosb
.
Information
==
0
,
"wrong info %lu
\n
"
,
iosb
.
Information
);
ok
(
is_signaled
(
event
),
"event is signaled
\n
"
);
todo_wine
ok
(
!
apc_count
,
"apc was called
\n
"
);
SleepEx
(
1
,
TRUE
);
/* alertable sleep */
ok
(
apc_count
==
2
,
"apc was not called
\n
"
);
CloseHandle
(
read
);
CloseHandle
(
read
);
CloseHandle
(
write
);
CloseHandle
(
write
);
}
}
...
@@ -741,6 +821,7 @@ START_TEST(file)
...
@@ -741,6 +821,7 @@ START_TEST(file)
pNtDeleteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDeleteFile"
);
pNtDeleteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDeleteFile"
);
pNtReadFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReadFile"
);
pNtReadFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReadFile"
);
pNtWriteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtWriteFile"
);
pNtWriteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtWriteFile"
);
pNtCancelIoFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCancelIoFile"
);
pNtCancelIoFileEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCancelIoFileEx"
);
pNtCancelIoFileEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCancelIoFileEx"
);
pNtClose
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtClose"
);
pNtClose
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtClose"
);
pNtCreateIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateIoCompletion"
);
pNtCreateIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateIoCompletion"
);
...
...
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