diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index a0cd5f9ad3..7196aff670 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -565,8 +565,8 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite, piosb = (PIO_STATUS_BLOCK)overlapped; if (((ULONG_PTR)hEvent & 1) == 0) cvalue = overlapped; } + else piosb->Information = 0; piosb->u.Status = STATUS_PENDING; - piosb->Information = 0; status = NtWriteFile(hFile, hEvent, NULL, cvalue, piosb, buffer, bytesToWrite, poffset, NULL); diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index e0b8713bb1..22d120fc4d 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -757,6 +757,14 @@ static void test_ReadFile(void) ok(overlapped.Internal == STATUS_PENDING, "Internal = %lx\n", overlapped.Internal); ok(overlapped.InternalHigh == 0xdeadbeef, "InternalHigh = %lx\n", overlapped.InternalHigh); + memset(&overlapped, 0, sizeof(overlapped)); + overlapped.InternalHigh = 0xdeadbeef; + res = WriteFile(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); + ok(overlapped.InternalHigh == 0xdeadbeef, "InternalHigh = %lx\n", overlapped.InternalHigh); + CloseHandle(server); CloseHandle(client); }