Hi,all.

i use CreateFile open a large file more than 15GB. and then Set the file pointer use follow code. when the count<=512, it run well. but when count >= 522, it will return wrong? why this happen?


.WHILE TRUE
invoke SetFilePointer,hFile,8224768,NULL,FILE_CURRENT
.BREAK .IF count==522
.ENDW


note:

8224768*522/1024*1024*1024=3.99847412109375

if the SetfilePointer can only set FilePointer less than 4 GB?
Posted on 2004-12-02 01:53:47 by pick
DWORD SetFilePointer(

HANDLE hFile, // handle of file
LONG lDistanceToMove, // number of bytes to move file pointer
PLONG lpDistanceToMoveHigh, // address of high-order word of distance to move
DWORD dwMoveMethod // how to move
);

lpDistanceToMoveHigh

Points to the high-order word of the 64-bit distance to move. If the value of this parameter is NULL, SetFilePointer can operate only on files whose maximum size is 2^32 - 2. If this parameter is specified, the maximum file size is 2^64 - 2. This parameter also receives the high-order word of the new value of the file pointer.

notice how you set it to NULL ?

guess u didnt read the api documentation thoroughly enough
Posted on 2004-12-02 02:14:58 by evlncrn8
If all else fails, read the instructions.
Posted on 2004-12-02 02:27:11 by Homer
hi, evlncrn8. i use below code, it also return error.


High dd ?
.....
.....
invoke SetFilePointer,hFile,8224768,ADDR High,FILE_CURRENT
Posted on 2004-12-02 03:33:08 by pick
Some one help me?
Posted on 2004-12-02 08:24:17 by pick
Did you remember to set High equal to 0 first?
Posted on 2004-12-02 10:30:40 by Sephiroth3
Did you remember to set High equal to 0 first?


i also try it, but also wrong.
Posted on 2004-12-02 11:27:02 by pick
Windows Me/98/95: If the pointer lpDistanceToMoveHigh is not NULL, then it must point to either 0, INVALID_SET_FILE_POINTER, or the sign extension of the value of lDistanceToMove. Any other value will be rejected.

which windows do you use?

lDistanceToMove is a 32bit _SIGNED_ value, so when lpDistanceToMoveHigh is set to null, and you move the pointer using FILE_CURRENT ,then u move to the end of file, and then start going backwards :P

and read the error code - it helps sometimes :)
Posted on 2004-12-07 17:14:33 by ti_mo_n
thanks to all, i have resolve the problem. i just forgot to made th high part of the distance to Zero each loop. just like below. since after each
SetFilePointer call, the High will receive a value. the value made this problem.

High dd ?
.....
.....
invoke SetFilePointer,hFile,8224768,ADDR High,FILE_CURRENT
mov High,0
Posted on 2004-12-07 20:15:05 by pick
Just a sidenote, are you using this just to set the filepointer position, or are you doing stuff at each loop iteration? If you're just setting the file position, it would be more efficient to do an absolute set from FILE_BEGIN instead :)
Posted on 2004-12-08 00:29:41 by f0dder
And, if you are only reading the file, you may not even have to set the file pointer and still read the entire file in sections. The ReadFile function can adjust the pointer after each read.

Raymond
Posted on 2004-12-08 10:31:42 by Raymond
Just a sidenote, are you using this just to set the filepointer position, or are you doing stuff at each loop iteration? If you're just setting the file position, it would be more efficient to do an absolute set from FILE_BEGIN instead :)


i doing stuff at each loop.
Posted on 2004-12-08 20:23:27 by pick
And, if you are only reading the file, you may not even have to set the file pointer and still read the entire file in sections. The ReadFile function can adjust the pointer after each read.

Raymond


i need to read some place that not sequence
Posted on 2004-12-08 20:27:31 by pick