Commit 3bf32809 authored by Sergio Gómez Del Real's avatar Sergio Gómez Del Real Committed by Alexandre Julliard

ole32: Prevent adding additional cache entries to static class caches.

parent c4a595e3
...@@ -2453,6 +2453,8 @@ static HRESULT WINAPI DataCache_Cache( ...@@ -2453,6 +2453,8 @@ static HRESULT WINAPI DataCache_Cache(
return CACHE_S_SAMECACHE; return CACHE_S_SAMECACHE;
} }
if (This->clsid_static) return DV_E_FORMATETC;
hr = DataCache_CreateEntry(This, &fmt_cpy, advf, FALSE, &cache_entry); hr = DataCache_CreateEntry(This, &fmt_cpy, advf, FALSE, &cache_entry);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
......
...@@ -2426,6 +2426,29 @@ static void test_data_cache_cache(void) ...@@ -2426,6 +2426,29 @@ static void test_data_cache_cache(void)
IDataObject_Release( data ); IDataObject_Release( data );
IOleCache2_Release( cache ); IOleCache2_Release( cache );
/* tests for a static class cache */
hr = CreateDataCache( NULL, &CLSID_Picture_Dib, &IID_IOleCache2, (void **)&cache );
fmt.cfFormat = CF_DIB;
fmt.dwAspect = DVASPECT_CONTENT;
fmt.tymed = TYMED_HGLOBAL;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( hr == CACHE_S_SAMECACHE, "got %08x\n", hr );
/* aspect other than DVASPECT_CONTENT should fail */
fmt.dwAspect = DVASPECT_THUMBNAIL;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( FAILED(hr), "got %08x\n", hr );
/* try caching another clip format */
fmt.dwAspect = DVASPECT_CONTENT;
fmt.cfFormat = CF_METAFILEPICT;
fmt.tymed = TYMED_MFPICT;
hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
ok( FAILED(hr), "got %08x\n", hr );
IOleCache2_Release( cache );
} }
/* The CLSID_Picture_ classes automatically create appropriate cache entries */ /* The CLSID_Picture_ classes automatically create appropriate cache entries */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment