From 66791afa8fe12dc9df31f2059ebfec4eb8b8fef7 Mon Sep 17 00:00:00 2001 From: Hidenori Takeshima Date: Mon, 31 Jul 2000 23:26:50 +0000 Subject: [PATCH] Fix for 64-bit negative seek value. --- files/file.c | 9 ++++++--- server/file.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/files/file.c b/files/file.c index f1e9fbe8749..77ce52f2ccc 100644 --- a/files/file.c +++ b/files/file.c @@ -1289,9 +1289,12 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, { struct set_file_pointer_request *req = get_req_buffer(); - if (highword && *highword) + if (highword && + ((distance >= 0 && *highword != 0) || (distance < 0 && *highword != -1))) { - FIXME("64-bit offsets not supported yet\n"); + FIXME("64-bit offsets not supported yet\n" + "SetFilePointer(%08x,%08lx,%08lx,%08lx)\n", + hFile,distance,*highword,method); SetLastError( ERROR_INVALID_PARAMETER ); return 0xffffffff; } @@ -1300,7 +1303,7 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, req->handle = hFile; req->low = distance; - req->high = highword ? *highword : 0; + req->high = highword ? *highword : (distance >= 0) ? 0 : -1; /* FIXME: assumes 1:1 mapping between Windows and Unix seek constants */ req->whence = method; SetLastError( 0 ); diff --git a/server/file.c b/server/file.c index 429a05aa891..f12e4f401ab 100644 --- a/server/file.c +++ b/server/file.c @@ -344,9 +344,9 @@ static int set_file_pointer( int handle, int *low, int *high, int whence ) struct file *file; int result; - if (*high) + if ((*low >= 0 && *high != 0) || (*low < 0 && *high != -1)) { - fprintf( stderr, "set_file_pointer: offset > 4Gb not supported yet\n" ); + fprintf( stderr, "set_file_pointer: offset > 2Gb not supported yet\n" ); set_error( STATUS_INVALID_PARAMETER ); return 0; }