PR_Read() can not read big file(4G+) on win32
threemouth xu <[email protected]> Tue, 7 May 2013 13:58:37 +0800
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
when i use nspr 4.9.6 and PR_Read() a big file (7.8G) on win2k3, i can not reach the EOF;i got more data than 7.8G.code line 2185 in file ntio.c may be wrong while reading bigfile(4G+)me->md.overlapped.overlapped.Offset = SetFilePointer((HANDLE)f, 0, &me->md.overlapped.overlapped.OffsetHigh, FILE_CURRENT); (From msdn about SetFilePointerEx Function)To specify the offset for overlapped operations, use the Offset and OffsetHigh members of the OVERLAPPED structure. code line 2289 in file ntio.c there is a winapi bug(?)SetFilePointer((HANDLE)f, me->md.blocked_io_bytes, 0, FILE_CURRENT); SetFilePointer() can not op ok when the final file pointer is big than 4G, it will return INVALID_SET_FILE_POINTER and GetLastError() is 87(ERROR_INVALID_PARAMETER)follow sample code will be ok:LARGE_INTEGER liDistanceToMove;...liDistanceToMove.LowPart = me->md.blocked_io_bytes; liDistanceToMove.HighPart = 0; SetFilePointerEx((HANDLE)f,liDistanceToMove,&CurrFilePointer,FILE_CURRENT); i just test on win2k3_x86 with msvc6.