From 70b46ff60358981d9f019d394fdbfdc61453e205 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 23 Mar 2016 17:55:37 +0100 Subject: [PATCH] windowscodecs-IMILBitmapSource: Merge additional compatibility improvements. --- patches/patchinstall.sh | 4 +- ...prove-compatibility-of-IMILBitmapSou.patch | 43 +++++++----- ...d-support-for-IMILBitmapScaler-inter.patch | 66 +++++++++++-------- 3 files changed, 66 insertions(+), 47 deletions(-) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b15b7ae5..fa864e5b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -7004,8 +7004,8 @@ if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then patch_apply windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch patch_apply windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch ( - echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 1 },'; - echo '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 1 },'; + echo '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 2 },'; + echo '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 2 },'; ) >> "$patchlist" fi diff --git a/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch b/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch index f8fcdc5a..13b8bd74 100644 --- a/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch +++ b/patches/windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch @@ -1,17 +1,17 @@ -From 9660ba7e1e5e23b1fa2a3e7b434802bfdb8e187b Mon Sep 17 00:00:00 2001 +From b086b2918e0d14549131e15fe7527778f8abfe94 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 22 Mar 2016 23:46:30 +0800 -Subject: windowscodecs: Improve compatibility of IMILBitmapSource interface. +Subject: windowscodecs: Improve compatibility of IMILBitmapSource interface. (v2) Based on Focht's investigation. This makes the test application attached to the bug 34764 work. --- - dlls/windowscodecs/bitmap.c | 181 ++++++++++++++++++++++++++------- + dlls/windowscodecs/bitmap.c | 184 ++++++++++++++++++++++++++------- dlls/windowscodecs/wincodecs_private.h | 58 +++++++++-- - 2 files changed, 195 insertions(+), 44 deletions(-) + 2 files changed, 197 insertions(+), 45 deletions(-) diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c -index 6adaab0..640e146 100644 +index 6adaab0..f2aaef9 100644 --- a/dlls/windowscodecs/bitmap.c +++ b/dlls/windowscodecs/bitmap.c @@ -135,6 +135,7 @@ static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFII @@ -106,7 +106,14 @@ index 6adaab0..640e146 100644 { BitmapImpl *This = impl_from_IMILBitmapSource(iface); -@@ -597,6 +614,40 @@ static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, voi +@@ -591,12 +608,46 @@ static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, voi + + if (!ppv) return E_INVALIDARG; + +- IUnknown_AddRef(&This->IMILUnknown1_iface); ++ /* reference count is not incremented here */ + *ppv = &This->IMILUnknown1_iface; + return S_OK; } @@ -183,7 +190,7 @@ index 6adaab0..640e146 100644 } static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) -@@ -641,56 +686,118 @@ static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) +@@ -641,47 +686,108 @@ static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) return IWICBitmap_Release(&This->IWICBitmap_iface); } @@ -292,12 +299,13 @@ index 6adaab0..640e146 100644 } -static HRESULT WINAPI IMILUnknown2Impl_UnknownMethod1(IMILUnknown2 *iface, void *arg1, void *arg2) -+static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void *arg2) ++static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2) { FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); - return E_NOTIMPL; - } - ++ if (arg2) *arg2 = NULL; ++ return E_NOTIMPL; ++} ++ +static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface) +{ + FIXME("(%p): stub\n", iface); @@ -307,11 +315,10 @@ index 6adaab0..640e146 100644 +static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1) +{ + FIXME("(%p,%p): stub\n", iface, arg1); -+ return E_NOTIMPL; -+} -+ - static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = - { + return E_NOTIMPL; + } + +@@ -690,7 +796,9 @@ static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = IMILUnknown2Impl_QueryInterface, IMILUnknown2Impl_AddRef, IMILUnknown2Impl_Release, @@ -323,7 +330,7 @@ index 6adaab0..640e146 100644 HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h -index f54403c..2bd109e 100644 +index f54403c..eda1b7a 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -30,7 +30,13 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47 @@ -411,7 +418,7 @@ index f54403c..2bd109e 100644 STDMETHOD_(ULONG,Release)(THIS) PURE; /*** unknown methods ***/ - STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void *, void *) PURE; -+ STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void *) PURE; ++ STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE; + STDMETHOD_(HRESULT,unknown2)(THIS) PURE; + STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE; }; diff --git a/patches/windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch b/patches/windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch index 5d505c4c..c6a91cc0 100644 --- a/patches/windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch +++ b/patches/windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch @@ -1,16 +1,16 @@ -From 952d0942370202498e2a93f96ead1733ce6fdff8 Mon Sep 17 00:00:00 2001 +From 1a218a3cd7425d1cab7e11126c86948d38606704 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 22 Mar 2016 23:49:42 +0800 -Subject: windowscodecs: Add support for IMILBitmapScaler interface. +Subject: windowscodecs: Add support for IMILBitmapScaler interface. (v2) This patch makes the GOG downloader work. --- - dlls/windowscodecs/scaler.c | 157 +++++++++++++++++++++++++++++++++ + dlls/windowscodecs/scaler.c | 169 +++++++++++++++++++++++++++++++++ dlls/windowscodecs/wincodecs_private.h | 19 ++++ - 2 files changed, 176 insertions(+) + 2 files changed, 188 insertions(+) diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c -index ebcc790..b4d6f75 100644 +index ebcc790..3801ea5 100644 --- a/dlls/windowscodecs/scaler.c +++ b/dlls/windowscodecs/scaler.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); @@ -47,7 +47,7 @@ index ebcc790..b4d6f75 100644 *ppv = NULL; return E_NOINTERFACE; } -@@ -374,6 +385,151 @@ static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = { +@@ -374,6 +385,163 @@ static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = { BitmapScaler_Initialize }; @@ -61,12 +61,20 @@ index ebcc790..b4d6f75 100644 + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || -+ IsEqualIID(&IID_IMILBitmapScaler, iid)) ++ IsEqualIID(&IID_IMILBitmapScaler, iid) || ++ IsEqualIID(&IID_IMILBitmapSource, iid)) + { + IUnknown_AddRef(&This->IMILBitmapScaler_iface); + *ppv = &This->IMILBitmapScaler_iface; + return S_OK; + } ++ else if (IsEqualIID(&IID_IWICBitmapScaler, iid) || ++ IsEqualIID(&IID_IWICBitmapSource, iid)) ++ { ++ IUnknown_AddRef(&This->IWICBitmapScaler_iface); ++ *ppv = &This->IWICBitmapScaler_iface; ++ return S_OK; ++ } + + FIXME("unknown interface %s\n", debugstr_guid(iid)); + *ppv = NULL; @@ -89,7 +97,12 @@ index ebcc790..b4d6f75 100644 + UINT *width, UINT *height) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); ++ + TRACE("(%p,%p,%p)\n", iface, width, height); ++ ++ if (!This->source) ++ return WINCODEC_ERR_NOTINITIALIZED; ++ + return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height); +} + @@ -105,7 +118,7 @@ index ebcc790..b4d6f75 100644 + if (!format) return E_INVALIDARG; + + if (!This->source) -+ return WINCODEC_ERR_WRONGSTATE; ++ return WINCODEC_ERR_NOTINITIALIZED; + + hr = IWICBitmapSource_QueryInterface(This->source, &IID_IMILBitmapSource, (void **)&source); + if (hr == S_OK) @@ -120,7 +133,12 @@ index ebcc790..b4d6f75 100644 + double *dpix, double *dpiy) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); ++ + TRACE("(%p,%p,%p)\n", iface, dpix, dpiy); ++ ++ if (!This->source) ++ return WINCODEC_ERR_NOTINITIALIZED; ++ + return IWICBitmapScaler_GetResolution(&This->IWICBitmapScaler_iface, dpix, dpiy); +} + @@ -128,7 +146,12 @@ index ebcc790..b4d6f75 100644 + IWICPalette *palette) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); ++ + TRACE("(%p,%p)\n", iface, palette); ++ ++ if (!This->source) ++ return WINCODEC_ERR_NOTINITIALIZED; ++ + return IWICBitmapScaler_CopyPalette(&This->IWICBitmapScaler_iface, palette); +} + @@ -136,30 +159,19 @@ index ebcc790..b4d6f75 100644 + const WICRect *rc, UINT stride, UINT size, BYTE *buffer) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); ++ + TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer); ++ ++ if (!This->source) ++ return WINCODEC_ERR_NOTINITIALIZED; ++ + return IWICBitmapScaler_CopyPixels(&This->IWICBitmapScaler_iface, rc, stride, size, buffer); +} + +static HRESULT WINAPI IMILBitmapScaler_unknown1(IMILBitmapScaler *iface, void **ppv) +{ -+ BitmapScaler *This = impl_from_IMILBitmapScaler(iface); -+ IMILBitmapSource *source; -+ HRESULT hr; -+ + TRACE("(%p,%p)\n", iface, ppv); -+ -+ if (!ppv) return E_INVALIDARG; -+ -+ if (!This->source) -+ return WINCODEC_ERR_WRONGSTATE; -+ -+ hr = IWICBitmapSource_QueryInterface(This->source, &IID_IMILBitmapSource, (void **)&source); -+ if (hr == S_OK) -+ { -+ hr = source->lpVtbl->unknown1(source, ppv); -+ source->lpVtbl->Release(source); -+ } -+ return hr; ++ return E_NOINTERFACE; +} + +static HRESULT WINAPI IMILBitmapScaler_Initialize(IMILBitmapScaler *iface, @@ -199,7 +211,7 @@ index ebcc790..b4d6f75 100644 HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) { BitmapScaler *This; -@@ -382,6 +538,7 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) +@@ -382,6 +550,7 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) if (!This) return E_OUTOFMEMORY; This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; @@ -208,7 +220,7 @@ index ebcc790..b4d6f75 100644 This->source = NULL; This->width = 0; diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h -index 2bd109e..0bef4d9 100644 +index eda1b7a..2a17fdf 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -60,6 +60,25 @@ DECLARE_INTERFACE_(IMILBitmapSource,IUnknown)