ntdll: Correctly return result of blocking NtFlushBuffersFile.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-10-30 16:08:48 +01:00 committed by Alexandre Julliard
parent 4fc5aff509
commit 9050b58f07
2 changed files with 12 additions and 2 deletions

View File

@ -2852,7 +2852,7 @@ static DWORD CALLBACK flush_proc(HANDLE pipe)
if (expected_flush_error == ERROR_SUCCESS) if (expected_flush_error == ERROR_SUCCESS)
ok(res, "FlushFileBuffers failed: %u\n", GetLastError()); ok(res, "FlushFileBuffers failed: %u\n", GetLastError());
else else
todo_wine ok(!res && GetLastError() == expected_flush_error, "FlushFileBuffers failed: %u\n", GetLastError()); ok(!res && GetLastError() == expected_flush_error, "FlushFileBuffers failed: %u\n", GetLastError());
return 0; return 0;
} }

View File

@ -3317,9 +3317,17 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
} }
else if (ret != STATUS_ACCESS_DENIED) else if (ret != STATUS_ACCESS_DENIED)
{ {
struct async_irp *async;
if (!(async = (struct async_irp *)alloc_fileio( sizeof(*async), irp_completion, hFile )))
return STATUS_NO_MEMORY;
async->event = NULL;
async->buffer = NULL;
async->size = 0;
SERVER_START_REQ( flush ) SERVER_START_REQ( flush )
{ {
req->async = server_async( hFile, NULL, NULL, NULL, NULL, io ); req->async = server_async( hFile, &async->io, NULL, NULL, NULL, io );
ret = wine_server_call( req ); ret = wine_server_call( req );
wait_handle = wine_server_ptr_handle( reply->event ); wait_handle = wine_server_ptr_handle( reply->event );
if (wait_handle && ret != STATUS_PENDING) if (wait_handle && ret != STATUS_PENDING)
@ -3330,6 +3338,8 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
} }
SERVER_END_REQ; SERVER_END_REQ;
if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle) if (wait_handle)
{ {
NtWaitForSingleObject( wait_handle, FALSE, NULL ); NtWaitForSingleObject( wait_handle, FALSE, NULL );