From: Paul Gofman Subject: [PATCH v3 4/5] ntdll: Return STATUS_PENDING from NtWriteFile() for async write. Message-Id: <20190220185018.14919-4-gofmanp@gmail.com> Date: Wed, 20 Feb 2019 21:50:17 +0300 In-Reply-To: <20190220185018.14919-1-gofmanp@gmail.com> References: <20190220185018.14919-1-gofmanp@gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42982 This matches Vista+ behaviour. Signed-off-by: Paul Gofman --- v2, v3: no changes. dlls/ntdll/file.c | 7 ++++--- dlls/ntdll/tests/file.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index ffedbeb534..b6307a2436 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1199,7 +1199,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, int result, unix_handle, needs_close; unsigned int options; struct io_timeouts timeouts; - NTSTATUS status; + NTSTATUS status, ret_status; ULONG total = 0; enum server_fd_type type; ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_user; @@ -1409,9 +1409,10 @@ err: if (status != STATUS_PENDING && hEvent) NtResetEvent( hEvent, NULL ); } - if (send_completion) NTDLL_AddCompletion( hFile, cvalue, status, total, FALSE ); + ret_status = async_write && status == STATUS_SUCCESS ? STATUS_PENDING : status; + if (send_completion) NTDLL_AddCompletion( hFile, cvalue, status, total, ret_status == STATUS_PENDING ); - return status; + return ret_status; } diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 3320ccecfa..ec339891e7 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3491,7 +3491,7 @@ static void test_file_completion_information(void) ok(pov == &ov, "expected %p, got %p\n", &ov, pov); } else - win_skip("WriteFile never returned TRUE\n"); + skip("WriteFile never returned TRUE\n"); info.Flags = FILE_SKIP_COMPLETION_PORT_ON_SUCCESS; status = pNtSetInformationFile(h, &io, &info, sizeof(info), FileIoCompletionNotificationInformation); @@ -3517,7 +3517,7 @@ static void test_file_completion_information(void) ok(pov == NULL, "expected NULL, got %p\n", pov); } else - win_skip("WriteFile never returned TRUE\n"); + skip("WriteFile never returned TRUE\n"); info.Flags = 0; status = pNtSetInformationFile(h, &io, &info, sizeof(info), FileIoCompletionNotificationInformation); @@ -3545,7 +3545,7 @@ static void test_file_completion_information(void) ok(pov == NULL, "expected NULL, got %p\n", pov); } else - win_skip("WriteFile never returned TRUE\n"); + skip("WriteFile never returned TRUE\n"); CloseHandle(port); CloseHandle(h); -- 2.20.1