ole32: Allow caching of icon aspects for static class caches.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2018-01-25 11:04:30 +00:00 committed by Alexandre Julliard
parent f65f1a939a
commit c140cf115b
2 changed files with 13 additions and 2 deletions

View File

@ -2398,7 +2398,7 @@ static HRESULT WINAPI DataCache_Cache(
return CACHE_S_SAMECACHE; return CACHE_S_SAMECACHE;
} }
if (This->clsid_static) return DV_E_FORMATETC; if (This->clsid_static && fmt_cpy.dwAspect != DVASPECT_ICON) return DV_E_FORMATETC;
hr = DataCache_CreateEntry(This, &fmt_cpy, advf, FALSE, &cache_entry); hr = DataCache_CreateEntry(This, &fmt_cpy, advf, FALSE, &cache_entry);

View File

@ -2441,13 +2441,24 @@ static void test_data_cache_cache(void)
hr = IOleCache2_Cache( cache, &fmt, 0, &conn ); hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( FAILED(hr), "got %08x\n", hr ); ok( FAILED(hr), "got %08x\n", hr );
fmt.dwAspect = DVASPECT_DOCPRINT;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( FAILED(hr), "got %08x\n", hr );
/* try caching another clip format */ /* try caching another clip format */
fmt.dwAspect = DVASPECT_CONTENT;
fmt.cfFormat = CF_METAFILEPICT; fmt.cfFormat = CF_METAFILEPICT;
fmt.dwAspect = DVASPECT_CONTENT;
fmt.tymed = TYMED_MFPICT; fmt.tymed = TYMED_MFPICT;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn ); hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( FAILED(hr), "got %08x\n", hr ); ok( FAILED(hr), "got %08x\n", hr );
/* As an exception, it's possible to add an icon aspect */
fmt.cfFormat = CF_METAFILEPICT;
fmt.dwAspect = DVASPECT_ICON;
fmt.tymed = TYMED_MFPICT;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( hr == S_OK, "got %08x\n", hr );
IOleCache2_Release( cache ); IOleCache2_Release( cache );
} }