Fix for 64-bit negative seek value.

This commit is contained in:
Hidenori Takeshima 2000-07-31 23:26:50 +00:00 committed by Alexandre Julliard
parent 660b5105af
commit 66791afa8f
2 changed files with 8 additions and 5 deletions

View File

@ -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 );

View File

@ -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;
}