Module: wine Branch: master Commit: 480c10cce994ee1cae89c2fdf9921d0d0e1e4a9d URL: http://source.winehq.org/git/wine.git/?a=commit;h=480c10cce994ee1cae89c2fdf9...
Author: Huw Davies huw@codeweavers.com Date: Wed Mar 25 08:37:36 2015 +0000
ole32: Add support for parsing the 'CONTENTS' stream.
---
dlls/ole32/datacache.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 53defc1..f791f80 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -92,6 +92,7 @@ enum stream_type { no_stream, pres_stream, + contents_stream };
typedef struct DataCacheEntry @@ -1293,6 +1294,26 @@ static HRESULT parse_pres_streams( DataCache *This, IStorage *stg ) return S_OK; }
+static const FORMATETC static_dib_fmt = { CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + +static HRESULT parse_contents_stream( DataCache *This, IStorage *stg, IStream *stm ) +{ + HRESULT hr; + STATSTG stat; + const FORMATETC *fmt; + + hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME ); + if (FAILED( hr )) return hr; + + if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Dib )) + fmt = &static_dib_fmt; + else + return E_FAIL; + + return add_cache_entry( This, fmt, stm, contents_stream ); +} + +static const WCHAR CONTENTS[] = {'C','O','N','T','E','N','T','S',0};
/************************************************************************ * DataCache_Load (IPersistStorage) @@ -1306,12 +1327,21 @@ static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *pStg ) { DataCache *This = impl_from_IPersistStorage(iface); HRESULT hr; + IStream *stm;
TRACE("(%p, %p)\n", iface, pStg);
IPersistStorage_HandsOffStorage( iface );
- hr = parse_pres_streams( This, pStg ); + hr = IStorage_OpenStream( pStg, CONTENTS, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, + 0, &stm ); + if (SUCCEEDED( hr )) + { + hr = parse_contents_stream( This, pStg, stm ); + IStream_Release( stm ); + } + else + hr = parse_pres_streams( This, pStg );
if (SUCCEEDED( hr )) {