- fixed possible loss of data with given overlapped structure on a file opened in none overlapped mode - fixme for file-lock functions
Index: wine/files/file.c =================================================================== RCS file: /home/wine/wine/files/file.c,v retrieving revision 1.152 diff -d -u -r1.152 file.c --- wine/files/file.c 31 Jul 2002 18:46:43 -0000 1.152 +++ wine/files/file.c 2 Aug 2002 21:15:46 -0000 @@ -1675,20 +1678,30 @@ { case FD_TYPE_SMB: return SMB_ReadFile(hFile, buffer, bytesToRead, bytesRead, NULL); + case FD_TYPE_CONSOLE: return FILE_ReadConsole(hFile, buffer, bytesToRead, bytesRead, NULL); - default: + case FD_TYPE_DEFAULT: /* normal unix files */ if (unix_handle == -1) return FALSE; if (overlapped) { - close(unix_handle); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; + DWORD highOffset = overlapped->OffsetHigh; + if ( (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, overlapped->Offset, &highOffset, FILE_BEGIN)) && + (GetLastError() != NO_ERROR) ) + { + close(unix_handle); + return FALSE; + } } break; + + default: + FIXME("type=%x\n", type); + close(unix_handle); + return FALSE; } /* code for synchronous reads */ @@ -1877,9 +1890,26 @@ TRACE("%d %s %ld %p %p\n", hFile, debugstr_an(buffer, bytesToWrite), bytesToWrite, bytesWritten, overlapped ); return FILE_WriteConsole(hFile, buffer, bytesToWrite, bytesWritten, NULL); - default: - if (unix_handle == -1) - return FALSE; + + case FD_TYPE_DEFAULT: + if (unix_handle == -1) return FALSE; + + if(overlapped) + { + DWORD highOffset = overlapped->OffsetHigh; + if ( (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, overlapped->Offset, &highOffset, FILE_BEGIN)) && + (GetLastError() != NO_ERROR) ) + { + close(unix_handle); + return FALSE; + } + } + break; + + default: + FIXME("type=%x\n", type); + close(unix_handle); + return FALSE; } /* synchronous file write */ @@ -1975,7 +2005,7 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, DWORD method ) { - DWORD ret = 0xffffffff; + DWORD ret = INVALID_SET_FILE_POINTER; TRACE("handle %d offset %ld high %ld origin %ld\n", hFile, distance, highword?*highword:0, method ); @@ -2719,6 +2749,9 @@ DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ) { BOOL ret; + + FIXME("not implemented in server\n"); + SERVER_START_REQ( lock_file ) { req->handle = hFile; @@ -2770,6 +2803,9 @@ DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ) { BOOL ret; + + FIXME("not implemented in server\n"); + SERVER_START_REQ( unlock_file ) { req->handle = hFile; Index: wine/include/winbase.h =================================================================== RCS file: /home/wine/wine/include/winbase.h,v retrieving revision 1.154 diff -d -u -r1.154 winbase.h --- wine/include/winbase.h 31 Jul 2002 17:20:01 -0000 1.154 +++ wine/include/winbase.h 2 Aug 2002 21:15:56 -0000 @@ -286,7 +286,11 @@ #define PROCESS_HEAP_ENTRY_MOVEABLE 0x0010 #define PROCESS_HEAP_ENTRY_DDESHARE 0x0020 -#define INVALID_HANDLE_VALUE ((HANDLE) -1) +#define INVALID_HANDLE_VALUE ((HANDLE) -1) +#define INVALID_FILE_SIZE ((DWORD)0xFFFFFFFF) +#define INVALID_SET_FILE_POINTER ((DWORD)-1) +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) + #define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)