Commit a5d7fbfb authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

Converted implementation of _lseek to _lseeki64, implemented _lseek by

calling _lseeki64.
parent 11f4b444
......@@ -495,9 +495,9 @@ int _fcloseall(void)
/*********************************************************************
* _lseek (MSVCRT.@)
*/
LONG _lseek(int fd, LONG offset, int whence)
__int64 _lseeki64(int fd, __int64 offset, int whence)
{
DWORD ret;
DWORD ret, hoffset = (DWORD) (offset >> 32);
HANDLE hand = msvcrt_fdtoh(fd);
TRACE(":fd (%d) handle (%p)\n",fd,hand);
......@@ -510,17 +510,20 @@ LONG _lseek(int fd, LONG offset, int whence)
return -1;
}
TRACE(":fd (%d) to 0x%08lx pos %s\n",
fd,offset,(whence==SEEK_SET)?"SEEK_SET":
TRACE(":fd (%d) to 0x%08lx%08lx pos %s\n",
fd,hoffset,(long)offset,
(whence==SEEK_SET)?"SEEK_SET":
(whence==SEEK_CUR)?"SEEK_CUR":
(whence==SEEK_END)?"SEEK_END":"UNKNOWN");
if ((ret = SetFilePointer(hand, offset, NULL, whence)) != 0xffffffff)
if (((ret = SetFilePointer(hand, (long)offset, &hoffset,
whence)) != INVALID_SET_FILE_POINTER) || !GetLastError())
{
if (MSVCRT_files[fd])
MSVCRT_files[fd]->_flag &= ~MSVCRT__IOEOF;
/* FIXME: What if we seek _to_ EOF - is EOF set? */
return ret;
return ((__int64)hoffset << 32) | ret;
}
TRACE(":error-last error (%ld)\n",GetLastError());
if (MSVCRT_files[fd])
......@@ -538,6 +541,14 @@ LONG _lseek(int fd, LONG offset, int whence)
}
/*********************************************************************
* _lseek (MSVCRT.@)
*/
LONG _lseek(int fd, LONG offset, int whence)
{
return _lseeki64(fd, offset, whence);
}
/*********************************************************************
* _locking (MSVCRT.@)
*
* This is untested; the underlying LockFile doesn't work yet.
......
......@@ -327,7 +327,7 @@
@ cdecl _lrotr(long long) _lrotr
@ cdecl _lsearch(ptr ptr long long ptr) _lsearch
@ cdecl _lseek(long long long) _lseek
@ stub _lseeki64 #(long long long)
@ cdecl -ret64 _lseeki64(long long long) _lseeki64
@ forward _ltoa ntdll._ltoa
@ cdecl _ltow(long ptr long) _ltow
@ cdecl _makepath(str str str str str) _makepath
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment