ole32: Only load the contents stream for the static clsids.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e3fe10719e
commit
ce66c8d147
|
@ -162,6 +162,9 @@ struct DataCache
|
||||||
IAdviseSink *sinkInterface;
|
IAdviseSink *sinkInterface;
|
||||||
|
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
|
/* Is the clsid one of the CLSID_Picture classes */
|
||||||
|
BOOL clsid_static;
|
||||||
|
|
||||||
IStorage *presentationStorage;
|
IStorage *presentationStorage;
|
||||||
|
|
||||||
/* list of cache entries */
|
/* list of cache entries */
|
||||||
|
@ -1307,9 +1310,13 @@ static HRESULT create_automatic_entry(DataCache *cache, const CLSID *clsid)
|
||||||
while (ptr->clsid)
|
while (ptr->clsid)
|
||||||
{
|
{
|
||||||
if (IsEqualCLSID( clsid, ptr->clsid ))
|
if (IsEqualCLSID( clsid, ptr->clsid ))
|
||||||
|
{
|
||||||
|
cache->clsid_static = TRUE;
|
||||||
return DataCache_CreateEntry( cache, &ptr->fmt, 0, TRUE, NULL );
|
return DataCache_CreateEntry( cache, &ptr->fmt, 0, TRUE, NULL );
|
||||||
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
cache->clsid_static = FALSE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1776,24 +1783,33 @@ 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_dib_fmt = { CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||||
|
|
||||||
static HRESULT parse_contents_stream( DataCache *This, IStorage *stg, IStream *stm )
|
static HRESULT parse_contents_stream( DataCache *This, IStorage *stg )
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
STATSTG stat;
|
STATSTG stat;
|
||||||
const FORMATETC *fmt;
|
const FORMATETC *fmt;
|
||||||
|
IStream *stm;
|
||||||
|
|
||||||
|
hr = IStorage_OpenStream( stg, CONTENTS, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm );
|
||||||
|
if (FAILED( hr )) return hr;
|
||||||
|
|
||||||
hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
|
hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
|
||||||
if (FAILED( hr )) return hr;
|
if (FAILED( hr )) goto done;
|
||||||
|
|
||||||
if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Dib ))
|
if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Dib ))
|
||||||
fmt = &static_dib_fmt;
|
fmt = &static_dib_fmt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("unsupported format %s\n", debugstr_guid( &stat.clsid ));
|
FIXME("unsupported format %s\n", debugstr_guid( &stat.clsid ));
|
||||||
return E_FAIL;
|
hr = E_FAIL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
return add_cache_entry( This, fmt, 0, stm, contents_stream );
|
hr = add_cache_entry( This, fmt, 0, stm, contents_stream );
|
||||||
|
|
||||||
|
done:
|
||||||
|
IStream_Release( stm );
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -1804,42 +1820,38 @@ static HRESULT parse_contents_stream( DataCache *This, IStorage *stg, IStream *s
|
||||||
* and it will load the presentation information when the
|
* and it will load the presentation information when the
|
||||||
* IDataObject_GetData or IViewObject2_Draw methods are called.
|
* IDataObject_GetData or IViewObject2_Draw methods are called.
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *pStg )
|
static HRESULT WINAPI DataCache_Load( IPersistStorage *iface, IStorage *stg )
|
||||||
{
|
{
|
||||||
DataCache *This = impl_from_IPersistStorage(iface);
|
DataCache *This = impl_from_IPersistStorage(iface);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IStream *stm;
|
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
DataCacheEntry *entry, *cursor2;
|
DataCacheEntry *entry, *cursor2;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", iface, pStg);
|
TRACE("(%p, %p)\n", iface, stg);
|
||||||
|
|
||||||
IPersistStorage_HandsOffStorage( iface );
|
IPersistStorage_HandsOffStorage( iface );
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( entry, cursor2, &This->cache_list, DataCacheEntry, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( entry, cursor2, &This->cache_list, DataCacheEntry, entry )
|
||||||
DataCacheEntry_Destroy( This, entry );
|
DataCacheEntry_Destroy( This, entry );
|
||||||
|
|
||||||
ReadClassStg( pStg, &clsid );
|
ReadClassStg( stg, &clsid );
|
||||||
hr = create_automatic_entry( This, &clsid );
|
hr = create_automatic_entry( This, &clsid );
|
||||||
if (FAILED( hr )) return hr;
|
if (FAILED( hr )) return hr;
|
||||||
|
|
||||||
This->clsid = clsid;
|
This->clsid = clsid;
|
||||||
|
|
||||||
hr = IStorage_OpenStream( pStg, CONTENTS, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE,
|
if (This->clsid_static)
|
||||||
0, &stm );
|
|
||||||
if (SUCCEEDED( hr ))
|
|
||||||
{
|
{
|
||||||
hr = parse_contents_stream( This, pStg, stm );
|
hr = parse_contents_stream( This, stg );
|
||||||
IStream_Release( stm );
|
if (FAILED(hr)) hr = parse_pres_streams( This, stg );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (FAILED(hr))
|
hr = parse_pres_streams( This, stg );
|
||||||
hr = parse_pres_streams( This, pStg );
|
|
||||||
|
|
||||||
if (SUCCEEDED( hr ))
|
if (SUCCEEDED( hr ))
|
||||||
{
|
{
|
||||||
This->dirty = FALSE;
|
This->dirty = FALSE;
|
||||||
This->presentationStorage = pStg;
|
This->presentationStorage = stg;
|
||||||
IStorage_AddRef( This->presentationStorage );
|
IStorage_AddRef( This->presentationStorage );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2978,6 +2990,7 @@ static DataCache* DataCache_Construct(
|
||||||
newObject->sinkAdviseFlag = 0;
|
newObject->sinkAdviseFlag = 0;
|
||||||
newObject->sinkInterface = 0;
|
newObject->sinkInterface = 0;
|
||||||
newObject->clsid = CLSID_NULL;
|
newObject->clsid = CLSID_NULL;
|
||||||
|
newObject->clsid_static = FALSE;
|
||||||
newObject->presentationStorage = NULL;
|
newObject->presentationStorage = NULL;
|
||||||
list_init(&newObject->cache_list);
|
list_init(&newObject->cache_list);
|
||||||
newObject->last_cache_id = 2;
|
newObject->last_cache_id = 2;
|
||||||
|
|
Loading…
Reference in New Issue