ole32: Add support for retrieving data from IPersistStorage.

This commit is contained in:
Huw Davies 2009-05-11 13:51:49 +01:00 committed by Alexandre Julliard
parent a9f96ad60a
commit 63eb810428
1 changed files with 21 additions and 1 deletions

View File

@ -98,13 +98,15 @@ static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed)
* *
* Retrieve an object's storage from a variety of sources. * Retrieve an object's storage from a variety of sources.
* *
* FIXME: CF_EMBEDDEDOBJECT, CF_FILENAME, IPersistStorage. * FIXME: CF_EMBEDDEDOBJECT, CF_FILENAME.
*/ */
static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf) static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf)
{ {
HRESULT hr; HRESULT hr;
FORMATETC fmt; FORMATETC fmt;
STGMEDIUM med; STGMEDIUM med;
IPersistStorage *persist;
CLSID clsid;
*src_cf = 0; *src_cf = 0;
@ -119,6 +121,24 @@ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf)
return hr; return hr;
} }
/* IPersistStorage */
hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist);
if(FAILED(hr)) return hr;
hr = IPersistStorage_GetClassID(persist, &clsid);
if(FAILED(hr)) goto end;
hr = IStorage_SetClass(stg, &clsid);
if(FAILED(hr)) goto end;
hr = IPersistStorage_Save(persist, stg, FALSE);
if(FAILED(hr)) goto end;
hr = IPersistStorage_SaveCompleted(persist, NULL);
end:
IPersistStorage_Release(persist);
return hr; return hr;
} }