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?
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?
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
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
If all else fails, read the instructions.
hi, evlncrn8. i use below code, it also return error.
High dd ?
.....
.....
invoke SetFilePointer,hFile,8224768,ADDR High,FILE_CURRENT
High dd ?
.....
.....
invoke SetFilePointer,hFile,8224768,ADDR High,FILE_CURRENT
Some one help me?
Did you remember to set High equal to 0 first?
Did you remember to set High equal to 0 first?
i also try it, but also wrong.
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 :)
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
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
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 :)
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
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.
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
Raymond
i need to read some place that not sequence