[PATCH] shcore: Don't return E_FAIL in IStream::SetSize() for read-only mode.
Alexandre Julliard
julliard at winehq.org
Mon Feb 4 12:09:44 CST 2019
Jactry Zeng <jzeng at codeweavers.com> writes:
> @@ -913,14 +913,21 @@ static HRESULT WINAPI filestream_Seek(IStream *iface, LARGE_INTEGER move, DWORD
> static HRESULT WINAPI filestream_SetSize(IStream *iface, ULARGE_INTEGER size)
> {
> struct shstream *stream = impl_from_IStream(iface);
> + DWORD origin;
>
> TRACE("(%p, %s)\n", stream, wine_dbgstr_longlong(size.QuadPart));
>
> - if (!SetFilePointer(stream->u.file.handle, size.QuadPart, NULL, FILE_BEGIN))
> + origin = SetFilePointer(stream->u.file.handle, 0, NULL, FILE_CURRENT);
> + if (SetFilePointer(stream->u.file.handle, size.QuadPart, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
While you're at it, using SetFilePointerEx() may be a good idea.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list