This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Stream Extension Classes
Applies to: ~>3.0
function Seek(dlibMove: Largeint; dwOrigin: Longint; out libNewPosition: Largeint): HResult; virtual; stdcall;
Changes the seek pointer of the wrapped stream to a new location. The new location can be relative to the beginning of the stream, the end of the stream, or the current seek pointer position.
[~>3.0.0] This method cannot be used reliably on streams greater than MaxInt bytes in size. This is because the new stream position, passed out via the libNewPosition parameter is truncated to 32 bits, even though this is a 64 bit parameter. If the wrapped stream supports 64 bit offsets its new position will be set correctly, but the reported value in libNewPosition will be wrong.
[~>3.1] This method is reliable. The libNewPosition parameter is set correctly when the new stream position is greater than MaxInt.
It is possible that wrapped streams may support only 32 bit move offsets or be limited in size to MaxInt bytes. In such cases passing a value of more than MaxInt to the dlibMove parameter, or attempting to seek beyond MaxInt, can have unexpected results.
[~>3.0.0] The method will succeed, returning S_OK, even though the stream’s position will not be as expected.
[~>3.1] You can detect the 32 bit move offset or 32 bit stream size problems mentioned above because the value of libNewPosition will differ from dlibMove when the method returns.
Note that before Delphi 6 no TStream descendants supported 64 bit moves and all were limited to MaxInt bytes.
For non-Unicode versions of Delphi, TStringStream does not behave as expected for some seek operations.
This problem does not occur in any other stream class, or in Unicode versions of TStringStream.
[~>3.0.0] Setting dwOrigin to STREAM_SEEK_END when dlibMove will cause offsets to work the opposite way to that expected, i.e. a positive offset will move back in the stream.
[~>3.1] The problem is resolved. Although affected TStringStream classes still exhibit the problem, Seek intercepts and fixes the error. However, you can revert to earlier behaviour by undefining the FIX_TSTRINGSTREAM_SEEK_ERROR symbol in the PJStreamWrapper unit.