Module: wine Branch: master Commit: 2fcfe35e88fe051ed02e837b274f9c00969032be URL: http://source.winehq.org/git/wine.git/?a=commit;h=2fcfe35e88fe051ed02e837b27... Author: Viktor Semykin <thesame.ml(a)gmail.com> Date: Thu Mar 30 13:52:14 2017 -0300 windowscodecs/tests: Test with SHCreateMemStream. SHCreateMemStream takes less code to inialize and is preferred over CreateStreamOnHGlobal according to documentation. Signed-off-by: Viktor Semykin <thesame.ml(a)gmail.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/Makefile.in | 2 +- dlls/windowscodecs/tests/pngformat.c | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dlls/windowscodecs/tests/Makefile.in b/dlls/windowscodecs/tests/Makefile.in index e11d184..e006e3d 100644 --- a/dlls/windowscodecs/tests/Makefile.in +++ b/dlls/windowscodecs/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = windowscodecs.dll -IMPORTS = windowscodecs oleaut32 ole32 user32 gdi32 +IMPORTS = windowscodecs oleaut32 ole32 user32 gdi32 shlwapi C_SRCS = \ bitmap.c \ diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c index 02e0b1c..1aeb9bc 100644 --- a/dlls/windowscodecs/tests/pngformat.c +++ b/dlls/windowscodecs/tests/pngformat.c @@ -25,6 +25,7 @@ #include "windef.h" #include "wincodec.h" #include "wine/test.h" +#include "shlwapi.h" /* 1x1 pixel PNG image */ static const char png_no_color_profile[] = { @@ -277,8 +278,6 @@ static IWICImagingFactory *factory; static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size) { - HGLOBAL hmem; - BYTE *data; HRESULT hr; IWICBitmapDecoder *decoder = NULL; IStream *stream; @@ -287,13 +286,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size ULARGE_INTEGER pos; LARGE_INTEGER zero; - hmem = GlobalAlloc(0, image_size); - data = GlobalLock(hmem); - memcpy(data, image_data, image_size); - GlobalUnlock(hmem); - - hr = CreateStreamOnHGlobal(hmem, TRUE, &stream); - ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); + stream = SHCreateMemStream (image_data, image_size); + ok(stream != NULL, "SHCreateMemStream error\n"); hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder); ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);