Delphi Pascal / Windows API - Small problem with SetFilePointerEx and parameter FILE_END

Posted by SuicideClutchX2 on Stack Overflow See other posts from Stack Overflow or by SuicideClutchX2
Published on 2011-01-01T23:43:10Z Indexed on 2011/01/01 23:53 UTC
Read the original article Hit count: 271

Filed under:
|
|
|

I know I am about to be slapped by at least one person who was helping me with this API.

Alright I have been able to use SetFilePointerEx just fine, when setting the position only.

SetFilePointerEx(PD,512,@PositionVar,FILE_BEGIN);
SetFilePointerEx(PD,0,@PositionVar,FILE_CURRENT);

Both work, I can set positions and even check my current one. But when I set FILE_END as per the documentation no matter what the second parameter is and whether or not i provide a pointer for the third parameter it fails even on a valid handle that many other operations are able to use without fail.

For Example:

SetFailed := SetFilePointerEx(PD,0,@PositionVar,FILE_END);
SetFailed := SetFilePointerEx(PD,0,nil,FILE_END);

Whatever I put it fails. I am working with a handle to a physical disk and it most definitely has an end. SetFilePointer works just fine its just a little more trouble than I would like.

Its not the end of the world, but whats happening.

© Stack Overflow or respective owner

Related posts about Windows

Related posts about delphi