Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/scaler.c | 2 +- dlls/windowscodecs/tests/bitmap.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c index 3789831a97..eedc1bbac4 100644 --- a/dlls/windowscodecs/scaler.c +++ b/dlls/windowscodecs/scaler.c @@ -163,7 +163,7 @@ static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface, return E_INVALIDARG;
if (!This->source) - return WINCODEC_ERR_WRONGSTATE; + return WINCODEC_ERR_PALETTEUNAVAILABLE;
return IWICBitmapSource_CopyPalette(This->source, pIPalette); } diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index 2b5c373bf9..d4b597900d 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -1084,6 +1084,7 @@ static void test_bitmap_scaler(void) { WICPixelFormatGUID pixel_format; IWICBitmapScaler *scaler; + IWICPalette *palette; double res_x, res_y; IWICBitmap *bitmap; UINT width, height; @@ -1148,6 +1149,15 @@ static void test_bitmap_scaler(void) ok(width == 123, "Unexpected width %u.\n", width); ok(height == 321, "Unexpected height %u.\n", height);
+ hr = IWICBitmapScaler_CopyPalette(scaler, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr); + hr = IWICBitmapScaler_CopyPalette(scaler, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr); + IWICPalette_Release(palette); + hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 4, 0, WICBitmapInterpolationModeNearestNeighbor); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -1224,6 +1234,12 @@ static void test_bitmap_scaler(void) ok(hr == S_OK, "Failed to get scaler resolution, hr %#x.\n", hr); ok(res_x == 0.0 && res_y == 0.0, "Unexpected resolution %f x %f.\n", res_x, res_y);
+ hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr); + hr = IWICBitmapScaler_CopyPalette(scaler, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr); + IWICPalette_Release(palette); + IWICBitmapScaler_Release(scaler);
IWICBitmap_Release(bitmap);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/bmpencode.c | 5 +++++ dlls/windowscodecs/jpegformat.c | 12 ++++++++---- dlls/windowscodecs/pngformat.c | 12 ++++++++---- dlls/windowscodecs/tests/converter.c | 24 ++++++++++++++++++++++++ dlls/windowscodecs/tiffformat.c | 5 +++++ 5 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index fb04f9ddb2..b8783a499e 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -472,6 +472,11 @@ static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface, static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) { + TRACE("(%p,%p)\n", iface, pguidContainerFormat); + + if (!pguidContainerFormat) + return E_INVALIDARG; + memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID)); return S_OK; } diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index bb3d418667..451d725eb8 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -1381,11 +1381,15 @@ static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, - GUID *pguidContainerFormat) +static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) { - FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat)); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, format); + + if (!format) + return E_INVALIDARG; + + memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format)); + return S_OK; }
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 3ac7dee896..fc1f7569e9 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -1968,11 +1968,15 @@ static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, - GUID *pguidContainerFormat) +static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) { - FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat)); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, format); + + if (!format) + return E_INVALIDARG; + + memcpy(format, &GUID_ContainerFormatPng, sizeof(*format)); + return S_OK; }
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 5f9f1d88a3..1e557a7fb8 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -849,6 +849,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette) { + const GUID *container_format = NULL; HRESULT hr; IWICBitmapEncoder *encoder; BitmapTestSrc *src_obj; @@ -859,6 +860,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat; + GUID guid; int i;
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER, @@ -868,6 +870,28 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
+ hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder)) + container_format = &GUID_ContainerFormatPng; + else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder)) + container_format = &GUID_ContainerFormatBmp; + else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder)) + container_format = &GUID_ContainerFormatTiff; + else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder)) + container_format = &GUID_ContainerFormatJpeg; + else + ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder)); + + if (container_format) + { + memset(&guid, 0, sizeof(guid)); + hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid); + ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr); + ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid)); + } + hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 67773fd32f..f9a61d4ac1 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -1884,6 +1884,11 @@ exit: static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) { + TRACE("(%p,%p)\n", iface, pguidContainerFormat); + + if (!pguidContainerFormat) + return E_INVALIDARG; + memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)); return S_OK; }
On Thu, Nov 29, 2018 at 7:04 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/windowscodecs/bmpencode.c | 5 +++++ dlls/windowscodecs/jpegformat.c | 12 ++++++++---- dlls/windowscodecs/pngformat.c | 12 ++++++++---- dlls/windowscodecs/tests/converter.c | 24 ++++++++++++++++++++++++ dlls/windowscodecs/tiffformat.c | 5 +++++ 5 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index fb04f9ddb2..b8783a499e 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -472,6 +472,11 @@ static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface, static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
- memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID)); return S_OK;
} diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index bb3d418667..451d725eb8 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -1381,11 +1381,15 @@ static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
- TRACE("(%p,%p)\n", iface, format);
- if (!format)
return E_INVALIDARG;
- memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format));
Nitpick: It could be written as "*pguidContainerFormat = GUID_ContainerFormatJpeg;".
- return S_OK;
}
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 3ac7dee896..fc1f7569e9 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -1968,11 +1968,15 @@ static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
- TRACE("(%p,%p)\n", iface, format);
- if (!format)
return E_INVALIDARG;
- memcpy(format, &GUID_ContainerFormatPng, sizeof(*format));
- return S_OK;
}
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 5f9f1d88a3..1e557a7fb8 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -849,6 +849,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette) {
- const GUID *container_format = NULL; HRESULT hr; IWICBitmapEncoder *encoder; BitmapTestSrc *src_obj;
@@ -859,6 +860,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat;
GUID guid; int i;
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
@@ -868,6 +870,28 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
- hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
- ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
container_format = &GUID_ContainerFormatPng;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
container_format = &GUID_ContainerFormatBmp;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
container_format = &GUID_ContainerFormatTiff;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
container_format = &GUID_ContainerFormatJpeg;
- else
ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
- if (container_format)
- {
memset(&guid, 0, sizeof(guid));
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
- }
- hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 67773fd32f..f9a61d4ac1 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -1884,6 +1884,11 @@ exit: static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
- memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)); return S_OK;
}
2.19.2
On 11/29/18 10:45 AM, Józef Kucia wrote:
On Thu, Nov 29, 2018 at 7:04 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/windowscodecs/bmpencode.c | 5 +++++ dlls/windowscodecs/jpegformat.c | 12 ++++++++---- dlls/windowscodecs/pngformat.c | 12 ++++++++---- dlls/windowscodecs/tests/converter.c | 24 ++++++++++++++++++++++++ dlls/windowscodecs/tiffformat.c | 5 +++++ 5 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index fb04f9ddb2..b8783a499e 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -472,6 +472,11 @@ static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface, static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
}memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID)); return S_OK;
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index bb3d418667..451d725eb8 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -1381,11 +1381,15 @@ static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
- TRACE("(%p,%p)\n", iface, format);
- if (!format)
return E_INVALIDARG;
- memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format));
Nitpick: It could be written as "*pguidContainerFormat = GUID_ContainerFormatJpeg;".
It could, I did it like that to match existing, implemented methods.
return S_OK; }
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 3ac7dee896..fc1f7569e9 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -1968,11 +1968,15 @@ static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
+static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) {
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
TRACE("(%p,%p)\n", iface, format);
if (!format)
return E_INVALIDARG;
memcpy(format, &GUID_ContainerFormatPng, sizeof(*format));
return S_OK; }
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 5f9f1d88a3..1e557a7fb8 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -849,6 +849,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, const struct setting *settings, const char *name, IWICPalette *palette) {
- const GUID *container_format = NULL; HRESULT hr; IWICBitmapEncoder *encoder; BitmapTestSrc *src_obj;
@@ -859,6 +860,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat;
GUID guid; int i;
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
@@ -868,6 +870,28 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
- hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
- ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
container_format = &GUID_ContainerFormatPng;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
container_format = &GUID_ContainerFormatBmp;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
container_format = &GUID_ContainerFormatTiff;
- else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
container_format = &GUID_ContainerFormatJpeg;
- else
ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
- if (container_format)
- {
memset(&guid, 0, sizeof(guid));
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
- }
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache); ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 67773fd32f..f9a61d4ac1 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -1884,6 +1884,11 @@ exit: static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *pguidContainerFormat) {
- TRACE("(%p,%p)\n", iface, pguidContainerFormat);
- if (!pguidContainerFormat)
return E_INVALIDARG;
}memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)); return S_OK;
-- 2.19.2
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/tests/stream.c | 394 ++++++++++++++++++++++++++---- 1 file changed, 343 insertions(+), 51 deletions(-)
diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c index 5f311b897b..395be433d4 100644 --- a/dlls/windowscodecs/tests/stream.c +++ b/dlls/windowscodecs/tests/stream.c @@ -21,6 +21,22 @@ #define COBJMACROS #include "wincodec.h"
+#define CHECK_CUR_POS(a, b) _check_cur_pos((IStream *)a, b, FALSE, __LINE__) +#define CHECK_CUR_POS_TODO(a, b) _check_cur_pos((IStream *)a, b, TRUE, __LINE__) +static void _check_cur_pos(IStream *stream, ULONGLONG expected_pos, BOOL todo, unsigned int line) +{ + LARGE_INTEGER offset; + ULARGE_INTEGER pos; + HRESULT hr; + + offset.QuadPart = 0; + hr = IStream_Seek(stream, offset, STREAM_SEEK_CUR, &pos); + ok(hr == S_OK, "Failed to get current position, hr %#x.\n", hr); +todo_wine_if(todo) + ok_(__FILE__, line)(pos.QuadPart == expected_pos, "Unexpected stream position %s.\n", + wine_dbgstr_longlong(pos.QuadPart)); +} + static void test_StreamOnMemory(void) { IWICImagingFactory *pFactory; @@ -51,8 +67,6 @@ static void test_StreamOnMemory(void)
memcpy(Memory, CmpMem, sizeof(CmpMem));
- CoInitialize(NULL); - hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&pFactory); if(FAILED(hr)) { skip("CoCreateInstance returned with %#x, expected %#x\n", hr, S_OK); @@ -113,9 +127,7 @@ static void test_StreamOnMemory(void) hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_SET, &uNewPos); ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "Seek returned with %#x, expected %#x\n", hr, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = sizeof(Memory) + 10; uNewPos.u.HighPart = 0xdeadbeef; @@ -123,9 +135,7 @@ static void test_StreamOnMemory(void) hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_SET, &uNewPos); ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = 1; uNewPos.u.HighPart = 0xdeadbeef; @@ -133,9 +143,7 @@ static void test_StreamOnMemory(void) hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos); ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = -1; hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos); @@ -150,12 +158,9 @@ static void test_StreamOnMemory(void) ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "Seek returned with %#x, expected %#x\n", hr, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); /* remains unchanged */ + CHECK_CUR_POS(pStream, 0); IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL);
- /* Read */ hr = IWICStream_Read(pStream, MemBuf, 12, &uBytesRead); ok(hr == S_OK, "Read returned with %#x, expected %#x\n", hr, S_OK); @@ -164,8 +169,7 @@ static void test_StreamOnMemory(void) ok(memcmp(MemBuf, CmpMem, 12) == 0, "Read returned invalid data!\n");
/* check whether the seek pointer has moved correctly */ - IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == uBytesRead, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, uBytesRead); + CHECK_CUR_POS(pStream, uBytesRead); }
IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL); @@ -234,8 +238,7 @@ static void test_StreamOnMemory(void) ok(memcmp(MemBuf, Memory, 3) == 0, "Wrote returned invalid data!\n"); /* make sure we're writing directly */
/* check whether the seek pointer has moved correctly */ - IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == uBytesWritten, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, uBytesWritten); + CHECK_CUR_POS(pStream, uBytesWritten); } IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -262,22 +265,19 @@ static void test_StreamOnMemory(void) hr = IWICStream_Write(pStream, NULL, 3, &uBytesWritten); ok(hr == E_INVALIDARG, "Write returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
uBytesWritten = 0xdeadbeef; hr = IWICStream_Write(pStream, NULL, 0, &uBytesWritten); ok(hr == E_INVALIDARG, "Write returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
uBytesWritten = 0xdeadbeef; hr = IWICStream_Write(pStream, CmpMem, sizeof(Memory) + 10, &uBytesWritten); ok(hr == STG_E_MEDIUMFULL, "Write returned with %#x, expected %#x\n", hr, STG_E_MEDIUMFULL); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0); IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -380,7 +380,6 @@ static void test_StreamOnMemory(void)
IWICStream_Release(pStream); IWICImagingFactory_Release(pFactory); - CoUninitialize(); }
static void test_StreamOnStreamRange(void) @@ -441,13 +440,16 @@ static void test_StreamOnStreamRange(void) }
/* Seek */ + CHECK_CUR_POS(pStream, 0); hr = IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_END, &uNewPos); ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 20, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 20); ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); + CHECK_CUR_POS(pStream, 0);
hr = IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, &uNewPos); ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
hr = IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL); ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); @@ -459,9 +461,7 @@ static void test_StreamOnStreamRange(void) hr = IWICStream_Seek(pSubStream, LargeInt, STREAM_SEEK_SET, &uNewPos); ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "Seek returned with %#x, expected %#x\n", hr, WINCODEC_ERR_VALUEOUTOFRANGE); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = 30; uNewPos.u.HighPart = 0xdeadbeef; @@ -469,9 +469,7 @@ static void test_StreamOnStreamRange(void) hr = IWICStream_Seek(pSubStream, LargeInt, STREAM_SEEK_SET, &uNewPos); ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "Seek returned with %#x, expected %#x\n", hr, WINCODEC_ERR_VALUEOUTOFRANGE); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = 1; uNewPos.u.HighPart = 0xdeadbeef; @@ -479,14 +477,13 @@ static void test_StreamOnStreamRange(void) hr = IWICStream_Seek(pSubStream, LargeInt, STREAM_SEEK_END, &uNewPos); ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "Seek returned with %#x, expected %#x\n", hr, WINCODEC_ERR_VALUEOUTOFRANGE); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pStream, 0);
LargeInt.QuadPart = -1; hr = IWICStream_Seek(pSubStream, LargeInt, STREAM_SEEK_END, &uNewPos); ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 19, "bSeek cursor moved to position (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart); + CHECK_CUR_POS(pStream, 0);
IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, &uNewPos); /* reset seek pointer */ LargeInt.QuadPart = -25; @@ -496,9 +493,7 @@ static void test_StreamOnStreamRange(void) ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "Seek returned with %#x, expected %#x\n", hr, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)); ok(uNewPos.u.HighPart == 0xdeadbeef && uNewPos.u.LowPart == 0xdeadbeef, "Seek cursor initialized to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0xdeadbeef, 0xdeadbeef); - hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); /* remains unchanged */ + CHECK_CUR_POS(pStream, 0); IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -510,8 +505,8 @@ static void test_StreamOnStreamRange(void) ok(memcmp(MemBuf, CmpMem+20, 12) == 0, "Read returned invalid data!\n");
/* check whether the seek pointer has moved correctly */ - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == uBytesRead, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, uBytesRead); + CHECK_CUR_POS(pSubStream, uBytesRead); + CHECK_CUR_POS(pStream, 0); }
IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL); @@ -522,6 +517,7 @@ static void test_StreamOnStreamRange(void) ok(uBytesRead == 10, "Read %u bytes, expected %u\n", uBytesRead, 10); ok(memcmp(Memory, CmpMem+20, uBytesRead) == 0, "Read returned invalid data!\n"); } + CHECK_CUR_POS(pStream, 0);
IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -531,6 +527,7 @@ static void test_StreamOnStreamRange(void) ok(uBytesRead == 20, "Read %u bytes\n", uBytesRead); ok(memcmp(Memory, CmpMem+20, uBytesRead) == 0, "Read returned invalid data!\n"); } + CHECK_CUR_POS(pStream, 0);
IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL); uBytesRead = 0xdeadbeef; @@ -574,8 +571,8 @@ static void test_StreamOnStreamRange(void) ok(memcmp(MemBuf, Memory+20, 3) == 0, "Wrote returned invalid data!\n"); /* make sure we're writing directly */
/* check whether the seek pointer has moved correctly */ - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == uBytesWritten, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, uBytesWritten); + CHECK_CUR_POS(pSubStream, uBytesWritten); + CHECK_CUR_POS(pStream, 0); } IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -586,21 +583,21 @@ static void test_StreamOnStreamRange(void) hr = IWICStream_Write(pSubStream, NULL, 3, &uBytesWritten); ok(hr == E_INVALIDARG, "Write returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pSubStream, 0); + CHECK_CUR_POS(pStream, 0);
uBytesWritten = 0xdeadbeef; hr = IWICStream_Write(pSubStream, NULL, 0, &uBytesWritten); ok(hr == E_INVALIDARG, "Write returned with %#x, expected %#x\n", hr, E_INVALIDARG); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); + CHECK_CUR_POS(pSubStream, 0); + CHECK_CUR_POS(pStream, 0);
hr = IWICStream_Write(pSubStream, CmpMem, 30, &uBytesWritten); ok(hr == S_OK, "Write returned with %#x, expected %#x\n", hr, STG_E_MEDIUMFULL); ok(uBytesWritten == 20, "Wrote %u bytes, expected %u\n", uBytesWritten, 0); - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == uBytesWritten, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, uBytesWritten); + CHECK_CUR_POS(pSubStream, uBytesWritten); + CHECK_CUR_POS(pStream, 0); IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_SET, NULL);
@@ -727,9 +724,8 @@ static void test_StreamOnStreamRange(void) hr = IWICStream_Write(pSubStream, CmpMem, 32, &uBytesWritten); ok(hr == STG_E_MEDIUMFULL, "Write returned with %#x, expected %#x\n", hr, STG_E_MEDIUMFULL); ok(uBytesWritten == 0xdeadbeef, "Expected uBytesWritten to be unchanged, got %u\n", uBytesWritten); - IWICStream_Seek(pSubStream, LargeNull, STREAM_SEEK_CUR, &uNewPos); - ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); - + CHECK_CUR_POS(pSubStream, 0); + CHECK_CUR_POS(pStream, 0);
IWICStream_Release(pSubStream); IWICStream_Release(pStream); @@ -737,8 +733,304 @@ static void test_StreamOnStreamRange(void) CoUninitialize(); }
+static void test_StreamOnIStream(void) +{ + static const BYTE data[] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + }; + static const LARGE_INTEGER zero_pos; + static const ULARGE_INTEGER uzero; + IWICStream *stream, *substream; + IWICImagingFactory *factory; + BYTE memory[64], buff[64]; + ULONG read_len, written; + ULARGE_INTEGER newpos; + IStream *copy_stream; + LARGE_INTEGER pos; + unsigned int i; + STATSTG stats; + HRESULT hr; + + memcpy(memory, data, sizeof(data)); + + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void **)&factory); + ok(hr == S_OK, "Failed to create a factory, hr %#x.\n", hr); + + hr = IWICImagingFactory_CreateStream(factory, &stream); + ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr); + + hr = IWICStream_InitializeFromMemory(stream, memory, sizeof(memory)); + ok(hr == S_OK, "Failed to initialize stream, hr %#x.", hr); + + hr = IWICImagingFactory_CreateStream(factory, &substream); + ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr); + + pos.QuadPart = 1; + hr = IWICStream_Seek(stream, pos, STREAM_SEEK_SET, &newpos); + ok(hr == S_OK, "Failed to set position, hr %#x.\n", hr); + CHECK_CUR_POS(stream, 1); + + hr = IWICStream_InitializeFromIStream(substream, (IStream *)stream); + ok(hr == S_OK, "Failed to initialize stream, hr %#x.\n", hr); + CHECK_CUR_POS_TODO(substream, 1); + + /* Seek */ + CHECK_CUR_POS(stream, 1); + hr = IWICStream_Seek(substream, zero_pos, STREAM_SEEK_END, &newpos); + ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); + ok(newpos.QuadPart == sizeof(memory), "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS(substream, sizeof(memory)); + CHECK_CUR_POS_TODO(stream, sizeof(memory)); + + hr = IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, &newpos); + ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); + ok(newpos.QuadPart == 0, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(substream, 0); + + hr = IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); + + pos.u.HighPart = 1; + pos.u.LowPart = 0; + newpos.u.HighPart = 0xdeadbeef; + newpos.u.LowPart = 0xdeadbeef; + hr = IWICStream_Seek(substream, pos, STREAM_SEEK_SET, &newpos); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "Unexpected hr %#x.\n", hr); + ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", + wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(substream, 0); + + pos.QuadPart = sizeof(memory) + 1; + newpos.u.HighPart = 0xdeadbeef; + newpos.u.LowPart = 0xdeadbeef; + hr = IWICStream_Seek(substream, pos, STREAM_SEEK_SET, &newpos); +todo_wine { + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", + wine_dbgstr_longlong(newpos.QuadPart)); +} + CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS_TODO(substream, 0); + + pos.QuadPart = 1; + newpos.u.HighPart = 0xdeadbeef; + newpos.u.LowPart = 0xdeadbeef; + hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", + wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS_TODO(substream, 0); + + pos.QuadPart = -1; + hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); + ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); + ok(newpos.QuadPart == sizeof(memory) - 1, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS_TODO(stream, sizeof(memory) - 1); + CHECK_CUR_POS(substream, sizeof(memory) - 1); + + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, &newpos); /* reset seek pointer */ + pos.QuadPart = -sizeof(memory) - 1; + newpos.u.HighPart = 0xdeadbeef; + newpos.u.LowPart = 0xdeadbeef; + hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", + wine_dbgstr_longlong(newpos.QuadPart)); + CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(substream, 0); + + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + + /* Read */ + hr = IWICStream_Read(substream, buff, 12, &read_len); + ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); + ok(read_len == 12, "Unexpected read length %u.\n", read_len); + ok(!memcmp(buff, data, 12), "Unexpected data.\n"); + CHECK_CUR_POS(substream, read_len); + CHECK_CUR_POS_TODO(stream, read_len); + + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + CHECK_CUR_POS_TODO(stream, 0); + + hr = IWICStream_Read(substream, memory, 10, &read_len); /* source = dest */ + ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); + ok(read_len == 10, "Unexpected read length %u.\n", read_len); + ok(!memcmp(memory, data, read_len), "Unexpected data.\n"); + CHECK_CUR_POS_TODO(stream, 10); + + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + hr = IWICStream_Read(substream, memory, 2 * sizeof(data), &read_len); /* request too many bytes */ + ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); + ok(read_len == 64, "Unexpected read length %u.\n", read_len); + ok(!memcmp(memory, data, read_len), "Unexpected data.\n"); + CHECK_CUR_POS_TODO(stream, sizeof(data)); + + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + read_len = 0xdeadbeef; + hr = IWICStream_Read(substream, NULL, 1, &read_len); /* destination buffer = NULL */ + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(read_len == 0xdeadbeef, "Unexpected read length %u.\n", read_len); + + read_len = 1; + hr = IWICStream_Read(substream, buff, 0, &read_len); /* read 0 bytes */ + ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); + ok(read_len == 0, "Unexpected read length %u.\n", read_len); + + read_len = 0xdeadbeef; + hr = IWICStream_Read(substream, NULL, 0, &read_len); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(read_len == 0xdeadbeef, "Unexpected read length %u.\n", read_len); + + hr = IWICStream_Read(substream, NULL, 0, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Read(substream, buff, 1, NULL); + ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); + CHECK_CUR_POS(substream, 1); + CHECK_CUR_POS(stream, 1); + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + + /* Write */ + for (i = 0; i < 3; ++i) + buff[i] = data[i] + 1; + + hr = IWICStream_Write(substream, buff, 3, &written); + ok(hr == S_OK, "Failed to write to stream, hr %#x.\n", hr); + ok(written == 3, "Unexpected written length %u.\n", written); + ok(!memcmp(buff, memory, 3), "Unexpected stream data.\n"); + CHECK_CUR_POS(substream, written); + CHECK_CUR_POS_TODO(stream, written); + IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); + + hr = IWICStream_Write(substream, buff, 0, &written); + ok(hr == S_OK, "Failed to write to stream, hr %#x.\n", hr); + + written = 0xdeadbeef; + hr = IWICStream_Write(substream, NULL, 3, &written); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(written == 0xdeadbeef, "Unexpected written length %u.\n", written); + CHECK_CUR_POS(substream, 0); + CHECK_CUR_POS_TODO(stream, 0); + + written = 0xdeadbeef; + hr = IWICStream_Write(substream, NULL, 0, &written); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(written == 0xdeadbeef, "Unexpected written length %u.\n", written); + CHECK_CUR_POS(substream, 0); + CHECK_CUR_POS_TODO(stream, 0); + + /* SetSize */ + newpos.u.HighPart = 0; + newpos.u.LowPart = sizeof(memory) + 10; + hr = IWICStream_SetSize(substream, newpos); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + newpos.u.HighPart = 0; + newpos.u.LowPart = sizeof(memory); + hr = IWICStream_SetSize(substream, newpos); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + newpos.u.HighPart = 0; + newpos.u.LowPart = sizeof(memory) - 10; + hr = IWICStream_SetSize(substream, newpos); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + newpos.QuadPart = 0; + hr = IWICStream_SetSize(substream, newpos); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + newpos.QuadPart = -10; + hr = IWICStream_SetSize(substream, newpos); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + /* CopyTo */ + newpos.u.HighPart = 0; + newpos.u.LowPart = 30; + hr = IWICStream_CopyTo(substream, NULL, newpos, NULL, NULL); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = CreateStreamOnHGlobal(NULL, TRUE, ©_stream); + ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr); + + hr = IWICStream_CopyTo(substream, copy_stream, newpos, NULL, NULL); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + IStream_Release(copy_stream); + + /* Commit */ + hr = IWICStream_Commit(substream, STGC_DEFAULT); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Commit(substream, STGC_OVERWRITE); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Commit(substream, STGC_ONLYIFCURRENT); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Commit(substream, STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Commit(substream, STGC_CONSOLIDATE); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + /* Revert */ + IWICStream_Write(substream, buff + 5, 6, NULL); + hr = IWICStream_Revert(substream); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + memcpy(memory, data, sizeof(memory)); + + /* LockRegion/UnlockRegion */ + hr = IWICStream_LockRegion(substream, uzero, uzero, 0); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_UnlockRegion(substream, uzero, uzero, 0); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + /* Stat */ + hr = IWICStream_Stat(substream, NULL, 0); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IWICStream_Stat(substream, &stats, 0); + ok(hr == S_OK, "Failed to get stream stats, hr %#x.\n", hr); + ok(stats.pwcsName == NULL, "Unexpected name %p.\n", stats.pwcsName); + ok(stats.type == STGTY_STREAM, "Unexpected type %d.\n", stats.type); + ok(stats.cbSize.QuadPart == sizeof(data), "Unexpected size %s.\n", wine_dbgstr_longlong(stats.cbSize.QuadPart)); + ok(stats.mtime.dwHighDateTime == 0 && stats.mtime.dwLowDateTime == 0, "Unexpected mtime (%u;%u).\n", + stats.mtime.dwHighDateTime, stats.mtime.dwLowDateTime); + ok(stats.ctime.dwHighDateTime == 0 && stats.ctime.dwLowDateTime == 0, "Unexpected ctime (%u;%u).\n", + stats.ctime.dwHighDateTime, stats.ctime.dwLowDateTime); + ok(stats.atime.dwHighDateTime == 0 && stats.atime.dwLowDateTime == 0, "Unexpected atime (%u;%u).\n", + stats.atime.dwHighDateTime, stats.atime.dwLowDateTime); + ok(stats.grfMode == 0, "Unexpected mode %d.\n", stats.grfMode); + ok(stats.grfLocksSupported == 0, "Unexpected locks support %#x.\n", stats.grfLocksSupported); + ok(stats.grfStateBits == 0, "Unexpected state bits %#x.\n", stats.grfStateBits); + + /* Clone */ + hr = IWICStream_Clone(substream, ©_stream); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + IWICStream_Release(substream); + IWICStream_Release(stream); + IWICImagingFactory_Release(factory); +} + START_TEST(stream) { + CoInitialize(NULL); + test_StreamOnMemory(); test_StreamOnStreamRange(); + test_StreamOnIStream(); + + CoUninitialize(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=45154
Your paranoid android.
=== wvistau64 (64 bit report) ===
windowscodecs: stream.c:847: Test failed: Unexpected hr 0x80070216.
=== w2008s64 (64 bit report) ===
windowscodecs: stream.c:847: Test failed: Unexpected hr 0x80070216.
=== w7pro64 (64 bit report) ===
windowscodecs: stream.c:847: Test failed: Unexpected hr 0x80070216.
=== w864 (64 bit report) ===
windowscodecs: stream.c:847: Test failed: Unexpected hr 0x80070216.
=== w1064 (64 bit report) ===
windowscodecs: stream.c:847: Test failed: Unexpected hr 0x80070216.
On Thu, Nov 29, 2018 at 7:04 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/windowscodecs/tests/stream.c | 394 ++++++++++++++++++++++++++---- 1 file changed, 343 insertions(+), 51 deletions(-)
diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c index 5f311b897b..395be433d4 100644 --- a/dlls/windowscodecs/tests/stream.c +++ b/dlls/windowscodecs/tests/stream.c @@ -21,6 +21,22 @@ #define COBJMACROS #include "wincodec.h"
+#define CHECK_CUR_POS(a, b) _check_cur_pos((IStream *)a, b, FALSE, __LINE__) +#define CHECK_CUR_POS_TODO(a, b) _check_cur_pos((IStream *)a, b, TRUE, __LINE__) +static void _check_cur_pos(IStream *stream, ULONGLONG expected_pos, BOOL todo, unsigned int line) +{
- LARGE_INTEGER offset;
- ULARGE_INTEGER pos;
- HRESULT hr;
- offset.QuadPart = 0;
- hr = IStream_Seek(stream, offset, STREAM_SEEK_CUR, &pos);
- ok(hr == S_OK, "Failed to get current position, hr %#x.\n", hr);
I think you should pass "line" to ok() call.
+todo_wine_if(todo)
- ok_(__FILE__, line)(pos.QuadPart == expected_pos, "Unexpected stream position %s.\n",
wine_dbgstr_longlong(pos.QuadPart));
+}
On 11/29/18 10:44 AM, Józef Kucia wrote:
On Thu, Nov 29, 2018 at 7:04 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/windowscodecs/tests/stream.c | 394 ++++++++++++++++++++++++++---- 1 file changed, 343 insertions(+), 51 deletions(-)
diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c index 5f311b897b..395be433d4 100644 --- a/dlls/windowscodecs/tests/stream.c +++ b/dlls/windowscodecs/tests/stream.c @@ -21,6 +21,22 @@ #define COBJMACROS #include "wincodec.h"
+#define CHECK_CUR_POS(a, b) _check_cur_pos((IStream *)a, b, FALSE, __LINE__) +#define CHECK_CUR_POS_TODO(a, b) _check_cur_pos((IStream *)a, b, TRUE, __LINE__) +static void _check_cur_pos(IStream *stream, ULONGLONG expected_pos, BOOL todo, unsigned int line) +{
- LARGE_INTEGER offset;
- ULARGE_INTEGER pos;
- HRESULT hr;
- offset.QuadPart = 0;
- hr = IStream_Seek(stream, offset, STREAM_SEEK_CUR, &pos);
- ok(hr == S_OK, "Failed to get current position, hr %#x.\n", hr);
I think you should pass "line" to ok() call.
Sure, I'm going to resend anyway. It's not important in practice, but may be better for consistency.
+todo_wine_if(todo)
- ok_(__FILE__, line)(pos.QuadPart == expected_pos, "Unexpected stream position %s.\n",
wine_dbgstr_longlong(pos.QuadPart));
+}
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/stream.c | 106 ++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 46 deletions(-)
diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c index 308ef8e02b..ae90dfd379 100644 --- a/dlls/windowscodecs/stream.c +++ b/dlls/windowscodecs/stream.c @@ -101,7 +101,8 @@ static HRESULT WINAPI StreamOnMemory_Read(IStream *iface, { StreamOnMemory *This = StreamOnMemory_from_IStream(iface); ULONG uBytesRead; - TRACE("(%p)\n", This); + + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!pv) return E_INVALIDARG;
@@ -121,7 +122,8 @@ static HRESULT WINAPI StreamOnMemory_Write(IStream *iface, { StreamOnMemory *This = StreamOnMemory_from_IStream(iface); HRESULT hr; - TRACE("(%p)\n", This); + + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!pv) return E_INVALIDARG;
@@ -146,7 +148,8 @@ static HRESULT WINAPI StreamOnMemory_Seek(IStream *iface, StreamOnMemory *This = StreamOnMemory_from_IStream(iface); LARGE_INTEGER NewPosition; HRESULT hr=S_OK; - TRACE("(%p)\n", This); + + TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
EnterCriticalSection(&This->lock); if (dwOrigin == STREAM_SEEK_SET) NewPosition.QuadPart = dlibMove.QuadPart; @@ -174,7 +177,7 @@ static HRESULT WINAPI StreamOnMemory_Seek(IStream *iface, static HRESULT WINAPI StreamOnMemory_SetSize(IStream *iface, ULARGE_INTEGER libNewSize) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart)); return E_NOTIMPL; }
@@ -182,7 +185,7 @@ static HRESULT WINAPI StreamOnMemory_SetSize(IStream *iface, static HRESULT WINAPI StreamOnMemory_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten); return E_NOTIMPL; }
@@ -190,7 +193,7 @@ static HRESULT WINAPI StreamOnMemory_CopyTo(IStream *iface, static HRESULT WINAPI StreamOnMemory_Commit(IStream *iface, DWORD grfCommitFlags) { - TRACE("(%p)\n", iface); + TRACE("(%p, %#x)\n", iface, grfCommitFlags); return E_NOTIMPL; }
@@ -205,7 +208,8 @@ static HRESULT WINAPI StreamOnMemory_Revert(IStream *iface) static HRESULT WINAPI StreamOnMemory_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -213,7 +217,8 @@ static HRESULT WINAPI StreamOnMemory_LockRegion(IStream *iface, static HRESULT WINAPI StreamOnMemory_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -221,7 +226,7 @@ static HRESULT WINAPI StreamOnMemory_Stat(IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag) { StreamOnMemory *This = StreamOnMemory_from_IStream(iface); - TRACE("(%p)\n", This); + TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!pstatstg) return E_INVALIDARG;
@@ -236,7 +241,7 @@ static HRESULT WINAPI StreamOnMemory_Stat(IStream *iface, static HRESULT WINAPI StreamOnMemory_Clone(IStream *iface, IStream **ppstm) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p)\n", iface, ppstm); return E_NOTIMPL; }
@@ -331,7 +336,7 @@ static HRESULT WINAPI StreamOnFileHandle_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead) { StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); - TRACE("(%p)\n", This); + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
return IWICStream_Read(This->stream, pv, cb, pcbRead); } @@ -339,7 +344,7 @@ static HRESULT WINAPI StreamOnFileHandle_Read(IStream *iface, static HRESULT WINAPI StreamOnFileHandle_Write(IStream *iface, void const *pv, ULONG cb, ULONG *pcbWritten) { - ERR("(%p)\n", iface); + ERR("(%p, %p, %u, %p)\n", iface, pv, cb, pcbWritten); return HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED); }
@@ -347,7 +352,7 @@ static HRESULT WINAPI StreamOnFileHandle_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); - TRACE("(%p)\n", This); + TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
return IWICStream_Seek(This->stream, dlibMove, dwOrigin, plibNewPosition); } @@ -355,21 +360,21 @@ static HRESULT WINAPI StreamOnFileHandle_Seek(IStream *iface, static HRESULT WINAPI StreamOnFileHandle_SetSize(IStream *iface, ULARGE_INTEGER libNewSize) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart)); return E_NOTIMPL; }
static HRESULT WINAPI StreamOnFileHandle_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten); return E_NOTIMPL; }
static HRESULT WINAPI StreamOnFileHandle_Commit(IStream *iface, DWORD grfCommitFlags) { - TRACE("(%p)\n", iface); + TRACE("(%p, %#x)\n", iface, grfCommitFlags); return E_NOTIMPL; }
@@ -382,14 +387,16 @@ static HRESULT WINAPI StreamOnFileHandle_Revert(IStream *iface) static HRESULT WINAPI StreamOnFileHandle_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
static HRESULT WINAPI StreamOnFileHandle_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -397,7 +404,7 @@ static HRESULT WINAPI StreamOnFileHandle_Stat(IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag) { StreamOnFileHandle *This = StreamOnFileHandle_from_IStream(iface); - TRACE("(%p)\n", This); + TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
return IWICStream_Stat(This->stream, pstatstg, grfStatFlag); } @@ -405,11 +412,10 @@ static HRESULT WINAPI StreamOnFileHandle_Stat(IStream *iface, static HRESULT WINAPI StreamOnFileHandle_Clone(IStream *iface, IStream **ppstm) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p)\n", iface, ppstm); return E_NOTIMPL; }
- static const IStreamVtbl StreamOnFileHandle_Vtbl = { /*** IUnknown methods ***/ @@ -509,7 +515,8 @@ static HRESULT WINAPI StreamOnStreamRange_Read(IStream *iface, HRESULT hr; ULARGE_INTEGER OldPosition; LARGE_INTEGER SetPosition; - TRACE("(%p)\n", This); + + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!pv) return E_INVALIDARG;
@@ -552,7 +559,7 @@ static HRESULT WINAPI StreamOnStreamRange_Write(IStream *iface, ULARGE_INTEGER OldPosition; LARGE_INTEGER SetPosition; ULONG uBytesWritten=0; - TRACE("(%p)\n", This); + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!pv) return E_INVALIDARG;
@@ -594,7 +601,7 @@ static HRESULT WINAPI StreamOnStreamRange_Seek(IStream *iface, ULARGE_INTEGER NewPosition, actual_size; HRESULT hr=S_OK; STATSTG statstg; - TRACE("(%p)\n", This); + TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
EnterCriticalSection(&This->lock); actual_size = This->max_size; @@ -631,7 +638,7 @@ static HRESULT WINAPI StreamOnStreamRange_Seek(IStream *iface, static HRESULT WINAPI StreamOnStreamRange_SetSize(IStream *iface, ULARGE_INTEGER libNewSize) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s)\n", iface, wine_dbgstr_longlong(libNewSize.QuadPart)); return E_NOTIMPL; }
@@ -639,7 +646,8 @@ static HRESULT WINAPI StreamOnStreamRange_SetSize(IStream *iface, static HRESULT WINAPI StreamOnStreamRange_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p, %s, %p, %p)\n", iface, pstm, wine_dbgstr_longlong(cb.QuadPart), + pcbRead, pcbWritten); return E_NOTIMPL; }
@@ -647,7 +655,7 @@ static HRESULT WINAPI StreamOnStreamRange_CopyTo(IStream *iface, static HRESULT WINAPI StreamOnStreamRange_Commit(IStream *iface, DWORD grfCommitFlags) { - TRACE("(%p)\n", iface); + TRACE("(%p, %#x)\n", iface, grfCommitFlags); return E_NOTIMPL; }
@@ -662,7 +670,8 @@ static HRESULT WINAPI StreamOnStreamRange_Revert(IStream *iface) static HRESULT WINAPI StreamOnStreamRange_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -670,7 +679,8 @@ static HRESULT WINAPI StreamOnStreamRange_LockRegion(IStream *iface, static HRESULT WINAPI StreamOnStreamRange_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - TRACE("(%p)\n", iface); + TRACE("(%p, %s, %s, %d)\n", iface, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -679,7 +689,7 @@ static HRESULT WINAPI StreamOnStreamRange_Stat(IStream *iface, { StreamOnStreamRange *This = StreamOnStreamRange_from_IStream(iface); HRESULT hr; - TRACE("(%p)\n", This); + TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!pstatstg) return E_INVALIDARG;
@@ -701,11 +711,10 @@ static HRESULT WINAPI StreamOnStreamRange_Stat(IStream *iface, static HRESULT WINAPI StreamOnStreamRange_Clone(IStream *iface, IStream **ppstm) { - TRACE("(%p)\n", iface); + TRACE("(%p, %p)\n", iface, ppstm); return E_NOTIMPL; }
- static const IStreamVtbl StreamOnStreamRange_Vtbl = { /*** IUnknown methods ***/ @@ -795,7 +804,7 @@ static HRESULT WINAPI IWICStreamImpl_Read(IWICStream *iface, void *pv, ULONG cb, ULONG *pcbRead) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbRead);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Read(This->pStream, pv, cb, pcbRead); @@ -805,7 +814,7 @@ static HRESULT WINAPI IWICStreamImpl_Write(IWICStream *iface, void const *pv, ULONG cb, ULONG *pcbWritten) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %p, %u, %p)\n", This, pv, cb, pcbWritten);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Write(This->pStream, pv, cb, pcbWritten); @@ -815,7 +824,8 @@ static HRESULT WINAPI IWICStreamImpl_Seek(IWICStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), + dwOrigin, plibNewPosition);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Seek(This->pStream, dlibMove, dwOrigin, plibNewPosition); @@ -825,7 +835,7 @@ static HRESULT WINAPI IWICStreamImpl_SetSize(IWICStream *iface, ULARGE_INTEGER libNewSize) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart));
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_SetSize(This->pStream, libNewSize); @@ -835,7 +845,7 @@ static HRESULT WINAPI IWICStreamImpl_CopyTo(IWICStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_CopyTo(This->pStream, pstm, cb, pcbRead, pcbWritten); @@ -845,7 +855,7 @@ static HRESULT WINAPI IWICStreamImpl_Commit(IWICStream *iface, DWORD grfCommitFlags) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %#x)\n", This, grfCommitFlags);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Commit(This->pStream, grfCommitFlags); @@ -854,7 +864,7 @@ static HRESULT WINAPI IWICStreamImpl_Commit(IWICStream *iface, static HRESULT WINAPI IWICStreamImpl_Revert(IWICStream *iface) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p)\n", This);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Revert(This->pStream); @@ -864,7 +874,8 @@ static HRESULT WINAPI IWICStreamImpl_LockRegion(IWICStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %s, %s, %d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_LockRegion(This->pStream, libOffset, cb, dwLockType); @@ -874,7 +885,8 @@ static HRESULT WINAPI IWICStreamImpl_UnlockRegion(IWICStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %s, %s, %d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart), + wine_dbgstr_longlong(cb.QuadPart), dwLockType);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_UnlockRegion(This->pStream, libOffset, cb, dwLockType); @@ -884,7 +896,7 @@ static HRESULT WINAPI IWICStreamImpl_Stat(IWICStream *iface, STATSTG *pstatstg, DWORD grfStatFlag) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %p, %#x)\n", This, pstatstg, grfStatFlag);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Stat(This->pStream, pstatstg, grfStatFlag); @@ -894,7 +906,7 @@ static HRESULT WINAPI IWICStreamImpl_Clone(IWICStream *iface, IStream **ppstm) { IWICStreamImpl *This = impl_from_IWICStream(iface); - TRACE("(%p): relay\n", This); + TRACE("(%p, %p)\n", This, ppstm);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED; return IStream_Clone(This->pStream, ppstm); @@ -904,7 +916,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromIStream(IWICStream *iface, IStream *pIStream) { ULARGE_INTEGER offset, size; - TRACE("(%p): relay\n", iface); + TRACE("(%p, %p)\n", iface, pIStream);
offset.QuadPart = 0; size.u.LowPart = 0xffffffff; @@ -967,7 +979,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromMemory(IWICStream *iface, { IWICStreamImpl *This = impl_from_IWICStream(iface); StreamOnMemory *pObject; - TRACE("(%p,%p)\n", iface, pbBuffer); + TRACE("(%p, %p, %u)\n", iface, pbBuffer, cbBufferSize);
if (!pbBuffer) return E_INVALIDARG; if (This->pStream) return WINCODEC_ERR_WRONGSTATE; @@ -1068,7 +1080,9 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *ifa { IWICStreamImpl *This = impl_from_IWICStream(iface); StreamOnStreamRange *pObject; - TRACE("(%p,%p)\n", iface, pIStream); + + TRACE("(%p,%p,%s,%s)\n", iface, pIStream, wine_dbgstr_longlong(ulOffset.QuadPart), + wine_dbgstr_longlong(ulMaxSize.QuadPart));
if (!pIStream) return E_INVALIDARG; if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/stream.c | 26 ++++++++++++++------- dlls/windowscodecs/tests/stream.c | 39 ++++++++++++++----------------- 2 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c index ae90dfd379..366d11b111 100644 --- a/dlls/windowscodecs/stream.c +++ b/dlls/windowscodecs/stream.c @@ -912,16 +912,26 @@ static HRESULT WINAPI IWICStreamImpl_Clone(IWICStream *iface, return IStream_Clone(This->pStream, ppstm); }
-static HRESULT WINAPI IWICStreamImpl_InitializeFromIStream(IWICStream *iface, - IStream *pIStream) +static HRESULT WINAPI IWICStreamImpl_InitializeFromIStream(IWICStream *iface, IStream *stream) { - ULARGE_INTEGER offset, size; - TRACE("(%p, %p)\n", iface, pIStream); + IWICStreamImpl *This = impl_from_IWICStream(iface); + HRESULT hr = S_OK; + + TRACE("(%p, %p)\n", iface, stream); + + if (!stream) return E_INVALIDARG; + if (This->pStream) return WINCODEC_ERR_WRONGSTATE; + + IStream_AddRef(stream);
- offset.QuadPart = 0; - size.u.LowPart = 0xffffffff; - size.u.HighPart = 0xffffffff; - return IWICStream_InitializeFromIStreamRegion(iface, pIStream, offset, size); + if (InterlockedCompareExchangePointer((void **)&This->pStream, stream, NULL)) + { + /* Some other thread set the stream first. */ + IStream_Release(stream); + hr = WINCODEC_ERR_WRONGSTATE; + } + + return hr; }
static HRESULT WINAPI IWICStreamImpl_InitializeFromFilename(IWICStream *iface, diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c index 395be433d4..909f275706 100644 --- a/dlls/windowscodecs/tests/stream.c +++ b/dlls/windowscodecs/tests/stream.c @@ -777,7 +777,7 @@ static void test_StreamOnIStream(void)
hr = IWICStream_InitializeFromIStream(substream, (IStream *)stream); ok(hr == S_OK, "Failed to initialize stream, hr %#x.\n", hr); - CHECK_CUR_POS_TODO(substream, 1); + CHECK_CUR_POS(substream, 1);
/* Seek */ CHECK_CUR_POS(stream, 1); @@ -785,12 +785,12 @@ static void test_StreamOnIStream(void) ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); ok(newpos.QuadPart == sizeof(memory), "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); CHECK_CUR_POS(substream, sizeof(memory)); - CHECK_CUR_POS_TODO(stream, sizeof(memory)); + CHECK_CUR_POS(stream, sizeof(memory));
hr = IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, &newpos); ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); ok(newpos.QuadPart == 0, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0); CHECK_CUR_POS(substream, 0);
hr = IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); @@ -801,41 +801,37 @@ static void test_StreamOnIStream(void) newpos.u.HighPart = 0xdeadbeef; newpos.u.LowPart = 0xdeadbeef; hr = IWICStream_Seek(substream, pos, STREAM_SEEK_SET, &newpos); -todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "Unexpected hr %#x.\n", hr); ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0); CHECK_CUR_POS(substream, 0);
pos.QuadPart = sizeof(memory) + 1; newpos.u.HighPart = 0xdeadbeef; newpos.u.LowPart = 0xdeadbeef; hr = IWICStream_Seek(substream, pos, STREAM_SEEK_SET, &newpos); -todo_wine { ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); -} - CHECK_CUR_POS_TODO(stream, 0); - CHECK_CUR_POS_TODO(substream, 0); + CHECK_CUR_POS(stream, 0); + CHECK_CUR_POS(substream, 0);
pos.QuadPart = 1; newpos.u.HighPart = 0xdeadbeef; newpos.u.LowPart = 0xdeadbeef; hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); -todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); - CHECK_CUR_POS_TODO(stream, 0); - CHECK_CUR_POS_TODO(substream, 0); + CHECK_CUR_POS(stream, 0); + CHECK_CUR_POS(substream, 0);
pos.QuadPart = -1; hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); ok(hr == S_OK, "Failed to seek a stream, hr %#x.\n", hr); ok(newpos.QuadPart == sizeof(memory) - 1, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); - CHECK_CUR_POS_TODO(stream, sizeof(memory) - 1); + CHECK_CUR_POS(stream, sizeof(memory) - 1); CHECK_CUR_POS(substream, sizeof(memory) - 1);
IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, &newpos); /* reset seek pointer */ @@ -843,11 +839,10 @@ todo_wine newpos.u.HighPart = 0xdeadbeef; newpos.u.LowPart = 0xdeadbeef; hr = IWICStream_Seek(substream, pos, STREAM_SEEK_END, &newpos); -todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(newpos.u.HighPart == 0xdeadbeef && newpos.u.LowPart == 0xdeadbeef, "Unexpected position %s.\n", wine_dbgstr_longlong(newpos.QuadPart)); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0); CHECK_CUR_POS(substream, 0);
IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); @@ -858,23 +853,23 @@ todo_wine ok(read_len == 12, "Unexpected read length %u.\n", read_len); ok(!memcmp(buff, data, 12), "Unexpected data.\n"); CHECK_CUR_POS(substream, read_len); - CHECK_CUR_POS_TODO(stream, read_len); + CHECK_CUR_POS(stream, read_len);
IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0);
hr = IWICStream_Read(substream, memory, 10, &read_len); /* source = dest */ ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); ok(read_len == 10, "Unexpected read length %u.\n", read_len); ok(!memcmp(memory, data, read_len), "Unexpected data.\n"); - CHECK_CUR_POS_TODO(stream, 10); + CHECK_CUR_POS(stream, 10);
IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); hr = IWICStream_Read(substream, memory, 2 * sizeof(data), &read_len); /* request too many bytes */ ok(hr == S_OK, "Failed to read from stream, hr %#x.\n", hr); ok(read_len == 64, "Unexpected read length %u.\n", read_len); ok(!memcmp(memory, data, read_len), "Unexpected data.\n"); - CHECK_CUR_POS_TODO(stream, sizeof(data)); + CHECK_CUR_POS(stream, sizeof(data));
IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL); read_len = 0xdeadbeef; @@ -910,7 +905,7 @@ todo_wine ok(written == 3, "Unexpected written length %u.\n", written); ok(!memcmp(buff, memory, 3), "Unexpected stream data.\n"); CHECK_CUR_POS(substream, written); - CHECK_CUR_POS_TODO(stream, written); + CHECK_CUR_POS(stream, written); IWICStream_Seek(substream, zero_pos, STREAM_SEEK_SET, NULL);
hr = IWICStream_Write(substream, buff, 0, &written); @@ -921,14 +916,14 @@ todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(written == 0xdeadbeef, "Unexpected written length %u.\n", written); CHECK_CUR_POS(substream, 0); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0);
written = 0xdeadbeef; hr = IWICStream_Write(substream, NULL, 0, &written); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(written == 0xdeadbeef, "Unexpected written length %u.\n", written); CHECK_CUR_POS(substream, 0); - CHECK_CUR_POS_TODO(stream, 0); + CHECK_CUR_POS(stream, 0);
/* SetSize */ newpos.u.HighPart = 0;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=45156
Your paranoid android.
=== wvistau64 (64 bit report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.
=== w2008s64 (64 bit report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.
=== w7pro64 (64 bit report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.
=== w864 (64 bit report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.
=== w1064 (64 bit report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.
=== debian9 (64 bit WoW report) ===
windowscodecs: stream.c:842: Test failed: Unexpected hr 0x80070216.