Commit 9050b58f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Correctly return result of blocking NtFlushBuffersFile.

parent 4fc5aff5
...@@ -2852,7 +2852,7 @@ static DWORD CALLBACK flush_proc(HANDLE pipe) ...@@ -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;
} }
......
...@@ -3317,9 +3317,17 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io ) ...@@ -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 ) ...@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment