[patch] Overlapped I/O fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An earlier patch 
<http://www.winehq.com/hypermail/wine-cvs/2003/06/0232.html> caused 
overlapped reads and writes to fail in Hamster.  I filed a bug report 
(#1553), but was eventually able to find the problem myself.

The return value of register_new_async differs from the status it sets 
inside the async_private structure, but the patch was overwriting the 
latter with the former.  This caused Wine to return STATUS_SUCCESS instead 
of STATUS_PENDING and so the caller always read/wrote 0 bytes.

License: X11, LGPL
Changelog:
  Paul Rupe <prupe@myrealbox.com>
  register_new_async sets status already.  Do not overwrite it with the 
function's return value


-- 
Paul Rupe   <prupe@myrealbox.com>                "She smiled, in the end."
Index: dlls/ntdll/file.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/file.c,v
retrieving revision 1.27
diff -u -r1.27 file.c
--- dlls/ntdll/file.c	30 Jun 2003 21:00:17 -0000	1.27
+++ dlls/ntdll/file.c	5 Jul 2003 18:53:28 -0000
@@ -375,6 +375,7 @@
     if (flags & (FD_FLAG_OVERLAPPED|FD_FLAG_TIMEOUT))
     {
         async_fileio*   ovp;
+        NTSTATUS ret;
 
         if (unix_handle < 0) return STATUS_INVALID_HANDLE;
 
@@ -397,12 +398,9 @@
         ovp->fd_type = type;
 
         io_status->Information = 0;
-        io_status->u.Status = register_new_async(&ovp->async);
-        if (io_status->u.Status == STATUS_PENDING && hEvent)
-        {
-            finish_async(&ovp->async);
-            close(unix_handle);
-        }
+        ret = register_new_async(&ovp->async);
+        if (ret != STATUS_SUCCESS)
+            return ret;
         return io_status->u.Status;
     }
     switch (type)
@@ -531,6 +529,7 @@
     if (flags & (FD_FLAG_OVERLAPPED|FD_FLAG_TIMEOUT))
     {
         async_fileio*   ovp;
+        NTSTATUS ret;
 
         if (unix_handle < 0) return STATUS_INVALID_HANDLE;
 
@@ -553,12 +552,9 @@
         ovp->fd_type = type;
 
         io_status->Information = 0;
-        io_status->u.Status = register_new_async(&ovp->async);
-        if (io_status->u.Status == STATUS_PENDING && hEvent)
-        {
-            finish_async(&ovp->async);
-            close(unix_handle);
-        }
+        ret = register_new_async(&ovp->async);
+        if (ret != STATUS_SUCCESS)
+            return ret;
         return io_status->u.Status;
     }
     switch (type)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux