Nt{Read|Write}File regression

Eric Pouech pouech-eric at wanadoo.fr
Fri Aug 15 03:44:24 CDT 2003


This patch fixes two regressions in file IO (thanks to Mike for spotting 
them).
A+
-- 
Eric Pouech
-------------- next part --------------
Name:          ioto
ChangeLog:     
Regression fixes for Nt{Read|Write}File:
	- actually block in TIMEOUT mode
	- in overlapped mode, if any data is already available then process it without returning a pending status code
License:       X11
GenDate:       2003/08/15 08:41:37 UTC
ModifiedFiles: dlls/ntdll/file.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/file.c,v
retrieving revision 1.29
diff -u -u -r1.29 file.c
--- dlls/ntdll/file.c	18 Jul 2003 22:55:28 -0000	1.29
+++ dlls/ntdll/file.c	12 Aug 2003 18:57:24 -0000
@@ -416,6 +419,19 @@
         ret = register_new_async(&ovp->async);
         if (ret != STATUS_SUCCESS)
             return ret;
+        if (flags & FD_FLAG_TIMEOUT)
+        {
+            NtWaitForSingleObject(hEvent, TRUE, NULL);
+            NtClose(hEvent);
+        }
+        else
+        {
+            LARGE_INTEGER   timeout;
+
+            /* let some APC be run, this will read some already pending data */
+            timeout.s.LowPart = timeout.s.HighPart = 0;
+            NtDelayExecution( TRUE, &timeout );
+        }
         return io_status->u.Status;
     }
     switch (type)
@@ -577,6 +593,19 @@
         ret = register_new_async(&ovp->async);
         if (ret != STATUS_SUCCESS)
             return ret;
+        if (flags & FD_FLAG_TIMEOUT)
+        {
+            NtWaitForSingleObject(hEvent, TRUE, NULL);
+            NtClose(hEvent);
+        }
+        else
+        {
+            LARGE_INTEGER   timeout;
+
+            /* let some APC be run, this will write as much data as possible */
+            timeout.s.LowPart = timeout.s.HighPart = 0;
+            NtDelayExecution( TRUE, &timeout );
+        }
         return io_status->u.Status;
     }
     switch (type)


More information about the wine-patches mailing list