PATCH: NtWriteFile

Marcus Meissner meissner at suse.de
Fri Jan 9 09:23:51 CST 2004


On Fri, Jan 09, 2004 at 04:21:09PM +0100, Marcus Meissner wrote:
> Hi,
> 
> This fixes a crash when WriteFile()ing to a file descriptor which
> needs an OVERLAPPED parameter.
> 
> The behaviour is merely undefined according to MSDN, it should not crash.
> It also mirrors same code in NtReadFile.
> It should also fix bug #1874.

Actually we probably should set offset to 0 if none is present.
 
Ciao, Marcus

Changelog:
	Allow offset of NULL to NtWriteFile.

Index: dlls/ntdll/file.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/file.c,v
retrieving revision 1.35
diff -u -r1.35 file.c
--- dlls/ntdll/file.c	1 Dec 2003 23:01:13 -0000	1.35
+++ dlls/ntdll/file.c	9 Jan 2004 15:22:47 -0000
@@ -558,8 +558,12 @@
         ovp->async.event = hEvent;
         ovp->async.iosb = io_status;
         ovp->count = length;
-        ovp->offset = offset->s.LowPart;
-        if (offset->s.HighPart) FIXME("NIY-high part\n");
+        if (offset) {
+            ovp->offset = offset->s.LowPart;
+            if (offset->s.HighPart) FIXME("NIY-high part\n");
+        } else {
+            ovp->offset = 0;
+        }
         ovp->apc = apc;
         ovp->apc_user = apc_user;
         ovp->buffer = (void*)buffer;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20040109/6ef3a1e9/attachment.pgp


More information about the wine-patches mailing list