B1;2cOn Fri, Oct 23, 2015 at 06:32:17PM +0800, Dmitry Timoshkov wrote:
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index caabd10..3db0edf 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -285,7 +285,7 @@ static DataCacheEntry *DataCache_GetEntryForFormatEtc(DataCache *This, const FOR static HRESULT check_valid_clipformat_and_tymed(CLIPFORMAT cfFormat, DWORD tymed) { if (!cfFormat || !tymed ||
(cfFormat == CF_METAFILEPICT && tymed == TYMED_MFPICT) ||
(cfFormat == CF_METAFILEPICT && (tymed == TYMED_MFPICT || tymed == TYMED_FILE)) || (cfFormat == CF_BITMAP && tymed == TYMED_GDI) || (cfFormat == CF_DIB && tymed == TYMED_HGLOBAL) || (cfFormat == CF_ENHMETAFILE && tymed == TYMED_ENHMF))
This should be easy enough to test. Create a stand-alone data cache ( using CreateDataCache() ), then call IOleCache_Cache with the relevant fmtetc.
Huw.
Huw Davies huw@codeweavers.com wrote:
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index caabd10..3db0edf 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -285,7 +285,7 @@ static DataCacheEntry *DataCache_GetEntryForFormatEtc(DataCache *This, const FOR static HRESULT check_valid_clipformat_and_tymed(CLIPFORMAT cfFormat, DWORD tymed) { if (!cfFormat || !tymed ||
(cfFormat == CF_METAFILEPICT && tymed == TYMED_MFPICT) ||
(cfFormat == CF_METAFILEPICT && (tymed == TYMED_MFPICT || tymed == TYMED_FILE)) || (cfFormat == CF_BITMAP && tymed == TYMED_GDI) || (cfFormat == CF_DIB && tymed == TYMED_HGLOBAL) || (cfFormat == CF_ENHMETAFILE && tymed == TYMED_ENHMF))
This should be easy enough to test. Create a stand-alone data cache ( using CreateDataCache() ), then call IOleCache_Cache with the relevant fmtetc.
Ufortunately it's not that simple. IOleCache_Cache() refuses to accept FORMATETC for CF_METAFILEPICT with medium set to TYMED_FILE, and both IOleCache_SetData() and IOleObject_SetData() don't accept STGMEDIUM set to TYMED_FILE either (with properly initialized lpszFileName pointing to a valid metafile). I have no idea how an existing storage may have medium set to TYMED_FILE, or how to set it for testing purposes besides manually patching the storage, any ideas?
On 30 Oct 2015, at 06:07, Dmitry Timoshkov wrote:
Huw Davies huw@codeweavers.com wrote:
This should be easy enough to test. Create a stand-alone data cache ( using CreateDataCache() ), then call IOleCache_Cache with the relevant fmtetc.
Ufortunately it's not that simple. IOleCache_Cache() refuses to accept FORMATETC for CF_METAFILEPICT with medium set to TYMED_FILE, and both IOleCache_SetData() and IOleObject_SetData() don't accept STGMEDIUM set to TYMED_FILE either (with properly initialized lpszFileName pointing to a valid metafile). I have no idea how an existing storage may have medium set to TYMED_FILE, or how to set it for testing purposes besides manually patching the storage, any ideas?
In that case you'll have to create the stream by hand and try to load it (and also fix your patch so that IOleCache_* don't end up accepting TYMED_FILE).
Huw.