Module: wine Branch: master Commit: 39d2ce5956ce4557d953425a8b1def288532652f URL: http://source.winehq.org/git/wine.git/?a=commit;h=39d2ce5956ce4557d953425a8b...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Nov 2 17:01:23 2015 +0800
ole32: Relax media type check when loading CF_METAFILEPICT format from OLE storage.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ole32/datacache.c | 12 ++++++------ dlls/ole32/tests/ole2.c | 6 ------ 2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 9284410..e93e867 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -282,10 +282,10 @@ static DataCacheEntry *DataCache_GetEntryForFormatEtc(DataCache *This, const FOR /* checks that the clipformat and tymed are valid and returns an error if they * aren't and CACHE_S_NOTSUPPORTED if they are valid, but can't be rendered by * DataCache_Draw */ -static HRESULT check_valid_clipformat_and_tymed(CLIPFORMAT cfFormat, DWORD tymed) +static HRESULT check_valid_clipformat_and_tymed(CLIPFORMAT cfFormat, DWORD tymed, BOOL load) { if (!cfFormat || !tymed || - (cfFormat == CF_METAFILEPICT && tymed == TYMED_MFPICT) || + (cfFormat == CF_METAFILEPICT && (tymed == TYMED_MFPICT || load)) || (cfFormat == CF_BITMAP && tymed == TYMED_GDI) || (cfFormat == CF_DIB && tymed == TYMED_HGLOBAL) || (cfFormat == CF_ENHMETAFILE && tymed == TYMED_ENHMF)) @@ -299,11 +299,11 @@ static HRESULT check_valid_clipformat_and_tymed(CLIPFORMAT cfFormat, DWORD tymed } }
-static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc, DataCacheEntry **cache_entry) +static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc, DataCacheEntry **cache_entry, BOOL load) { HRESULT hr;
- hr = check_valid_clipformat_and_tymed(formatetc->cfFormat, formatetc->tymed); + hr = check_valid_clipformat_and_tymed(formatetc->cfFormat, formatetc->tymed, load); if (FAILED(hr)) return hr; if (hr == CACHE_S_FORMATETC_NOTSUPPORTED) @@ -1259,7 +1259,7 @@ static HRESULT add_cache_entry( DataCache *This, const FORMATETC *fmt, IStream *
cache_entry = DataCache_GetEntryForFormatEtc( This, fmt ); if (!cache_entry) - hr = DataCache_CreateEntry( This, fmt, &cache_entry ); + hr = DataCache_CreateEntry( This, fmt, &cache_entry, TRUE ); if (SUCCEEDED( hr )) { DataCacheEntry_DiscardData( cache_entry ); @@ -2007,7 +2007,7 @@ static HRESULT WINAPI DataCache_Cache( return CACHE_S_SAMECACHE; }
- hr = DataCache_CreateEntry(This, pformatetc, &cache_entry); + hr = DataCache_CreateEntry(This, pformatetc, &cache_entry, FALSE);
if (SUCCEEDED(hr)) { diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index ed6157f..08253a1 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -1215,13 +1215,7 @@ static void test_OleLoad(IStorage *pStorage) hr = OleDraw(obj, DVASPECT_CONTENT, hdc, &rc); DeleteDC(hdc); if (fmt == CF_METAFILEPICT) - { - if (tymed == TYMED_HGLOBAL || tymed == TYMED_MFPICT) ok(hr == S_OK, "OleDraw error %#x: cfFormat = %u, tymed = %u\n", hr, fmt, tymed); - else -todo_wine - ok(hr == S_OK, "OleDraw error %#x: cfFormat = %u, tymed = %u\n", hr, fmt, tymed); - } else if (fmt == CF_ENHMETAFILE) todo_wine ok(hr == S_OK, "OleDraw error %#x: cfFormat = %u, tymed = %u\n", hr, fmt, tymed);