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
9d011931
Commit
9d011931
authored
May 22, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
May 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Added more PeekNamedPipe tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ad2f1efe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
+33
-9
pipe.c
dlls/kernel32/tests/pipe.c
+33
-9
No files found.
dlls/kernel32/tests/pipe.c
View file @
9d011931
...
...
@@ -26,6 +26,7 @@
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winioctl.h"
#include "wine/test.h"
#define PIPENAME "\\\\.\\PiPe\\tests_pipe.c"
...
...
@@ -2534,17 +2535,40 @@ todo_wine
CloseHandle
(
event
);
}
#define test_peek_pipe(a,b,c
) _test_peek_pipe(__LINE__,a,b,c
)
static
void
_test_peek_pipe
(
unsigned
line
,
HANDLE
pipe
,
DWORD
expected_read
,
DWORD
expected_avail
)
#define test_peek_pipe(a,b,c
,d) _test_peek_pipe(__LINE__,a,b,c,d
)
static
void
_test_peek_pipe
(
unsigned
line
,
HANDLE
pipe
,
DWORD
expected_read
,
DWORD
expected_avail
,
DWORD
expected_message_length
)
{
DWORD
bytes_read
=
0xdeadbeed
,
avail
=
0xdeadbeef
;
DWORD
bytes_read
=
0xdeadbeed
,
avail
=
0xdeadbeef
,
left
=
0xdeadbeed
;
char
buf
[
4000
];
FILE_PIPE_PEEK_BUFFER
*
peek_buf
=
(
void
*
)
buf
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
BOOL
r
;
r
=
PeekNamedPipe
(
pipe
,
buf
,
sizeof
(
buf
),
&
bytes_read
,
&
avail
,
NULL
);
r
=
PeekNamedPipe
(
pipe
,
buf
,
sizeof
(
buf
),
&
bytes_read
,
&
avail
,
&
left
);
ok_
(
__FILE__
,
line
)(
r
,
"PeekNamedPipe failed: %u
\n
"
,
GetLastError
());
ok_
(
__FILE__
,
line
)(
bytes_read
==
expected_read
,
"bytes_read = %u, expected %u
\n
"
,
bytes_read
,
expected_read
);
ok_
(
__FILE__
,
line
)(
avail
==
expected_avail
,
"avail = %u, expected %u
\n
"
,
avail
,
expected_avail
);
ok_
(
__FILE__
,
line
)(
left
==
expected_message_length
-
expected_read
,
"left = %d, expected %d
\n
"
,
left
,
expected_message_length
-
expected_read
);
status
=
NtFsControlFile
(
pipe
,
0
,
NULL
,
NULL
,
&
io
,
FSCTL_PIPE_PEEK
,
NULL
,
0
,
buf
,
sizeof
(
buf
));
ok_
(
__FILE__
,
line
)(
!
status
||
status
==
STATUS_PENDING
,
"NtFsControlFile(FSCTL_PIPE_PEEK) failed: %x
\n
"
,
status
);
ok_
(
__FILE__
,
line
)(
io
.
Information
==
FIELD_OFFSET
(
FILE_PIPE_PEEK_BUFFER
,
Data
[
expected_read
]),
"io.Information = %lu
\n
"
,
io
.
Information
);
ok_
(
__FILE__
,
line
)(
peek_buf
->
ReadDataAvailable
==
expected_avail
,
"ReadDataAvailable = %u, expected %u
\n
"
,
peek_buf
->
ReadDataAvailable
,
expected_avail
);
ok_
(
__FILE__
,
line
)(
peek_buf
->
MessageLength
==
expected_message_length
,
"MessageLength = %u, expected %u
\n
"
,
peek_buf
->
MessageLength
,
expected_message_length
);
if
(
expected_read
)
{
r
=
PeekNamedPipe
(
pipe
,
buf
,
1
,
&
bytes_read
,
&
avail
,
&
left
);
ok_
(
__FILE__
,
line
)(
r
,
"PeekNamedPipe failed: %u
\n
"
,
GetLastError
());
ok_
(
__FILE__
,
line
)(
bytes_read
==
1
,
"bytes_read = %u, expected %u
\n
"
,
bytes_read
,
expected_read
);
ok_
(
__FILE__
,
line
)(
avail
==
expected_avail
,
"avail = %u, expected %u
\n
"
,
avail
,
expected_avail
);
ok_
(
__FILE__
,
line
)(
left
==
expected_message_length
-
1
,
"left = %d, expected %d
\n
"
,
left
,
expected_message_length
-
1
);
}
}
#define overlapped_read_sync(a,b,c,d,e) _overlapped_read_sync(__LINE__,a,b,c,d,e)
...
...
@@ -2728,7 +2752,7 @@ static void test_blocking_rw(HANDLE writer, HANDLE reader, DWORD buf_size, BOOL
/* test pending read with overlapped event */
overlapped_read_async
(
reader
,
read_buf
,
1000
,
&
read_overlapped
);
test_flush_sync
(
writer
);
test_peek_pipe
(
reader
,
0
,
0
);
test_peek_pipe
(
reader
,
0
,
0
,
0
);
/* write more data than needed for read */
overlapped_write_sync
(
writer
,
buf
,
4000
);
...
...
@@ -2813,13 +2837,13 @@ static void test_blocking_rw(HANDLE writer, HANDLE reader, DWORD buf_size, BOOL
test_overlapped_result
(
reader
,
&
read_overlapped2
,
1
,
FALSE
);
overlapped_write_sync
(
writer
,
buf
,
20
);
test_peek_pipe
(
reader
,
20
,
20
);
test_peek_pipe
(
reader
,
20
,
20
,
msg_mode
?
20
:
0
);
overlapped_write_sync
(
writer
,
buf
,
15
);
test_peek_pipe
(
reader
,
msg_mode
?
20
:
35
,
35
);
test_peek_pipe
(
reader
,
msg_mode
?
20
:
35
,
35
,
msg_mode
?
20
:
0
);
overlapped_read_sync
(
reader
,
read_buf
,
10
,
10
,
msg_read
);
test_peek_pipe
(
reader
,
msg_mode
?
10
:
25
,
25
);
test_peek_pipe
(
reader
,
msg_mode
?
10
:
25
,
25
,
msg_mode
?
10
:
0
);
overlapped_read_sync
(
reader
,
read_buf
,
10
,
10
,
FALSE
);
test_peek_pipe
(
reader
,
15
,
15
);
test_peek_pipe
(
reader
,
15
,
15
,
msg_mode
?
15
:
0
);
overlapped_read_sync
(
reader
,
read_buf
,
15
,
15
,
FALSE
);
if
(
!
pCancelIoEx
)
{
...
...
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