kernel32: Always set bytes written in WriteFile.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-01-23 15:51:58 +01:00 committed by Alexandre Julliard
parent c47c74e5d3
commit 84ae4b937f
2 changed files with 3 additions and 3 deletions

View File

@ -577,8 +577,8 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
status = piosb->u.Status; status = piosb->u.Status;
} }
if (status != STATUS_PENDING && bytesWritten) if (bytesWritten)
*bytesWritten = piosb->Information; *bytesWritten = overlapped && status ? 0 : piosb->Information;
if (status && status != STATUS_TIMEOUT) if (status && status != STATUS_TIMEOUT)
{ {

View File

@ -2767,7 +2767,7 @@ static void _overlapped_write_async(unsigned line, HANDLE writer, void *buf, DWO
overlapped->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); overlapped->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
res = WriteFile(writer, buf, size, &written_bytes, overlapped); res = WriteFile(writer, buf, size, &written_bytes, overlapped);
ok_(__FILE__,line)(!res && GetLastError() == ERROR_IO_PENDING, "WriteFile returned %x(%u)\n", res, GetLastError()); ok_(__FILE__,line)(!res && GetLastError() == ERROR_IO_PENDING, "WriteFile returned %x(%u)\n", res, GetLastError());
todo_wine ok_(__FILE__,line)(!written_bytes, "written_bytes = %u\n", written_bytes); ok_(__FILE__,line)(!written_bytes, "written_bytes = %u\n", written_bytes);
_test_not_signaled(line, overlapped->hEvent); _test_not_signaled(line, overlapped->hEvent);
} }