Commit 480c10cc authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Add support for parsing the 'CONTENTS' stream.

parent d864387a
...@@ -92,6 +92,7 @@ enum stream_type ...@@ -92,6 +92,7 @@ enum stream_type
{ {
no_stream, no_stream,
pres_stream, pres_stream,
contents_stream
}; };
typedef struct DataCacheEntry typedef struct DataCacheEntry
...@@ -1293,6 +1294,26 @@ static HRESULT parse_pres_streams( DataCache *This, IStorage *stg ) ...@@ -1293,6 +1294,26 @@ static HRESULT parse_pres_streams( DataCache *This, IStorage *stg )
return S_OK; 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) * DataCache_Load (IPersistStorage)
...@@ -1306,11 +1327,20 @@ static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *pStg ) ...@@ -1306,11 +1327,20 @@ static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *pStg )
{ {
DataCache *This = impl_from_IPersistStorage(iface); DataCache *This = impl_from_IPersistStorage(iface);
HRESULT hr; HRESULT hr;
IStream *stm;
TRACE("(%p, %p)\n", iface, pStg); TRACE("(%p, %p)\n", iface, pStg);
IPersistStorage_HandsOffStorage( iface ); IPersistStorage_HandsOffStorage( iface );
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 ); hr = parse_pres_streams( This, pStg );
if (SUCCEEDED( hr )) if (SUCCEEDED( hr ))
......
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