ReadFile() and WriteFile() choke on non-zero lpOverlapped.

Eric Pouech Eric.Pouech at
Sat Feb 3 12:19:35 CST 2001

Eric Kohl wrote:
> Hello!
> I'm currently debugging a database-application that uses the M$ Jet Engine
> 3.5. This db-engine does not behave very well. It opens an exisisting
> database-file (FILE_FLAG_OVERLAPPED is *not* set) and reads or writes using
> calls to ReadFile() and WriteFile() with non-zero lpOverlapped pointers. In
> this case calls to ReadFile() or WriteFile() return FALSE.
> IMO ReadFile() and WriteFile() should check whether FILE_FLAG_OVERLAPPED is
> set. Unfortunately there is no method to retrieve the full file attributes
> from wineserver. Is a new server call required?
a quick hack would be to extend the get_file_info request to add to the
flags field the high WORD from inner file object

(the low word contains the FILE_ATTRIBUTE_??? flags and we should get the bits
from the stat operation)

however, it would add a stat to the file for every call which is not what
you want in all cases

Index: server/file.c
RCS file: /home/cvs/cvsroot/wine/wine/server/file.c,v
retrieving revision 1.36
diff -u -r1.36 file.c
--- server/file.c       2001/01/12 23:02:39     1.36
+++ server/file.c       2001/02/03 18:17:22
@@ -267,6 +267,8 @@
     if (S_ISDIR(st.st_mode)) req->attr = FILE_ATTRIBUTE_DIRECTORY;
     else req->attr = FILE_ATTRIBUTE_ARCHIVE;
     if (!(st.st_mode & S_IWUSR)) req->attr |= FILE_ATTRIBUTE_READONLY;
+    /* copy back only the FILE_FLAG_??? bits */
+    req->attr |= file->flags & 0xffff0000;
     req->access_time = st.st_atime;
     req->write_time  = st.st_mtime;
     req->size_high   = 0;

Eric Pouech (
"The future will be better tomorrow", Vice President Dan Quayle

More information about the wine-devel mailing list