Jacek Caban : ntdll: Correctly return result of blocking NtFlushBuffersFile.

Alexandre Julliard julliard at winehq.org
Tue Oct 30 14:19:35 CDT 2018


Module: wine
Branch: master
Commit: 9050b58f0769fca75c4cebed7be3cce51989814e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9050b58f0769fca75c4cebed7be3cce51989814e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Oct 30 16:08:48 2018 +0100

ntdll: Correctly return result of blocking NtFlushBuffersFile.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/pipe.c |  2 +-
 dlls/ntdll/file.c          | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 7f77df1..05e23bf 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -2852,7 +2852,7 @@ static DWORD CALLBACK flush_proc(HANDLE pipe)
     if (expected_flush_error == ERROR_SUCCESS)
         ok(res, "FlushFileBuffers failed: %u\n", GetLastError());
     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;
 }
 
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index d3b3698..870ad06 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -3317,9 +3317,17 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
     }
     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 )
         {
-            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 );
             wait_handle = wine_server_ptr_handle( reply->event );
             if (wait_handle && ret != STATUS_PENDING)
@@ -3330,6 +3338,8 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
         }
         SERVER_END_REQ;
 
+        if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
+
         if (wait_handle)
         {
             NtWaitForSingleObject( wait_handle, FALSE, NULL );




More information about the wine-cvs mailing list