From 8568fe0a24b0f42dc6ee16c74002e6baaac18cf6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 8 Apr 2017 14:26:36 +0200 Subject: [PATCH] oleaut32-OleLoadPicture: Update patchset and fix a regression. --- ...eLoadPicture-load-DIBs-using-WIC-dec.patch | 93 +++++++++++++++++++ patches/patchinstall.sh | 2 + 2 files changed, 95 insertions(+) create mode 100644 patches/oleaut32-OleLoadPicture/0002-oleaut32-Make-OleLoadPicture-load-DIBs-using-WIC-dec.patch diff --git a/patches/oleaut32-OleLoadPicture/0002-oleaut32-Make-OleLoadPicture-load-DIBs-using-WIC-dec.patch b/patches/oleaut32-OleLoadPicture/0002-oleaut32-Make-OleLoadPicture-load-DIBs-using-WIC-dec.patch new file mode 100644 index 00000000..90003d7f --- /dev/null +++ b/patches/oleaut32-OleLoadPicture/0002-oleaut32-Make-OleLoadPicture-load-DIBs-using-WIC-dec.patch @@ -0,0 +1,93 @@ +From edeffac23fae035e8b7910e5e4d97a48d7556220 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Wed, 5 Apr 2017 12:03:19 +0800 +Subject: oleaut32: Make OleLoadPicture load DIBs using WIC decoder. + +CreateDIBSection doesn't support RLE compressed bitmaps. + +This patch fixes a regression with displaying images in a Wix based +installer. +--- + dlls/oleaut32/olepicture.c | 21 +-------------------- + dlls/oleaut32/tests/olepicture.c | 12 +++++++++++- + 2 files changed, 12 insertions(+), 21 deletions(-) + +diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c +index 7d2f9a2eec..96304e0644 100644 +--- a/dlls/oleaut32/olepicture.c ++++ b/dlls/oleaut32/olepicture.c +@@ -998,25 +998,6 @@ static HRESULT WINAPI OLEPictureImpl_IsDirty( + return E_NOTIMPL; + } + +-static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) +-{ +- BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf; +- BITMAPINFO *bi = (BITMAPINFO*)(bfh+1); +- void *bits; +- BITMAP bmp; +- +- This->desc.u.bmp.hbitmap = CreateDIBSection(0, bi, DIB_RGB_COLORS, &bits, NULL, 0); +- if (This->desc.u.bmp.hbitmap == 0) +- return E_FAIL; +- +- GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bmp), &bmp); +- memcpy(bits, xbuf + bfh->bfOffBits, bmp.bmHeight * bmp.bmWidthBytes); +- +- This->desc.picType = PICTYPE_BITMAP; +- OLEPictureImpl_SetBitmap(This); +- return S_OK; +-} +- + static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSource *src) + { + HRESULT hr; +@@ -1497,7 +1478,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm) + hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICJpegDecoder, xbuf, xread); + break; + case BITMAP_FORMAT_BMP: /* Bitmap */ +- hr = OLEPictureImpl_LoadDIB(This, xbuf, xread); ++ hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICBmpDecoder, xbuf, xread); + break; + case BITMAP_FORMAT_PNG: /* PNG */ + hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICPngDecoder, xbuf, xread); +diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c +index 8147bf740c..1e4d55debc 100644 +--- a/dlls/oleaut32/tests/olepicture.c ++++ b/dlls/oleaut32/tests/olepicture.c +@@ -98,7 +98,7 @@ static const unsigned char pngimage[285] = { + 0xe7,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 + }; + +-/* 1x1 pixel bmp */ ++/* 1bpp BI_RGB 1x1 pixel bmp */ + static const unsigned char bmpimage[66] = { + 0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00, + 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00, +@@ -107,6 +107,15 @@ static const unsigned char bmpimage[66] = { + 0x00,0x00 + }; + ++/* 8bpp BI_RLE8 1x1 pixel bmp */ ++static const unsigned char bmpimage_rle8[] = { ++0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00, ++0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x01,0x00, ++0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x02,0x00, ++0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,0x01, ++0x00,0x00 ++}; ++ + /* 2x2 pixel gif */ + static const unsigned char gif4pixel[42] = { + 0x47,0x49,0x46,0x38,0x37,0x61,0x02,0x00,0x02,0x00,0xa1,0x00,0x00,0x00,0x00,0x00, +@@ -1461,6 +1470,7 @@ START_TEST(olepicture) + test_pic(gifimage, sizeof(gifimage)); + test_pic(jpgimage, sizeof(jpgimage)); + test_pic(bmpimage, sizeof(bmpimage)); ++ test_pic(bmpimage_rle8, sizeof(bmpimage_rle8)); + test_pic(gif4pixel, sizeof(gif4pixel)); + /* FIXME: No PNG support in Windows... */ + if (0) test_pic(pngimage, sizeof(pngimage)); +-- +2.11.0 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4d79f602..77b2134a 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -6436,8 +6436,10 @@ fi # | if test "$enable_oleaut32_OleLoadPicture" -eq 1; then patch_apply oleaut32-OleLoadPicture/0001-oleaut32-OleLoadPicture-should-create-a-DIB-section-.patch + patch_apply oleaut32-OleLoadPicture/0002-oleaut32-Make-OleLoadPicture-load-DIBs-using-WIC-dec.patch ( printf '%s\n' '+ { "Dmitry Timoshkov", "oleaut32: OleLoadPicture should create a DIB section for a being loaded bitmap.", 3 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "oleaut32: Make OleLoadPicture load DIBs using WIC decoder.", 1 },'; ) >> "$patchlist" fi