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
688c7a99
Commit
688c7a99
authored
Oct 04, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Return error for FSCTL_PIPE_PEEK calls on disconnected pipes.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6283f4ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
pipe.c
dlls/kernel32/tests/pipe.c
+37
-0
named_pipe.c
server/named_pipe.c
+6
-0
No files found.
dlls/kernel32/tests/pipe.c
View file @
688c7a99
...
...
@@ -209,6 +209,11 @@ static void test_CreateNamedPipe(int pipemode)
ok
(
hnp
!=
INVALID_HANDLE_VALUE
,
"CreateNamedPipe failed
\n
"
);
test_signaled
(
hnp
);
ret
=
PeekNamedPipe
(
hnp
,
NULL
,
0
,
NULL
,
&
readden
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_BAD_PIPE
,
"PeekNamedPipe returned %x (%u)
\n
"
,
ret
,
GetLastError
());
ret
=
WaitNamedPipeA
(
PIPENAME
,
2000
);
ok
(
ret
,
"WaitNamedPipe failed (%d)
\n
"
,
GetLastError
());
...
...
@@ -1387,10 +1392,20 @@ static int test_DisconnectNamedPipe(void)
ok
(
ReadFile
(
hnp
,
ibuf
,
sizeof
(
ibuf
),
&
readden
,
NULL
)
==
0
&&
GetLastError
()
==
ERROR_PIPE_NOT_CONNECTED
,
"ReadFile from disconnected pipe with bytes waiting
\n
"
);
ok
(
!
DisconnectNamedPipe
(
hnp
)
&&
GetLastError
()
==
ERROR_PIPE_NOT_CONNECTED
,
"DisconnectNamedPipe worked twice
\n
"
);
ret
=
WaitForSingleObject
(
hFile
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"WaitForSingleObject returned %X
\n
"
,
ret
);
ret
=
PeekNamedPipe
(
hFile
,
NULL
,
0
,
NULL
,
&
readden
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_PIPE_NOT_CONNECTED
,
"PeekNamedPipe returned %x (%u)
\n
"
,
ret
,
GetLastError
());
ret
=
PeekNamedPipe
(
hnp
,
NULL
,
0
,
NULL
,
&
readden
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_BAD_PIPE
,
"PeekNamedPipe returned %x (%u)
\n
"
,
ret
,
GetLastError
());
ok
(
CloseHandle
(
hFile
),
"CloseHandle
\n
"
);
}
...
...
@@ -1502,6 +1517,11 @@ static void test_CloseHandle(void)
ok
(
numbytes
==
0
,
"expected 0, got %u
\n
"
,
numbytes
);
numbytes
=
0xdeadbeef
;
ret
=
PeekNamedPipe
(
hfile
,
NULL
,
0
,
NULL
,
&
numbytes
,
NULL
);
ok
(
ret
,
"PeekNamedPipe failed with %u
\n
"
,
GetLastError
());
ok
(
numbytes
==
sizeof
(
testdata
),
"expected sizeof(testdata), got %u
\n
"
,
numbytes
);
numbytes
=
0xdeadbeef
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
ret
=
ReadFile
(
hfile
,
buffer
,
sizeof
(
buffer
),
&
numbytes
,
NULL
);
ok
(
ret
,
"ReadFile failed with %u
\n
"
,
GetLastError
());
...
...
@@ -1518,6 +1538,12 @@ static void test_CloseHandle(void)
ok
(
!
ret
,
"ReadFile unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_BROKEN_PIPE
,
"expected ERROR_BROKEN_PIPE, got %u
\n
"
,
GetLastError
());
numbytes
=
0xdeadbeef
;
ret
=
PeekNamedPipe
(
hfile
,
NULL
,
0
,
NULL
,
&
numbytes
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_BROKEN_PIPE
,
"PeekNamedPipe returned %x (%u)
\n
"
,
ret
,
GetLastError
());
ok
(
numbytes
==
0xdeadbeef
,
"numbytes = %u
\n
"
,
numbytes
);
SetLastError
(
0xdeadbeef
);
ret
=
WriteFile
(
hfile
,
testdata
,
sizeof
(
testdata
),
&
numbytes
,
NULL
);
ok
(
!
ret
,
"WriteFile unexpectedly succeeded
\n
"
);
...
...
@@ -1601,6 +1627,11 @@ static void test_CloseHandle(void)
ok
(
numbytes
==
0
,
"expected 0, got %u
\n
"
,
numbytes
);
numbytes
=
0xdeadbeef
;
ret
=
PeekNamedPipe
(
hpipe
,
NULL
,
0
,
NULL
,
&
numbytes
,
NULL
);
ok
(
ret
,
"PeekNamedPipe failed with %u
\n
"
,
GetLastError
());
ok
(
numbytes
==
sizeof
(
testdata
),
"expected sizeof(testdata), got %u
\n
"
,
numbytes
);
numbytes
=
0xdeadbeef
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
ret
=
ReadFile
(
hpipe
,
buffer
,
sizeof
(
buffer
),
&
numbytes
,
NULL
);
ok
(
ret
,
"ReadFile failed with %u
\n
"
,
GetLastError
());
...
...
@@ -1617,6 +1648,12 @@ static void test_CloseHandle(void)
ok
(
!
ret
,
"ReadFile unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_BROKEN_PIPE
,
"expected ERROR_BROKEN_PIPE, got %u
\n
"
,
GetLastError
());
numbytes
=
0xdeadbeef
;
ret
=
PeekNamedPipe
(
hpipe
,
NULL
,
0
,
NULL
,
&
numbytes
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_BROKEN_PIPE
,
"PeekNamedPipe returned %x (%u)
\n
"
,
ret
,
GetLastError
());
ok
(
numbytes
==
0xdeadbeef
,
"numbytes = %u
\n
"
,
numbytes
);
SetLastError
(
0xdeadbeef
);
ret
=
WriteFile
(
hpipe
,
testdata
,
sizeof
(
testdata
),
&
numbytes
,
NULL
);
ok
(
!
ret
,
"WriteFile unexpectedly succeeded
\n
"
);
...
...
server/named_pipe.c
View file @
688c7a99
...
...
@@ -922,6 +922,12 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
}
reply_size
-=
offsetof
(
FILE_PIPE_PEEK_BUFFER
,
Data
);
if
(
!
pipe_end
->
connection
&&
list_empty
(
&
pipe_end
->
message_queue
))
{
set_error
(
STATUS_PIPE_BROKEN
);
return
0
;
}
LIST_FOR_EACH_ENTRY
(
message
,
&
pipe_end
->
message_queue
,
struct
pipe_message
,
entry
)
avail
+=
message
->
iosb
->
in_size
-
message
->
read_pos
;
...
...
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