diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 808c2dcb04..bac282e8b2 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -477,6 +477,10 @@ static HRESULT read_clipformat(IStream *stream, CLIPFORMAT *clipformat) return DV_E_CLIPFORMAT; *clipformat = cf; } + else if (length == 0) + { + *clipformat = 0; + } else { char *format_name = HeapAlloc(GetProcessHeap(), 0, length); @@ -499,14 +503,20 @@ static HRESULT write_clipformat(IStream *stream, CLIPFORMAT clipformat) DWORD length; HRESULT hr; - if (clipformat < 0xc000) + if (clipformat == 0) + length = 0; + else if (clipformat < 0xc000) length = -1; else length = GetClipboardFormatNameA(clipformat, NULL, 0); hr = IStream_Write(stream, &length, sizeof(length), NULL); if (FAILED(hr)) return hr; - if (clipformat < 0xc000) + if (clipformat == 0) + { + /* nothing to do */ + } + else if (clipformat < 0xc000) { DWORD cf = clipformat; hr = IStream_Write(stream, &cf, sizeof(cf), NULL); @@ -1560,6 +1570,8 @@ static HRESULT parse_pres_streams( DataCache *This, IStorage *stg ) } static const FORMATETC static_dib_fmt = { CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; +static const FORMATETC static_mf_fmt = { CF_METAFILEPICT, NULL, DVASPECT_CONTENT, -1, TYMED_MFPICT }; +static const FORMATETC static_emf_fmt = { CF_ENHMETAFILE, NULL, DVASPECT_CONTENT, -1, TYMED_ENHMF }; static HRESULT parse_contents_stream( DataCache *This, IStorage *stg, IStream *stm ) { @@ -1572,6 +1584,10 @@ static HRESULT parse_contents_stream( DataCache *This, IStorage *stg, IStream *s if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Dib )) fmt = &static_dib_fmt; + else if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Metafile )) + fmt = &static_mf_fmt; + else if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_EnhMetafile )) + fmt = &static_emf_fmt; else { FIXME("unsupported format %s\n", debugstr_guid( &stat.clsid )); @@ -1665,12 +1681,6 @@ static HRESULT WINAPI DataCache_Save( } } - /* this is a shortcut if nothing changed */ - if (!dirty && !fSameAsLoad && This->presentationStorage) - { - return IStorage_CopyTo(This->presentationStorage, 0, NULL, NULL, pStg); - } - /* assign stream numbers to the cache entries */ LIST_FOR_EACH_ENTRY(cache_entry, &This->cache_list, DataCacheEntry, entry) { diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index c7a9b272cb..bc4753af59 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -1343,7 +1343,7 @@ HRESULT WINAPI OleSave( if (SUCCEEDED(hres)) { - WriteClassStg(pStg, &objectClass); + IStorage_SetClass(pStg, &objectClass); } /* diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index f52f937b5a..deb08e3f50 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -3667,7 +3667,6 @@ static void test_data_cache_contents(void) ok(hr == S_OK, "unexpected %#x\n", hr); hr = IPersistStorage_IsDirty(stg); -todo_wine_if(test_data[i].in == &stg_def_4) ok(hr == S_FALSE, "unexpected %#x\n", hr); hr = OleSave(stg, doc2, FALSE); @@ -3677,10 +3676,9 @@ todo_wine_if(test_data[i].in == &stg_def_4) enumerated_streams = matched_streams = -1; check_storage_contents(doc2, test_data[i].out, &enumerated_streams, &matched_streams); -todo_wine +todo_wine_if(test_data[i].in == &stg_def_3 || test_data[i].in == &stg_def_4 || test_data[i].in == &stg_def_5 || test_data[i].in == &stg_def_6) ok(enumerated_streams == matched_streams, "%d out: enumerated %d != matched %d\n", i, enumerated_streams, matched_streams); -todo_wine ok(enumerated_streams == test_data[i].out->stream_count, "%d: saved streams %d != def streams %d\n", i, enumerated_streams, test_data[i].out->stream_count);