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
d5cd34c7
Commit
d5cd34c7
authored
Jan 23, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Always set bytes read in ReadFile.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1f88b90b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
3 deletions
+51
-3
file.c
dlls/kernel32/file.c
+2
-2
pipe.c
dlls/kernel32/tests/pipe.c
+49
-1
No files found.
dlls/kernel32/file.c
View file @
d5cd34c7
...
...
@@ -453,8 +453,8 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
status
=
io_status
->
u
.
Status
;
}
if
(
status
!=
STATUS_PENDING
&&
bytesRead
)
*
bytesRead
=
io_status
->
Information
;
if
(
bytesRead
)
*
bytesRead
=
overlapped
&&
status
?
0
:
io_status
->
Information
;
if
(
status
==
STATUS_END_OF_FILE
)
{
...
...
dlls/kernel32/tests/pipe.c
View file @
d5cd34c7
...
...
@@ -715,6 +715,53 @@ static void test_CreateNamedPipe_instances_must_match(void)
ok
(
CloseHandle
(
hnp2
),
"CloseHandle
\n
"
);
}
static
void
test_ReadFile
(
void
)
{
HANDLE
server
,
client
;
OVERLAPPED
overlapped
;
DWORD
size
;
BOOL
res
;
static
char
buf
[
512
];
server
=
CreateNamedPipeA
(
PIPENAME
,
PIPE_ACCESS_DUPLEX
,
PIPE_TYPE_MESSAGE
|
PIPE_READMODE_MESSAGE
|
PIPE_WAIT
,
1
,
1024
,
1024
,
NMPWAIT_WAIT_FOREVER
,
NULL
);
ok
(
server
!=
INVALID_HANDLE_VALUE
,
"CreateNamedPipe failed with %u
\n
"
,
GetLastError
());
client
=
CreateFileA
(
PIPENAME
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
client
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed with %u
\n
"
,
GetLastError
());
ok
(
WriteFile
(
client
,
buf
,
sizeof
(
buf
),
&
size
,
NULL
),
"WriteFile
\n
"
);
res
=
ReadFile
(
server
,
buf
,
1
,
&
size
,
NULL
);
ok
(
!
res
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"ReadFile returned %x(%u)
\n
"
,
res
,
GetLastError
());
ok
(
size
==
1
,
"size = %u
\n
"
,
size
);
/* pass both overlapped and ret read */
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
));
res
=
ReadFile
(
server
,
buf
,
1
,
&
size
,
&
overlapped
);
ok
(
!
res
&&
GetLastError
()
==
ERROR_MORE_DATA
,
"ReadFile returned %x(%u)
\n
"
,
res
,
GetLastError
());
ok
(
size
==
0
,
"size = %u
\n
"
,
size
);
ok
((
NTSTATUS
)
overlapped
.
Internal
==
STATUS_BUFFER_OVERFLOW
,
"Internal = %lx
\n
"
,
overlapped
.
Internal
);
ok
(
overlapped
.
InternalHigh
==
1
,
"InternalHigh = %lx
\n
"
,
overlapped
.
InternalHigh
);
DisconnectNamedPipe
(
server
);
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
));
overlapped
.
InternalHigh
=
0xdeadbeef
;
res
=
ReadFile
(
server
,
buf
,
1
,
&
size
,
&
overlapped
);
ok
(
!
res
&&
GetLastError
()
==
ERROR_PIPE_NOT_CONNECTED
,
"ReadFile returned %x(%u)
\n
"
,
res
,
GetLastError
());
ok
(
size
==
0
,
"size = %u
\n
"
,
size
);
ok
(
overlapped
.
Internal
==
STATUS_PENDING
,
"Internal = %lx
\n
"
,
overlapped
.
Internal
);
todo_wine
ok
(
overlapped
.
InternalHigh
==
0xdeadbeef
,
"InternalHigh = %lx
\n
"
,
overlapped
.
InternalHigh
);
CloseHandle
(
server
);
CloseHandle
(
client
);
}
/** implementation of alarm() */
static
DWORD
CALLBACK
alarmThreadMain
(
LPVOID
arg
)
{
...
...
@@ -2661,7 +2708,7 @@ static void _overlapped_read_sync(unsigned line, HANDLE reader, void *buf, DWORD
else
ok_
(
__FILE__
,
line
)(
res
,
"ReadFile failed: %u
\n
"
,
GetLastError
());
if
(
partial_read
)
todo_wine
ok_
(
__FILE__
,
line
)(
!
read_bytes
,
"read_bytes %u expected 0
\n
"
,
read_bytes
);
ok_
(
__FILE__
,
line
)(
!
read_bytes
,
"read_bytes %u expected 0
\n
"
,
read_bytes
);
else
ok_
(
__FILE__
,
line
)(
read_bytes
==
expected_result
,
"read_bytes %u expected %u
\n
"
,
read_bytes
,
expected_result
);
...
...
@@ -3122,6 +3169,7 @@ START_TEST(pipe)
test_CreateNamedPipe
(
PIPE_TYPE_BYTE
);
test_CreateNamedPipe
(
PIPE_TYPE_MESSAGE
|
PIPE_READMODE_MESSAGE
);
test_CreatePipe
();
test_ReadFile
();
test_CloseHandle
();
test_impersonation
();
test_overlapped
();
...
...
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