From: Louis Lenders xerox.xerox2000x@gmail.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
For https://bugs.winehq.org/show_bug.cgi?id=42851
dlls/gdiplus/image.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index c0b54d04d8..b03630c55c 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -4314,6 +4314,11 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image) HRESULT hr; const struct image_codec *codec=NULL;
+ TRACE("%p %p\n", stream, image); + + if (!stream || !image) + return InvalidParameter; + /* choose an appropriate image decoder */ stat = get_decoder_info(stream, &codec); if (stat != Ok) return stat;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/gdiplus/tests/image.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 28f0fcec93..34222e7ce0 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5161,6 +5161,37 @@ static void test_png_color_formats(void) } }
+static void test_GdipLoadImageFromStream(void) +{ + IStream *stream; + GpStatus status; + GpImage *image; + HGLOBAL hglob; + BYTE *data; + HRESULT hr; + + status = GdipLoadImageFromStream(NULL, NULL); + ok(status == InvalidParameter, "Unexected return value %d.\n", status); + + image = (void *)0xdeadbeef; + status = GdipLoadImageFromStream(NULL, &image); + ok(status == InvalidParameter, "Unexected return value %d.\n", status); + ok(image == (void *)0xdeadbeef, "Unexpected image pointer.\n"); + + hglob = GlobalAlloc(0, sizeof(pngimage)); + data = GlobalLock (hglob); + memcpy(data, pngimage, sizeof(pngimage)); + GlobalUnlock(hglob); + + hr = CreateStreamOnHGlobal(hglob, TRUE, &stream); + ok(hr == S_OK, "Failed to create a stream.\n"); + + status = GdipLoadImageFromStream(stream, NULL); + ok(status == InvalidParameter, "Unexpected return value %d.\n", status); + + IStream_Release(stream); +} + START_TEST(image) { HMODULE mod = GetModuleHandleA("gdiplus.dll"); @@ -5234,6 +5265,7 @@ START_TEST(image) test_getadjustedpalette(); test_histogram(); test_imageabort(); + test_GdipLoadImageFromStream();
GdiplusShutdown(gdiplusToken); }
Signed-off-by: Vincent Povirk vincent@codeweavers.com