Remove useless calls to IsBadReadPtr from ReadFile and WriteFile

Dmitry Timoshkov dmitry at baikal.ru
Tue Nov 23 07:38:43 CST 2004


Hello,

this is a replacement for my previous patch "Make ReadFile and WriteFile
use exception handler instead of IsBadReadPtr". As Alexandre pointed out
read/write under Linux never crash but return EFAULT instead.

I'll write a test to see what correct error code Windows returns
in case of fault and fix NtReadFile/NtWriteFile appropriately.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Remove useless calls to IsBadReadPtr from ReadFile and WriteFile.

--- cvs/hq/wine/dlls/kernel/file.c	2004-11-22 17:52:19.000000000 +0800
+++ wine/dlls/kernel/file.c	2004-11-23 21:21:51.000000000 +0800
@@ -358,11 +358,6 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVO
     if (bytesRead) *bytesRead = 0;  /* Do this before anything else */
     if (!bytesToRead) return TRUE;
 
-    if (IsBadReadPtr(buffer, bytesToRead))
-    {
-        SetLastError(ERROR_WRITE_FAULT); /* FIXME */
-        return FALSE;
-    }
     if (is_console_handle(hFile))
         return ReadConsoleA(hFile, buffer, bytesToRead, bytesRead, NULL);
 
@@ -441,12 +436,6 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPC
     if (is_console_handle(hFile))
         return WriteConsoleA(hFile, buffer, bytesToWrite, bytesWritten, NULL);
 
-    if (IsBadReadPtr(buffer, bytesToWrite))
-    {
-        SetLastError(ERROR_READ_FAULT); /* FIXME */
-        return FALSE;
-    }
-
     if (overlapped)
     {
         offset.u.LowPart = overlapped->Offset;






More information about the wine-patches mailing list