[5/6] ntdll: Make NtWriteFile always initialize a being returned IO_STATUS_BLOCK.

Dmitry Timoshkov dmitry at baikal.ru
Mon Sep 2 04:32:28 CDT 2013


---
 dlls/ntdll/file.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index eb8051a..6046771 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -956,7 +956,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
     if (!virtual_check_buffer_for_read( buffer, length ))
     {
         status = STATUS_INVALID_USER_BUFFER;
-        goto done;
+        goto err;
     }
 
     if (type == FD_TYPE_FILE)
@@ -964,7 +964,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
         if (!(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)) && (!offset || offset->QuadPart < 0))
         {
             status = STATUS_INVALID_PARAMETER;
-            goto done;
+            goto err;
         }
 
         if (offset && offset->QuadPart != (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */)
@@ -1087,12 +1087,13 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
 done:
     send_completion = cvalue != 0;
 
+    io_status->u.Status = status;
+    io_status->Information = total;
+
 err:
     if (needs_close) close( unix_handle );
     if (status == STATUS_SUCCESS)
     {
-        io_status->u.Status = status;
-        io_status->Information = total;
         TRACE("= SUCCESS (%u)\n", total);
         if (hEvent) NtSetEvent( hEvent, NULL );
         if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc,
-- 
1.8.3.4




More information about the wine-patches mailing list